Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.92 KB | None | 0 0
  1. #include "Controller.h"
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. const bool _CONTROLLER_DEBUG = false;
  6.  
  7. CController::CController()
  8. : thePlayerInfo(NULL)
  9. {
  10. }
  11.  
  12.  
  13. CController::~CController()
  14. {
  15. // We just set thePlayerInfo to NULL without deleting. SceneText will delete this.
  16. if (thePlayerInfo)
  17. thePlayerInfo = NULL;
  18. }
  19.  
  20.  
  21. // Create this controller
  22. bool CController::Create(CPlayerInfo* thePlayerInfo)
  23. {
  24. if (_CONTROLLER_DEBUG)
  25. cout << "CController::Create()" << endl;
  26. this->thePlayerInfo = thePlayerInfo;
  27. return false;
  28. }
  29.  
  30. // Read from the controller
  31. int CController::Read(const const float deltaTime)
  32. {
  33. if (_CONTROLLER_DEBUG)
  34. cout << "CController::Read()" << endl;
  35. return 0;
  36. }
  37.  
  38. // Detect and process front / back movement on the controller
  39. bool CController::Move_FrontBack(const float deltaTime, const bool direction, const float speedMultiplier)
  40. {
  41. if (_CONTROLLER_DEBUG)
  42. cout << "CController::Move_FrontBack()" << endl;
  43. if (thePlayerInfo)
  44. {
  45. thePlayerInfo->Move_FrontBack(deltaTime, direction, speedMultiplier);
  46. }
  47. return false;
  48. }
  49.  
  50. // Detect and process left / right movement on the controller
  51. bool CController::Move_LeftRight(const float deltaTime, const bool direction)
  52. {
  53. if (_CONTROLLER_DEBUG)
  54. cout << "CController::Move_LeftRight()" << endl;
  55. if (thePlayerInfo)
  56. {
  57. thePlayerInfo->Move_LeftRight(deltaTime, direction);
  58. }
  59. return false;
  60. }
  61.  
  62. // Detect and process look up / down on the controller
  63. bool CController::Look_UpDown(const float deltaTime, const bool direction, const float speedMultiplier)
  64. {
  65. if (_CONTROLLER_DEBUG)
  66. cout << "CController::Look_UpDown()" << endl;
  67. if (thePlayerInfo)
  68. {
  69. thePlayerInfo->Look_UpDown(deltaTime, direction, speedMultiplier);
  70. }
  71. return false;
  72. }
  73.  
  74. // Detect and process look left / right on the controller
  75. bool CController::Look_LeftRight(const float deltaTime, const bool direction, const float speedMultiplier)
  76. {
  77. if (_CONTROLLER_DEBUG)
  78. cout << "CController::Look_LeftRight()" << endl;
  79. if (thePlayerInfo)
  80. {
  81. thePlayerInfo->Look_LeftRight(deltaTime, direction, speedMultiplier);
  82. }
  83. return false;
  84. }
  85.  
  86. // Stop sway
  87. bool CController::StopSway(const float deltaTime)
  88. {
  89. if (_CONTROLLER_DEBUG)
  90. cout << "CController::StopSway()" << endl;
  91. if (thePlayerInfo)
  92. {
  93. thePlayerInfo->StopSway(deltaTime);
  94. }
  95. return false;
  96. }
  97.  
  98. // Jump
  99. bool CController::Jump(const float deltaTime)
  100. {
  101. if (_CONTROLLER_DEBUG)
  102. cout << "CController::Jump()" << endl;
  103. if (thePlayerInfo)
  104. {
  105. thePlayerInfo->SetToJumpUpwards(true);
  106. }
  107. return false;
  108. }
  109.  
  110. // Reload current weapon
  111. bool CController::Reload(const float deltaTime)
  112. {
  113. if (_CONTROLLER_DEBUG)
  114. cout << "CController::Reload()" << endl;
  115. if (thePlayerInfo)
  116. {
  117. thePlayerInfo->ReloadWeapon();
  118. }
  119. return false;
  120. }
  121.  
  122. // Change current weapon (for primary only)
  123. bool CController::Change(const float deltaTime)
  124. {
  125. if (_CONTROLLER_DEBUG)
  126. cout << "CController::Change()" << endl;
  127. if (thePlayerInfo)
  128. {
  129. thePlayerInfo->ChangeWeapon();
  130. }
  131. return false;
  132. }
  133.  
  134. // Fire primary weapon
  135. bool CController::FirePrimary(const float deltaTime)
  136. {
  137. if (_CONTROLLER_DEBUG)
  138. cout << "CController::FirePrimary()" << endl;
  139. if (thePlayerInfo)
  140. {
  141. thePlayerInfo->DischargePrimaryWeapon(deltaTime);
  142. }
  143. return false;
  144. }
  145.  
  146. // Fire secondary weapon
  147. bool CController::FireSecondary(const float deltaTime)
  148. {
  149. if (_CONTROLLER_DEBUG)
  150. cout << "CController::FireSecondary()" << endl;
  151. if (thePlayerInfo)
  152. {
  153. thePlayerInfo->DischargeSecondaryWeapon(deltaTime);
  154. }
  155. return false;
  156. }
  157.  
  158. // Reset the PlayerInfo
  159. bool CController::Reset(void)
  160. {
  161. if (_CONTROLLER_DEBUG)
  162. cout << "CController::Reset()" << endl;
  163. if (thePlayerInfo)
  164. {
  165. thePlayerInfo->Reset();
  166. }
  167. return false;
  168. }
  169.  
  170. bool CController::Posture(const float deltaTime)
  171. {
  172. if (_CONTROLLER_DEBUG)
  173. cout << "CController::Posture()" << endl;
  174. if (thePlayerInfo)
  175. {
  176. thePlayerInfo->ChangePosture();
  177. }
  178.  
  179. return false;
  180. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement