Changeset 10925
- Timestamp:
- Dec 7, 2015, 9:41:38 AM (9 years ago)
- Location:
- code/branches/campaignHS15
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/data/levels/AITest.oxw
r10923 r10925 92 92 <!-- HERE STARTS DEMO FOR THE ACTIONPOINTS. 93 93 P.S. Never set protectMe in the first actionpoint: if human didn't spawn, that actionpoint will be skipped --> 94 94 <!-- 95 95 <Model mesh="cube.mesh" scale=8 position="0,0,0" /> 96 96 … … 153 153 </templates> 154 154 </SpaceShip> 155 155 --> 156 156 157 157 <!-- HERE ENDS DEMO FOR THE ACTIONPOINTS --> 158 158 <!-- HERE STARTS DEMO FOR FIGHTING --> 159 <!--159 160 160 161 161 <SpaceShip position="-4000, 1500, -1000" lookat="0,0,0" team=0 name="d1sd1"> … … 202 202 </templates> 203 203 <controller> 204 <DivisionController team=1 formationMode=" WALL">204 <DivisionController team=1 formationMode="DIAMOND"> 205 205 206 206 </DivisionController> … … 234 234 </controller> 235 235 </SpaceShip> 236 --> 236 237 237 <!-- HERE ENDS DEMO FOR FIGHTING --> 238 238 <!-- HERE STARTS DEMO FOR FORMATIONS --> -
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(); -
code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc
r10923 r10925 211 211 hardcoded_projectile_speed, this->target_->getWorldPosition(), 212 212 this->target_->getVelocity()); 213 if (!this->target_ || !this->getControllableEntity()) 214 return false; 213 215 //Vector3.isNaN() is what I used on my machine and it worked... 214 216 if (!(std::isnan(newPositionOfTarget.x) || std::isnan(newPositionOfTarget.y) || std::isnan(newPositionOfTarget.z))) -
code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc
r10923 r10925 95 95 { 96 96 ActionpointController* newDivisionLeader = findNewDivisionLeader(); 97 if (!this || !this->getControllableEntity()) 98 return; 99 97 100 this->myDivisionLeader_ = newDivisionLeader; 98 101 //spread copyOrientation called equally among the division … … 128 131 else if (!this->myDivisionLeader_->bKeepFormation_) 129 132 { 133 if (!this || !this->getControllableEntity()) 134 return; 135 130 136 if (!this->hasTarget()) 131 137 { -
code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc
r10923 r10925 120 120 { 121 121 ActionpointController* newLeader = (findNewLeader()); 122 if (!this || !this->getControllableEntity()) 123 return; 124 122 125 this->myLeader_ = newLeader; 123 126 if (this->myLeader_) … … 147 150 else if (!this->myLeader_->bKeepFormation_) 148 151 { 152 if (!this || !this->getControllableEntity()) 153 return; 154 149 155 if (!this->hasTarget()) 150 156 { … … 175 181 Vector3 WingmanController::getFormationPosition () 176 182 { 183 184 177 185 this->setFormationMode( this->myLeader_->getFormationMode() ); 178 186 Vector3* targetRelativePosition;
Note: See TracChangeset
for help on using the changeset viewer.