Changeset 9005
- Timestamp:
- Dec 19, 2011, 2:43:04 PM (13 years ago)
- Location:
- code/branches/presentation2011/src/orxonox/controllers
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2011/src/orxonox/controllers/AIController.cc
r8992 r9005 59 59 if (this->state_ == FREE) 60 60 { 61 61 62 62 if (this->formationFlight_) 63 63 { 64 65 //changed order -> searchNewMaster MUSTN'T be called in SLAVE-state (bugfix for internal-error messages at quit) 66 random = rnd(maxrand); 67 if (random < 90 && (((!this->target_) || (random < 50 && this->target_)) && !this->forcedFree())) 68 this->searchNewMaster(); 69 64 70 // return to Master after being forced free 65 71 if (this->freedomCount_ == 1) … … 68 74 this->freedomCount_ = 0; 69 75 } 70 71 random = rnd(maxrand);72 if (random < 90 && (((!this->target_) || (random < 50 && this->target_)) && !this->forcedFree()))73 this->searchNewMaster();74 76 } 75 77 … … 78 80 } 79 81 80 if (this->state_ == SLAVE && this->formationMode_ == ATTACK) //TODO: add botlevel parameter82 if (this->state_ == SLAVE && this->formationMode_ == ATTACK) 81 83 { 82 84 // search enemy 83 85 random = rnd(maxrand); 84 if (random < 75&& (!this->target_))86 if (random < (botlevel_*100) && (!this->target_)) 85 87 this->searchNewTarget(); 86 88 87 89 // next enemy 88 90 random = rnd(maxrand); 89 if (random < 10&& (this->target_))91 if (random < (botlevel_*30) && (this->target_)) 90 92 this->searchNewTarget(); 91 93 92 94 // shoot 93 95 random = rnd(maxrand); 94 if (!(this->passive_) && random < 75&& (this->target_ && !this->bShooting_))96 if (!(this->passive_) && random < (botlevel_*100) && (this->target_ && !this->bShooting_)) 95 97 this->bShooting_ = true; 96 98 97 99 // stop shooting 98 100 random = rnd(maxrand); 99 if (random < 25&& (this->bShooting_))101 if (random < (1-botlevel_)*50 && (this->bShooting_)) 100 102 this->bShooting_ = false; 101 103 -
code/branches/presentation2011/src/orxonox/controllers/FormationController.cc
r8996 r9005 383 383 void FormationController::searchNewMaster() 384 384 { 385 385 if (this->state_==SLAVE) 386 return; 386 387 if (!this->getControllableEntity()) 387 388 return; … … 588 589 void FormationController::takeLeadOfFormation() 589 590 { 590 if (!this->getControllableEntity() )591 if (!this->getControllableEntity() || this->state_==MASTER) 591 592 return; 592 593 593 if (this->state_==MASTER) return;594 594 //search new Master, then take lead 595 if (this->state_==FREE )595 if (this->state_==FREE && this->myMaster_==0) 596 596 { 597 597 searchNewMaster(); -
code/branches/presentation2011/src/orxonox/controllers/HumanController.cc
r8992 r9005 78 78 this->boosting_ = false; 79 79 this->boosting_ = false; 80 this->tempMaster=NULL;81 80 HumanController::localController_s = this; 82 81 this->boostingTimeout_.setTimer(HumanController::BOOSTING_TIME, false, createExecutor(createFunctor(&HumanController::terminateBoosting, this))); 83 82 this->boostingTimeout_.stopTimer(); 84 this->state_=FREE;85 83 } 86 84 -
code/branches/presentation2011/src/orxonox/controllers/HumanController.h
r8992 r9005 113 113 Timer boostingTimeout_; // A timer to check whether the player is no longer boosting. 114 114 static const float BOOSTING_TIME; // The time after it is checked, whether the player is no longer boosting. 115 FormationController* tempMaster;116 115 117 116 }; // tolua_export -
code/branches/presentation2011/src/orxonox/controllers/NewHumanController.cc
r8992 r9005 277 277 } 278 278 279 void NewHumanController::doFire(unsigned int firemode) //TODO??279 void NewHumanController::doFire(unsigned int firemode) 280 280 { 281 281 if (!this->controllableEntity_) … … 291 291 } 292 292 else 293 HumanController::localController_s->getControllableEntity()->fire(firemode); 294 293 HumanController::doFire(firemode); //call for formationflight 295 294 } 296 295
Note: See TracChangeset
for help on using the changeset viewer.