Changeset 8711 for code/branches/ai/src/orxonox/controllers/AIController.cc
- Timestamp:
- Jun 22, 2011, 6:57:16 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai/src/orxonox/controllers/AIController.cc
r8701 r8711 270 270 } 271 271 }//END_OF DEFAULT MODE 272 else if (this->mode_ == ROCKET) 272 else if (this->mode_ == ROCKET)//Rockets do not belong to a group of bots -> bot states are not relevant. 273 273 { 274 274 ControllableEntity *controllable = this->getControllableEntity(); 275 275 if(controllable) 276 276 { 277 if(controllable->getRocket())//Check wether the bot is controlling the rocket. 278 { 279 this->follow(); //TODO: CHECK: does follow make the bot crash into the target_ ? 280 } 281 else 282 this->mode_ = DEFAULT;//no rocket -> get out of rocket mode 277 if(controllable->getRocket())//Check wether the bot is controlling the rocket and if the timeout is over. 278 { 279 this->follow(); //TODO: CHECK: does follow make the bot crash into the target_ ? 280 this->timeout_ -= dt; 281 if((timeout_< 0)||(!target_))//Check if the timeout is over or target died. 282 { 283 controllable->fire(0);//kill the rocket 284 this->setPreviousMode();//get out of rocket mode 285 } 286 } 287 else 288 this->setPreviousMode();//no rocket entity -> get out of rocket mode 283 289 } 284 290 else 285 this-> mode_ = DEFAULT;//If bot dies -> getControllableEntity == NULL -> get out of ROCKET mode291 this->setPreviousMode();//If bot dies -> getControllableEntity == NULL -> get out of ROCKET mode 286 292 }//END_OF ROCKET MODE 287 293 SUPER(AIController, tick, dt);
Note: See TracChangeset
for help on using the changeset viewer.