- Timestamp:
- Nov 15, 2015, 4:47:35 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc
r10803 r10805 51 51 DivisionController::~DivisionController() 52 52 { 53 54 53 } 55 54 … … 77 76 void DivisionController::action() 78 77 { 79 this->maneuver(); 80 this->bShooting_ = this->canFire(); 81 78 if (!this->target_) 79 { 80 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP) 81 { 82 if (this->getControllableEntity()->getTeam() == static_cast<ControllableEntity*>(*itP)->getTeam()) 83 continue; 84 85 86 if (static_cast<ControllableEntity*>(*itP) != (this)->getControllableEntity() && !(this)->hasTarget() 87 && ((*itP)->getWorldPosition() - (this)->getControllableEntity()->getWorldPosition()).length() < 10000) 88 { 89 (this)->setAction(Action::FIGHT, *itP); 90 } 91 } 92 } 93 94 if (this->action_ == Action::FIGHT) 95 { 96 this->maneuver(); 97 this->bShooting_ = this->canFire(); 98 if (this->target_) 99 { 100 if (this->myWingman_) 101 { 102 this->myWingman_->setAction (Action::FIGHT, this->target_); 103 } 104 105 Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition(); 106 if (diffVector.length() > 3000) 107 { 108 this->setTargetPositionOfWingman(); 109 //this->setTargetPositionOfFollower(); 110 } 111 } 112 } 113 else if (this->action_ == Action::FLY) 114 { 115 this->setTargetPositionOfWingman(); 116 this->setTargetPositionOfFollower(); 117 } 118 else if (this->action_ == Action::PROTECT) 119 { 120 121 } 82 122 83 123 } … … 116 156 (this->getControllableEntity()->getWorldOrientation()* (*targetRelativePositionOfWingman))); 117 157 118 myWingman_->setTargetOrientation(orient); 119 myWingman_->setTargetPosition(targetAbsolutePositionOfWingman); 158 myWingman_->setAction( Action::FLY, targetAbsolutePositionOfWingman, orient); 120 159 121 160 } … … 153 192 (this->getControllableEntity()->getWorldOrientation()* (*targetRelativePositionOfFollower))); 154 193 155 myFollower_->setTargetOrientation(orient); 156 myFollower_->setTargetPosition(targetAbsolutePositionOfFollower); 157 194 myFollower_->setAction ( Action::FLY, targetAbsolutePositionOfFollower, orient ); 158 195 } 159 196
Note: See TracChangeset
for help on using the changeset viewer.