Changeset 7842 for code/branches/ai/src/orxonox/controllers
- Timestamp:
- Jan 31, 2011, 11:36:18 PM (14 years ago)
- Location:
- code/branches/ai/src/orxonox/controllers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai/src/orxonox/controllers/AIController.cc
r7840 r7842 76 76 // search enemy 77 77 random = rnd(maxrand); 78 if (random < (15 + botlevel_* 2 ) && (!this->target_))78 if (random < (15 + botlevel_* 20) && (!this->target_)) 79 79 this->searchNewTarget(); 80 80 81 81 // forget enemy 82 82 random = rnd(maxrand); 83 if (random < ( 5/botlevel_) && (this->target_))83 if (random < ((1-botlevel_)*5) && (this->target_)) 84 84 this->forgetTarget(); 85 85 86 86 // next enemy 87 87 random = rnd(maxrand); 88 if (random < ( 10 + botlevel_) && (this->target_))88 if (random < ((1+ botlevel_)*10) && (this->target_)) 89 89 this->searchNewTarget(); 90 90 … … 106 106 // shoot 107 107 random = rnd(maxrand); 108 if (!(this->passive_) && random < (75 + botlevel_* 3) && (this->target_ && !this->bShooting_))108 if (!(this->passive_) && random < (75 + botlevel_*25) && (this->target_ && !this->bShooting_)) 109 109 this->bShooting_ = true; 110 110 111 111 // stop shooting 112 112 random = rnd(maxrand); 113 if (random < ( 25 - botlevel_*2) && (this->bShooting_))113 if (random < ((1 - botlevel_)*25) && (this->bShooting_)) 114 114 this->bShooting_ = false; 115 115 … … 192 192 // stop shooting 193 193 random = rnd(maxrand); 194 if (random < ( 25 - botlevel_*2) && (this->bShooting_))194 if (random < ( (1- botlevel_)*25 ) && (this->bShooting_)) 195 195 this->bShooting_ = false; 196 196 -
code/branches/ai/src/orxonox/controllers/ArtificialController.cc
r7841 r7842 52 52 SetConsoleCommand("ArtificialController", "passivebehaviour", &ArtificialController::passivebehaviour); 53 53 SetConsoleCommand("ArtificialController", "formationsize", &ArtificialController::formationsize); 54 SetConsoleCommand("ArtificialController", " botlevel", &ArtificialController::setBotLevel);54 SetConsoleCommand("ArtificialController", "setbotlevel", &ArtificialController::setAllBotLevel); 55 55 56 56 … … 88 88 this->bSetupWorked = false; 89 89 this->numberOfWeapons = 0; 90 this->botlevel_ = 1 0.0f;90 this->botlevel_ = 1.0f; 91 91 } 92 92 … … 1069 1069 void ArtificialController::setBotLevel(float level) 1070 1070 { 1071 if (level < 1)1072 this->botlevel_ = 1;1073 else if (level > 1 0)1074 this->botlevel_ = 1 0;1071 if (level < 0.0f) 1072 this->botlevel_ = 0.0f; 1073 else if (level > 1.0f) 1074 this->botlevel_ = 1.0f; 1075 1075 else 1076 1076 this->botlevel_ = level; 1077 1077 } 1078 1079 void ArtificialController::setAllBotLevel(float level) 1080 { 1081 for (ObjectList<ArtificialController>::iterator it = ObjectList<ArtificialController>::begin(); it != ObjectList<ArtificialController>::end(); ++it) 1082 it->setBotLevel(level); 1083 } 1084 1078 1085 } -
code/branches/ai/src/orxonox/controllers/ArtificialController.h
r7833 r7842 83 83 inline float getBotLevel() const 84 84 { return this->botlevel_; } 85 static void setAllBotLevel(float level); 85 86 86 87 protected:
Note: See TracChangeset
for help on using the changeset viewer.