- Timestamp:
- Oct 31, 2015, 4:07:29 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc
r10729 r10731 40 40 this->setFormationMode(WALL); 41 41 42 bIsDivisionLeader_ = true;43 42 this->myFollower_ = 0; 44 43 this->myWingman_ = 0; 45 44 this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&DivisionController::action, this))); 46 47 /*Vector3* pos = new Vector3(500,500,-500); 48 this->setTargetPosition(*pos);*/ 45 this->rank_ = DIVISIONLEADER; 46 47 Vector3* pos = new Vector3(500,500,-500); 48 this->setTargetPosition(*pos); 49 49 50 50 } … … 54 54 55 55 } 56 57 56 58 void DivisionController::tick(float dt) 57 59 { 60 if (this->target_) 61 { 62 this->aimAtTarget(); 63 this->doFire(); 64 } 65 58 66 if (this->bHasTargetPosition_) 59 67 { … … 68 76 setTargetPositionOfFollower(); 69 77 setTargetPositionOfWingman(); 70 } 71 72 bool DivisionController::setFollower(LeaderController* myFollower) 73 { 74 if (!this->myFollower_) 75 { 76 this->myFollower_ = myFollower; 77 return true; 78 } 79 else 80 { 81 return false; 82 } 83 } 78 79 for (ObjectList<Controller>::iterator it = ObjectList<Controller>::begin(); it; ++it) 80 { 81 if (this->getControllableEntity()->getTeam() != (it)->getControllableEntity()->getTeam()) 82 { 83 this->target_=it->getControllableEntity(); 84 this->setTargetPosition(this->target_->getWorldPosition()); 85 break; 86 } 87 } 88 89 90 } 91 92 84 93 85 94 void DivisionController::setTargetPositionOfWingman() … … 149 158 150 159 } 160 161 162 bool DivisionController::setWingman(CommonController* cwingman) 163 { 164 165 WeakPtr<WingmanController> wingman = orxonox_cast<WingmanController*>(cwingman); 166 if (!this->myWingman_) 167 { 168 this->myWingman_ = wingman; 169 return true; 170 } 171 else 172 { 173 return false; 174 } 175 176 } 177 bool DivisionController::setFollower(LeaderController* myFollower) 178 { 179 if (!this->myFollower_) 180 { 181 this->myFollower_ = myFollower; 182 return true; 183 } 184 else 185 { 186 return false; 187 } 188 } 189 bool DivisionController::hasWingman() 190 { 191 if (this->myWingman_) 192 return true; 193 else 194 return false; 195 } 196 bool DivisionController::hasFollower() 197 { 198 if (this->myFollower_) 199 return true; 200 else 201 return false; 202 } 203 204 151 205 void DivisionController::XMLPort(Element& xmlelement, XMLPort::Mode mode) 152 206 {
Note: See TracChangeset
for help on using the changeset viewer.