Changeset 8855 for code/trunk/src/modules/weapons/RocketController.cc
- Timestamp:
- Aug 22, 2011, 3:05:26 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/weapons/RocketController.cc
r7163 r8855 21 21 * 22 22 * Author: 23 * Gabriel Nadler , Originalfile: Oli Scheuss23 * Gabriel Nadler 24 24 * Co-authors: 25 25 * ... … … 27 27 */ 28 28 29 /** 30 @file BasicProjectile.h 31 @brief Implementation of the BasicProjectile class. 32 */ 33 29 34 #include "RocketController.h" 35 36 #include "util/Math.h" 37 #include "worldentities/pawns/Pawn.h" 30 38 #include "projectiles/SimpleRocket.h" 31 #include "util/Math.h" 32 #include "weapons/projectiles/SimpleRocket.h" 33 #include "util/Debug.h" 34 #include "weapons/weaponmodes/SimpleRocketFire.h" 35 #include "worldentities/pawns/Pawn.h" 39 #include "weaponmodes/SimpleRocketFire.h" 36 40 37 41 namespace orxonox … … 39 43 /** 40 44 @brief 41 Constructor.45 Constructor. 42 46 */ 43 47 RocketController::RocketController(BaseObject* creator) : Controller(creator) … … 46 50 COUT(5)<< "RocketController constructed\n"; 47 51 48 52 // Create a rocket for the controller. 49 53 this->rocket_ = new SimpleRocket(this); 50 54 this->rocket_->setController(this); … … 55 59 /** 56 60 @brief 57 The controlling happens here. This method defines what the controller has to do each tick.61 The controlling happens here. This method defines what the controller has to do each tick. 58 62 @param dt 59 The duration of the tick.63 The duration of the tick. 60 64 */ 61 65 void RocketController::tick(float dt) 62 66 { 63 64 67 if (this->target_ && this->rocket_->hasFuel()) { 65 this-> setTargetPosition();66 this->moveTo TargetPosition();68 this->updateTargetPosition(); 69 this->moveToPosition(this->targetPosition_); 67 70 } 68 69 70 71 } 71 72 72 73 73 RocketController::~RocketController() … … 76 76 } 77 77 78 void RocketController::setTargetPosition() 78 /** 79 @brief 80 Update the position of the target. 81 */ 82 void RocketController::updateTargetPosition() 79 83 { 80 this->targetPosition_ =this->target_->getWorldPosition(); //don't really note a difference in the rocket behaviour xD84 this->targetPosition_ = this->target_->getWorldPosition(); //don't really note a difference in the rocket behaviour xD 81 85 //this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getWorldPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getWorldPosition(), this->target_->getVelocity()); 82 }83 void RocketController::moveToTargetPosition()84 {85 this->moveToPosition(this->targetPosition_);86 }87 88 89 90 void RocketController::setTarget(WorldEntity* target)91 {92 this->target_ = target;93 86 } 94 87 … … 110 103 } 111 104 112 113 114 115 105 }
Note: See TracChangeset
for help on using the changeset viewer.