- Timestamp:
- Jul 7, 2011, 3:59:54 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai2/src/orxonox/controllers/ArtificialController.cc
r8733 r8735 90 90 this->bSetupWorked = false; 91 91 this->numberOfWeapons = 0; 92 this->botlevel_ = 1.0f;92 this->botlevel_ = 0.5f; 93 93 this->mode_ = DEFAULT;////Vector-implementation: mode_.push_back(DEFAULT); 94 94 this->timeout_=0; … … 1043 1043 else if(this->getControllableEntity()&&(numberOfWeapons>0)&&this->bShooting_ && this->isCloseAtTarget((1 + 2*botlevel_)*1000) && this->isLookingAtTarget(math::pi / 20.0f)) 1044 1044 { 1045 if (this->isCloseAtTarget(130) && (weapons[1]==1))1045 if (this->isCloseAtTarget(130) &&weapons[1] ) 1046 1046 {//LENSFLARE: short range weapon 1047 1047 this->getControllableEntity()->fire(1); //ai uses lens flare if they're close enough to the target 1048 1048 } 1049 else if( (weapons[3]==3)&& this->isCloseAtTarget(400) /*&&projectiles[3]*/ )1049 else if(weapons[3]&& this->isCloseAtTarget(400) /*&&projectiles[3]*/ ) 1050 1050 {//ROCKET: mid range weapon 1051 1051 //TODO: How many rockets are available? 1052 1052 this->mode_ = ROCKET;//Vector-implementation: mode_.push_back(ROCKET); 1053 this->getControllableEntity()->fire(3);//launch rocket BUG IS TRIGGERED HERE.1053 this->getControllableEntity()->fire(3);//launch rocket 1054 1054 if(this->getControllableEntity()&&this->target_)//after fire(3) getControllableEntity() refers to the rocket! 1055 1055 { … … 1064 1064 this->projectiles[3]-=1;//decrease ammo !! 1065 1065 } 1066 else if ( (weapons[0]==0))//LASER: default weapon1066 else if (weapons[0])//LASER: default weapon 1067 1067 this->getControllableEntity()->fire(0); 1068 1068 } … … 1083 1083 //const std::string wpn = getWeaponname(i, pawn); COUT(0)<<wpn<< std::endl;//Temporary debug info. 1084 1084 /*if(wpn=="") 1085 weapons[i]= -1;1085 weapons[i]=false; 1086 1086 else if(wpn=="LaserMunition")//other munitiontypes are not defined yet :-( 1087 weapons[0]= 0;1087 weapons[0]=true; 1088 1088 else if(wpn=="FusionMunition") 1089 weapons[1]= 1;1089 weapons[1]=true; 1090 1090 else if(wpn=="TargetSeeking Rockets") 1091 weapons[2]=2; 1092 else if(wpn=="ROCKET")//TODO: insert right munition name 1093 weapons[3]=3; 1091 weapons[2]=true; 1092 else if(wpn=="RocketMunition") 1093 weapons[3]=true; 1094 else 1095 COUT(1)<< wpn << + << " has to be added in ArtificialController.cc as new weapon." << std::endl; 1094 1096 */ 1095 1097 if(pawn->getWeaponSet(i)) //main part: find which weapons a pawn can use; hard coded at the moment! 1096 1098 { 1097 weapons[i]= i;1099 weapons[i]=true; 1098 1100 projectiles[i]=1;//TODO: how to express infinite ammo? how to get data?? getWeaponmode(i)->getMunition()->getNumMunition(WeaponMode* user) 1099 1101 numberOfWeapons++; 1100 1102 } 1101 1103 else 1102 weapons[i]=- 1;1104 weapons[i]=-false; 1103 1105 } 1104 1106 //pawn->weaponSystem_->getMunition(SubclassIdentifier< Munition > *identifier)->getNumMunition (WeaponMode *user);
Note: See TracChangeset
for help on using the changeset viewer.