- Timestamp:
- Nov 23, 2015, 11:17:22 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc
r10826 r10832 84 84 void DivisionController::action() 85 85 { 86 //----find a target---- 87 if ( !this->hasTarget() ) 88 { 89 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP) 90 { 91 if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP)) ) 92 continue; 93 94 95 if (static_cast<ControllableEntity*>(*itP) != (this)->getControllableEntity() 96 && CommonController::distance (*itP, this->getControllableEntity()) < 10000) 97 { 98 (this)->setAction(Action::FIGHT, *itP); 99 } 100 } 101 } 86 102 87 103 88 if (this->action_ == Action::FIGHT) 104 89 { 105 //----choose where to go---- 106 this->maneuver(); 107 //----fire if you can---- 108 this->bShooting_ = this->canFire(); 109 110 if (this->target_) 111 { 112 if (this->myWingman_) 113 { 114 //----wingmans shall support the fire of their leaders---- 115 this->myWingman_->setAction (Action::FIGHT, this->target_); 116 } 117 90 if (!this->hasTarget()) 91 { 92 //----find a target---- 93 this->setClosestTarget(); 94 } 95 else 96 { 118 97 //----fly in formation if far enough---- 119 98 Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition(); … … 121 100 { 122 101 this->setTargetPositionOfWingman(); 123 //this->setTargetPositionOfFollower(); 124 } 125 } 102 this->setTargetPositionOfFollower(); 103 } 104 else 105 { 106 //----wingmans shall support the fire of their leaders---- 107 if (this->myWingman_) 108 { 109 this->myWingman_->setAction (Action::FIGHT, this->target_); 110 } 111 if (this->myFollower_) 112 { 113 this->myFollower_->setAction (Action::FIGHT); 114 } 115 116 } 117 118 } 119 if (this->hasTarget()) 120 { 121 //----choose where to go---- 122 this->maneuver(); 123 //----fire if you can---- 124 this->bShooting_ = this->canFire(); 125 } 126 126 127 } 127 128 else if (this->action_ == Action::FLY) … … 152 153 case FormationMode::FINGER4: 153 154 { 154 targetRelativePositionOfWingman = new Vector3 (400, 0, -200);155 targetRelativePositionOfWingman = new Vector3 (400, 0, 200); 155 156 break; 156 157 } … … 158 159 case FormationMode::DIAMOND: 159 160 { 160 targetRelativePositionOfWingman = new Vector3 (400, 0, -200);161 targetRelativePositionOfWingman = new Vector3 (400, 0, 200); 161 162 break; 162 163 } … … 185 186 case FormationMode::FINGER4: 186 187 { 187 targetRelativePositionOfFollower = new Vector3 (-400, 0, -200);188 targetRelativePositionOfFollower = new Vector3 (-400, 0, 200); 188 189 break; 189 190 } … … 191 192 case FormationMode::DIAMOND: 192 193 { 193 targetRelativePositionOfFollower = new Vector3 (-400, 0, -200);194 targetRelativePositionOfFollower = new Vector3 (-400, 0, 200); 194 195 break; 195 196 }
Note: See TracChangeset
for help on using the changeset viewer.