Changeset 7127 for code/branches/presentation3/src/orxonox/controllers
- Timestamp:
- Jun 9, 2010, 9:32:58 PM (15 years ago)
- Location:
- code/branches/presentation3/src/orxonox/controllers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/orxonox/controllers/AIController.cc
r7090 r7127 112 112 random = rnd(maxrand); 113 113 if (random < 25 && (this->bShooting_)) 114 this->bShooting_ = false; 114 this->bShooting_ = false; 115 115 116 116 } … … 127 127 this->commandSlaves(); 128 128 129 if (this->specificMasterAction_ != NONE) 129 if (this->specificMasterAction_ != NONE) 130 130 this->specificMasterActionHold(); 131 131 … … 149 149 // lose master status (only if less than 4 slaves in formation) 150 150 random = rnd(maxrand); 151 if(random < 15/(this->slaves_.size()+1) && this->slaves_.size() < 4 ) 151 if(random < 15/(this->slaves_.size()+1) && this->slaves_.size() < 4 ) 152 152 this->loseMasterState(); 153 153 -
code/branches/presentation3/src/orxonox/controllers/ArtificialController.cc
r7107 r7127 91 91 { 92 92 this->removeFromFormation(); 93 93 94 94 for (ObjectList<ArtificialController>::iterator it = ObjectList<ArtificialController>::begin(); it; ++it) 95 95 { … … 101 101 it->myMaster_ = 0; 102 102 } 103 103 104 104 while (true) 105 105 { … … 139 139 { 140 140 Controller* controller = 0; 141 141 142 142 if (it->getController()) 143 143 controller = it->getController(); 144 144 else if (it->getXMLController()) 145 145 controller = it->getXMLController(); 146 146 147 147 if (!controller) 148 148 continue; … … 162 162 163 163 /** 164 @brief Get all masters to do a "specific master action" 164 @brief Get all masters to do a "specific master action" 165 165 @param action which action to perform (integer, so it can be called with a console command (tmp solution)) 166 166 */ … … 170 170 { 171 171 Controller* controller = 0; 172 172 173 173 if (it->getController()) 174 174 controller = it->getController(); 175 175 else if (it->getXMLController()) 176 176 controller = it->getXMLController(); 177 177 178 178 if (!controller) 179 179 continue; … … 204 204 { 205 205 Controller* controller = 0; 206 206 207 207 if (it->getController()) 208 208 controller = it->getController(); 209 209 else if (it->getXMLController()) 210 210 controller = it->getXMLController(); 211 211 212 212 if (!controller) 213 213 continue; … … 252 252 { 253 253 Controller* controller = 0; 254 254 255 255 if (it->getController()) 256 256 controller = it->getController(); 257 257 else if (it->getXMLController()) 258 258 controller = it->getXMLController(); 259 259 260 260 if (!controller) 261 261 continue; … … 280 280 { 281 281 Controller* controller = 0; 282 282 283 283 if (it->getController()) 284 284 controller = it->getController(); 285 285 else if (it->getXMLController()) 286 286 controller = it->getXMLController(); 287 287 288 288 if (!controller) 289 289 continue; … … 303 303 void ArtificialController::changedControllableEntity() 304 304 { 305 if (!this->getControllableEntity()) 305 if (!this->getControllableEntity()) 306 306 this->removeFromFormation(); 307 307 } … … 400 400 this->myMaster_->slaves_.erase(it); 401 401 } 402 402 403 403 this->myMaster_ = 0; 404 404 this->state_ = FREE; … … 423 423 //has it an ArtificialController? 424 424 Controller* controller = 0; 425 425 426 426 if (it->getController()) 427 427 controller = it->getController(); 428 428 else if (it->getXMLController()) 429 429 controller = it->getXMLController(); 430 430 431 431 if (!controller) 432 432 continue; … … 476 476 @brief Commands the slaves of a master into a formation. Sufficiently fast not to be called within tick. Initiated by a master. 477 477 */ 478 void ArtificialController::commandSlaves() 478 void ArtificialController::commandSlaves() 479 479 { 480 480 if(this->state_ != MASTER) return; … … 489 489 this->slaves_.front()->setTargetPosition(dest); 490 490 } 491 else 491 else 492 492 { 493 493 dest += 1.0f*orient*WorldEntity::BACK; … … 592 592 bool ArtificialController::forcedFree() 593 593 { 594 if(this->freedomCount_ > 0) 594 if(this->freedomCount_ > 0) 595 595 { 596 596 this->freedomCount_--; … … 606 606 if(this->state_ != MASTER) return; 607 607 608 if (specificMasterActionHoldCount_ == 0) 608 if (specificMasterActionHoldCount_ == 0) 609 609 { 610 610 this->specificMasterAction_ = NONE; … … 677 677 if (!always) 678 678 this->specificMasterActionHoldCount_ = secondsToFollow; 679 else 679 else 680 680 this->specificMasterActionHoldCount_ = INT_MAX; //for now... 681 681 … … 698 698 699 699 currentHumanController = orxonox_cast<NewHumanController*>(it->getController()); 700 if(currentHumanController) 700 if(currentHumanController) 701 701 { 702 702 if (!ArtificialController::sameTeam(this->getControllableEntity(), *it, this->getGametype())) continue; -
code/branches/presentation3/src/orxonox/controllers/ArtificialController.h
r7107 r7127 64 64 inline int getFormationSize() const 65 65 { return this->maxFormationSize_; } 66 66 67 67 inline void setPassive(bool passive) 68 68 { this->passive_ = passive; } -
code/branches/presentation3/src/orxonox/controllers/DroneController.h
r7034 r7127 52 52 DroneController(BaseObject* creator); 53 53 virtual ~DroneController(); 54 54 55 55 virtual void tick(float dt); //!< The controlling happens here. This method defines what the controller has to do each tick. 56 56
Note: See TracChangeset
for help on using the changeset viewer.