- Timestamp:
- Jan 27, 2011, 7:50:16 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai/src/orxonox/controllers/ArtificialController.cc
r7832 r7833 86 86 this->bSetupWorked = false; 87 87 this->numberOfWeapons = 0; 88 this->botlevel_ = 10.0f; 88 89 } 89 90 … … 128 129 XMLPortParam(ArtificialController, "formationSize", setFormationSize, getFormationSize, xmlelement, mode).defaultValues(STANDARD_MAX_FORMATION_SIZE); 129 130 XMLPortParam(ArtificialController, "passive", setPassive, getPassive, xmlelement, mode).defaultValues(false); 131 XMLPortParam(ArtificialController, "level", setBotLevel, getBotLevel, xmlelement, mode).defaultValues(1.0f); 130 132 } 131 133 … … 1018 1020 return (team1 == team2 && team1 != -1); 1019 1021 } 1020 1022 /** 1023 @brief DoFire is called when a bot should shoot and decides which weapon is used and whether the bot shoots at all. 1024 */ 1021 1025 void ArtificialController::doFire() 1022 1026 { … … 1027 1031 bSetupWorked=true; 1028 1032 } 1029 else if(this->getControllableEntity()&&(numberOfWeapons>0)&&this->bShooting_ && this->isCloseAtTarget(1000 ) && this->isLookingAtTarget(math::pi / 20.0f))1030 { 1031 if (this->isCloseAtTarget(1 40) && this->isLookingAtTarget(math::pi / 20.0f)&&(weapons[1]==1) )1033 else if(this->getControllableEntity()&&(numberOfWeapons>0)&&this->bShooting_ && this->isCloseAtTarget(1000 + botlevel_*200) && this->isLookingAtTarget(math::pi / 20.0f)) 1034 { 1035 if (this->isCloseAtTarget(130) && this->isLookingAtTarget(math::pi / 20.0f)&&(weapons[1]==1) ) 1032 1036 this->getControllableEntity()->fire(1); //ai uses lens flare if they're close enough to the target 1033 1037 … … 1037 1041 } 1038 1042 } 1043 /** 1044 @brief Information gathering: Which weapons are ready to use? 1045 */ 1039 1046 void ArtificialController::setupWeapons() 1040 1047 { … … 1057 1064 } 1058 1065 } 1066 1067 void ArtificialController::setBotLevel(float level) 1068 { 1069 if (level < 1) 1070 this->botlevel_ = 1 ; 1071 else if (level > 10) 1072 this->botlevel_ = 10; 1073 else 1074 this->botlevel_ = level; 1075 } 1059 1076 }
Note: See TracChangeset
for help on using the changeset viewer.