Changeset 8701 for code/branches/ai/src/orxonox/controllers/AIController.cc
- Timestamp:
- Jun 9, 2011, 11:40:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai/src/orxonox/controllers/AIController.cc
r8238 r8701 35 35 #include "worldentities/pawns/Pawn.h" 36 36 37 //Todo: Bot soll pickupspawner besuchen können, falls Pickup vorhanden 37 //Todo: Bot soll pickupspawner besuchen können, falls Pickup vorhanden --modules/weapons/ 38 38 namespace orxonox 39 39 { … … 205 205 float random; 206 206 float maxrand = 100.0f / ACTION_INTERVAL; 207 207 208 208 if (!this->isActive()) 209 209 return; 210 210 211 if (this->state_ == MASTER) 212 { 213 if (this->specificMasterAction_ == NONE) 211 if(this->mode_ == DEFAULT) 212 { 213 if (this->state_ == MASTER) 214 { 215 if (this->specificMasterAction_ == NONE) 216 { 217 if (this->target_) 218 { 219 if (!this->target_->getRadarVisibility()) /* So AI won't shoot invisible Spaceships */ 220 this->forgetTarget(); 221 else 222 { 223 this->aimAtTarget(); 224 random = rnd(maxrand); 225 if(this->botlevel_*100 > random) 226 this->follow();//If a bot is shooting a player, it shouldn't let him go away easily. 227 } 228 } 229 230 if (this->bHasTargetPosition_) 231 this->moveToTargetPosition(); 232 233 this->doFire(); 234 } 235 236 if (this->specificMasterAction_ == TURN180) 237 this->turn180(); 238 239 if (this->specificMasterAction_ == SPIN) 240 this->spin(); 241 if (this->specificMasterAction_ == FOLLOW) 242 this->follow(); 243 } 244 245 if (this->state_ == SLAVE) 246 { 247 if (this->bHasTargetPosition_) 248 this->moveToTargetPosition(); 249 } 250 251 if (this->state_ == FREE) 214 252 { 215 253 if (this->target_) … … 223 261 if(this->botlevel_*100 > random) 224 262 this->follow();//If a bot is shooting a player, it shouldn't let him go away easily. 225 }263 } 226 264 } 227 265 … … 231 269 this->doFire(); 232 270 } 233 234 if (this->specificMasterAction_ == TURN180) 235 this->turn180(); 236 237 if (this->specificMasterAction_ == SPIN) 238 this->spin(); 239 if (this->specificMasterAction_ == FOLLOW) 240 this->follow(); 241 } 242 243 if (this->state_ == SLAVE) 244 { 245 if (this->bHasTargetPosition_) 246 this->moveToTargetPosition(); 247 } 248 249 if (this->state_ == FREE) 250 { 251 if (this->target_) 252 { 253 if (!this->target_->getRadarVisibility()) /* So AI won't shoot invisible Spaceships */ 254 this->forgetTarget(); 255 else 256 { 257 this->aimAtTarget(); 258 random = rnd(maxrand); 259 if(this->botlevel_*100 > random) 260 this->follow();//If a bot is shooting a player, it shouldn't let him go away easily. 271 }//END_OF DEFAULT MODE 272 else if (this->mode_ == ROCKET) 273 { 274 ControllableEntity *controllable = this->getControllableEntity(); 275 if(controllable) 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_ ? 261 280 } 262 } 263 264 if (this->bHasTargetPosition_) 265 this->moveToTargetPosition(); 266 267 this->doFire(); 268 } 269 281 else 282 this->mode_ = DEFAULT;//no rocket -> get out of rocket mode 283 } 284 else 285 this->mode_ = DEFAULT;//If bot dies -> getControllableEntity == NULL -> get out of ROCKET mode 286 }//END_OF ROCKET MODE 270 287 SUPER(AIController, tick, dt); 271 288 } 272 289 273 290 } 291
Note: See TracChangeset
for help on using the changeset viewer.