- Timestamp:
- Nov 15, 2015, 4:47:35 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc
r10789 r10805 111 111 void WingmanController::tick(float dt) 112 112 { 113 114 115 113 if (!this->isActive()) 116 114 return; 117 if (!this->target_)118 {119 //stay in formation120 }121 else122 {123 124 }125 115 if (this->bHasTargetPosition_) 126 116 { 127 117 this->moveToTargetPosition(dt); 128 } 129 130 if (this->bShooting_) 131 doFire(); 118 } 119 else if (this->bLookAtTarget_) 120 { 121 this->lookAtTarget(dt); 122 } 123 if (bShooting_) 124 { 125 this->doFire(); 126 } 132 127 133 128 SUPER(WingmanController, tick, dt); … … 144 139 else 145 140 { 146 //orxout(internal_error) << "0 leader" << endl; 147 141 if (!this->target_){ 142 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP) 143 { 144 if (this->getControllableEntity()->getTeam() == static_cast<ControllableEntity*>(*itP)->getTeam()) 145 continue; 146 this->setAction(Action::FIGHT, (*itP)); 147 break; 148 } 149 } 148 150 } 149 151 … … 153 155 154 156 } 155 if (canFire()) 156 this->bShooting_ = true; 157 else 158 this->bShooting_ = false; 157 158 if (this->action_ == Action::FIGHT) 159 { 160 this->maneuver(); 161 this->bShooting_ = this->canFire(); 162 if (this->target_) 163 { 164 Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition(); 165 if (diffVector.length() > 5000) 166 { 167 168 } 169 } 170 } 171 else if (this->action_ == Action::FLY) 172 { 173 174 } 175 else if (this->action_ == Action::PROTECT) 176 { 177 178 } 159 179 160 180 }
Note: See TracChangeset
for help on using the changeset viewer.