- Timestamp:
- Nov 25, 2015, 2:05:43 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc
r10854 r10856 51 51 SectionController::~SectionController() 52 52 { 53 if (this->myWingman_) 54 { 55 this->myWingman_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_); 56 } 53 57 for (size_t i = 0; i < this->actionpoints_.size(); ++i) 54 58 { … … 151 155 } 152 156 153 void SectionController::boostControl() 154 { 155 SpaceShip* ship = orxonox_cast<SpaceShip*>(this->getControllableEntity()); 156 if(ship == NULL) return; 157 if(ship->getBoostPower()*1.5f > ship->getInitialBoostPower() ) //upper limit ->boost 158 { 159 160 this->getControllableEntity()->boost(true); 161 } 162 else if(ship->getBoostPower()*4.0f < ship->getInitialBoostPower()) //lower limit ->do not boost 163 { 164 this->getControllableEntity()->boost(false); 165 } 166 } 157 167 158 //PRE: myDivisionLeader_ != 0 && myDivisionLeader_->action_ == Action::FIGHT 168 159 //POST: this->target_ is set unless division leader doesn't have one … … 250 241 } 251 242 252 //----stay in formation---- 253 //gani-TODO: sum targetAbso... and this->predicted position 254 void SectionController::setTargetPositionOfWingman() 255 { 256 if (!this->myWingman_) 257 return; 258 Vector3* targetRelativePositionOfWingman; 259 switch (this->formationMode_){ 260 case FormationMode::WALL: 261 { 262 targetRelativePositionOfWingman = new Vector3 (-400, 0, 0); 263 break; 264 } 265 case FormationMode::FINGER4: 266 { 267 targetRelativePositionOfWingman = new Vector3 (-400, 0, 200); 268 break; 269 } 270 case FormationMode::DIAMOND: 271 { 272 targetRelativePositionOfWingman = new Vector3 (400, -200, 0); 273 break; 274 } 275 } 276 Quaternion orient = this->getControllableEntity()->getWorldOrientation(); 277 278 Vector3 targetAbsolutePositionOfWingman = ((this->getControllableEntity()->getWorldPosition()) + 279 (this->getControllableEntity()->getWorldOrientation()* (*targetRelativePositionOfWingman))); 280 281 myWingman_->setAction (Action::FLY, targetAbsolutePositionOfWingman, orient); 282 283 } 243 284 244 285 245 LeaderController* SectionController::findNewDivisionLeader()
Note: See TracChangeset
for help on using the changeset viewer.