- Timestamp:
- Dec 7, 2015, 9:41:38 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
r10924 r10925 110 110 } 111 111 112 if (!this || !this->getControllableEntity()) 113 return; 114 112 115 if (this->ticks_ == 1) 113 116 { … … 143 146 this->lookAtTarget(dt); 144 147 } 145 if (this->bShooting_) 146 { 147 this->doFire(); 148 } 148 149 149 150 150 if (!this || !this->getControllableEntity()) … … 159 159 if (timeout_ <= 0) 160 160 this->bFiredRocket_ = false; 161 if (!this || !this->getControllableEntity()) 162 return; 161 163 162 164 163 if (!this || !this->getControllableEntity()) 165 164 return; 166 165 if (this->timeout_ > 0 && this->bFiredRocket_) 167 { 168 this->timeout_ -= dt; 169 } 170 if (this->bStartedDodging_) 171 { 172 this->timeDodged_ += dt; 173 } 174 maneuverCounter_ += dt; 166 { 167 this->timeout_ -= dt; 168 } 169 if (this->bStartedDodging_) 170 { 171 this->timeDodged_ += dt; 172 } 173 maneuverCounter_ += dt; 174 175 175 if (!this || !this->getControllableEntity()) 176 176 return; 177 177 //maneuver every 0.25 sec -> 178 178 int step = 4; 179 if (this->hasTarget() && ActionpointController::sTicks_ % 100 == step * (this->actionpointControllerId_))180 {181 182 }183 179 if (ActionpointController::sTicks_ % 100 == step * this->actionpointControllerId_ + 1) 184 180 { 181 //orxout (internal_error) << "Team " << this->getControllableEntity()->getTeam() << (this->hasTarget() ? ", got " : ", don't have") << " target" << endl; 185 182 this->action(); 186 183 } 187 if (!this || !this->getControllableEntity()) 188 return; 189 190 191 if (this->hasTarget() && ActionpointController::sTicks_ % ActionpointController::nextActionpointControllerId_ == (this->actionpointControllerId_)) 184 185 186 if (!this || !this->getControllableEntity()) 187 return; 188 189 if (this->hasTarget() && ActionpointController::sTicks_ % (ActionpointController::nextActionpointControllerId_ + 1) == (this->actionpointControllerId_)) 192 190 { 193 191 if (maneuverCounter_ > 6.0f) 194 maneuverCounter_ = 0;192 this->maneuverCounter_ = 0; 195 193 if (this->bStartedDodging_ && this->timeDodged_ > 4.0f) 196 194 { … … 199 197 } 200 198 if (!this || !this->getControllableEntity()) 201 return;199 return; 202 200 this->maneuver(); 203 201 if (!this || !this->getControllableEntity()) 204 return;202 return; 205 203 this->bShooting_ = this->canFire(); 206 } 207 if (!this || !this->getControllableEntity()) 208 return; 204 205 if (!this || !this->getControllableEntity()) 206 return; 207 208 if (this->bShooting_) 209 { 210 this->doFire(); 211 } 212 this->deltaHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth() - this->previousHp; 213 this->previousHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth(); 214 } 209 215 210 216 … … 227 233 return; 228 234 229 this->deltaHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth() - this->previousHp; 230 this->previousHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth(); 235 231 236 if (!this || !this->getControllableEntity()) 232 237 return; … … 514 519 } 515 520 this->setAction (p.action); 521 if (!this || !this->getControllableEntity()) 522 return; 523 516 524 switch (this->action_) 517 525 { … … 654 662 void ActionpointController::moveBackToTop() 655 663 { 664 if (!this || !this->getControllableEntity()) 665 return; 666 656 667 Point temp = loopActionpoints_.back(); 657 668 loopActionpoints_.pop_back();
Note: See TracChangeset
for help on using the changeset viewer.