- Timestamp:
- Jul 21, 2011, 5:36:37 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai2/src/orxonox/controllers/ArtificialController.cc
r8764 r8769 49 49 #include "weaponsystem/Weapon.h" 50 50 #include "weaponsystem/WeaponSlot.h" 51 #include "weaponsystem/WeaponSlot.h" 51 52 52 53 namespace orxonox … … 93 94 this->botlevel_ = 0.5f; 94 95 this->mode_ = DEFAULT;////Vector-implementation: mode_.push_back(DEFAULT); 95 this->timeout_=0; 96 this->timeout_ = 0; 97 this->currentWaypoint_ = 0; 98 this->setAccuracy(100); 96 99 } 97 100 … … 100 103 if (this->isInitialized()) 101 104 {//Vector-implementation: mode_.erase(mode_.begin(),mode_.end()); 105 for (size_t i = 0; i < this->waypoints_.size(); ++i) 106 this->waypoints_[i]->destroy(); 102 107 this->removeFromFormation(); 103 108 this->weaponModes_.clear(); … … 1140 1145 } 1141 1146 1147 void ArtificialController::addWaypoint(WorldEntity* waypoint) 1148 { 1149 this->waypoints_.push_back(waypoint); 1150 } 1151 1152 WorldEntity* ArtificialController::getWaypoint(unsigned int index) const 1153 { 1154 if (index < this->waypoints_.size()) 1155 return this->waypoints_[index]; 1156 else 1157 return 0; 1158 } 1159 1160 void ArtificialController::updatePointsOfInterest(std::string name, float distance) 1161 { 1162 WorldEntity* waypoint = NULL; 1163 if(name == "Pickup") 1164 { 1165 for (ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it != ObjectList<WorldEntity>::end(); ++it) 1166 { 1167 //get POI by string: Possible POIs are PICKUPSPAWNER, FORCEFIELDS (!analyse!), ... 1168 //if(it->isA(Pickupable)) //distance to POI decides wether it is added (neither too close nor too far away) 1169 //To Think: how should POI's be managed? (e.g. if there are no real moving target or if the can be taken "en passant".) 1170 waypoint = *it; 1171 /*const Vector3 realDistance = it->getPosition() - this->getControllableEntity()->getPosition(); 1172 if( realDistance.length() < distance) 1173 { 1174 float minDistance = it->getTriggerDistance().length()*it->getTriggerDistance().length(); 1175 if(this->squaredaccuracy_ > minDistance) 1176 this->squaredaccuracy_ = minDistance; 1177 //waypoint = static_cast<WorldEntity*>(it); 1178 break; 1179 // }*/ 1180 } 1181 } 1182 if(waypoint) 1183 this->waypoints_.push_back(waypoint); 1184 } 1185 1142 1186 }
Note: See TracChangeset
for help on using the changeset viewer.