Changeset 10909 for code/branches/campaignHS15/src
- Timestamp:
- Dec 1, 2015, 10:03:10 AM (9 years ago)
- Location:
- code/branches/campaignHS15/src/orxonox/controllers
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
r10906 r10909 91 91 if (maneuverCounter_ > 6.0f) 92 92 maneuverCounter_ = 0; 93 this->timeOffset_ += dt; 94 if (this->timeOffset_ >= 2.0f) 95 this->timeOffset_ = 0.0f; 93 96 if (timeout_ <= 0) 94 97 this->bFiredRocket_ = false; … … 102 105 this->lookAtTarget(dt); 103 106 } 107 108 104 109 if (this->bShooting_) 105 110 { … … 117 122 if (this->bFirstTick_) 118 123 { 124 this->timeOffset_ = 0.0f; 125 this->bActionCalled_ = false; 119 126 setSpawners(); 120 127 // orxout(internal_error) << "health spawners size = " << this->healthSpawners_.size() << … … 123 130 this->bFirstTick_ = false; 124 131 } 125 if (this->hasTarget()) 126 { 132 133 //maneuver every 0.25 sec -> 134 float currentPeriodTime = this->timeOffset_ - static_cast<int>(this->timeOffset_); 135 if (this->hasTarget() && ((currentPeriodTime >= 0.25f && currentPeriodTime <= 0.5f) || (currentPeriodTime >= 0.75 && currentPeriodTime <= 0.999f)) && !this->bManeuverCalled_) 136 { 137 this->bManeuverCalled_ = true; 127 138 this->maneuver(); 128 if (static_cast<int>(this->maneuverCounter_*100) % 3 == 0) 129 this->bShooting_ = this->canFire(); 130 } 139 this->bShooting_ = this->canFire(); 140 } 141 if ((currentPeriodTime >= 0.0f && currentPeriodTime <= 0.25f) || (currentPeriodTime >= 0.5f && currentPeriodTime <= 0.75f)) 142 this->bManeuverCalled_ = false; 131 143 SUPER(ActionpointController, tick, dt); 132 144 } … … 137 149 if (!this->getControllableEntity() || !orxonox_cast<Pawn*> (this->getControllableEntity())) 138 150 return; 139 151 this->startAttackingEnemiesThatAreClose(); 140 152 141 153 this->deltaHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth() - this->previousHp; … … 546 558 return; 547 559 } 548 if (this->actionCounter_ % 3 == 0) 549 this->setTargetOrientation(this->getProtect()->getWorldOrientation()); 560 this->setTargetOrientation(this->getProtect()->getWorldOrientation()); 550 561 } 551 562 void ActionpointController::nextActionpoint() -
code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.h
r10898 r10909 236 236 std::multimap <int, std::pair<PickupSpawner*, bool> > speedSpawners_; 237 237 238 float timeOffset_; 239 bool bActionCalled_; 240 bool bManeuverCalled_; 241 238 242 private: 239 243 -
code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc
r10886 r10909 43 43 this->myFollower_ = 0; 44 44 this->myWingman_ = 0; 45 this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&DivisionController::action, this)));45 //this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&DivisionController::action, this))); 46 46 } 47 47 … … 68 68 return; 69 69 SUPER(DivisionController, tick, dt); 70 if (this->timeOffset_ >= 0.0f && this->timeOffset_ <= 0.5f && !this->bActionCalled_) 71 { 72 this->action(); 73 this->bActionCalled_ = true; 74 } 75 if (this->timeOffset_ > 1.0f) 76 { 77 this->bActionCalled_ = false; 78 } 79 80 70 81 } 71 82 void DivisionController::action() -
code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc
r10906 r10909 44 44 this->setFormationMode(FormationMode::FINGER4); 45 45 46 this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&SectionController::action, this)));46 //this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&SectionController::action, this))); 47 47 this->myWingman_ = 0; 48 48 this->myDivisionLeader_ = 0; … … 74 74 75 75 SUPER(SectionController, tick, dt); 76 if (this->timeOffset_ >= 0.5f && this->timeOffset_ <= 1.0f && !this->bActionCalled_) 77 { 78 this->action(); 79 this->bActionCalled_ = true; 80 } 81 if (this->timeOffset_ > 1.5f) 82 { 83 this->bActionCalled_ = false; 84 } 76 85 } 77 86 -
code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc
r10906 r10909 39 39 { 40 40 RegisterObject(WingmanController); 41 this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&WingmanController::action, this)));41 //this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&WingmanController::action, this))); 42 42 this->myLeader_ = 0; 43 43 this->bFirstAction_ = true; … … 68 68 69 69 SUPER(WingmanController, tick, dt); 70 if (this->timeOffset_ >= this->actionTime_ && this->timeOffset_ <= this->actionTime_ + 0.5f && !this->bActionCalled_) 71 { 72 this->action(); 73 this->bActionCalled_ = true; 74 } 75 if (this->timeOffset_ <= 0.5f) 76 { 77 this->bActionCalled_ = false; 78 } 70 79 } 71 80 … … 229 238 if (closestLeader->setWingman(orxonox_cast<ActionpointController*>(this))) 230 239 { 240 if (closestLeader->getIdentifier()->getName() == "SectionController") 241 { 242 this->actionTime_ = 1.0f; 243 } 244 else 245 { 246 this->actionTime_ = 1.5f; 247 } 231 248 return closestLeader; 232 249 } -
code/branches/campaignHS15/src/orxonox/controllers/WingmanController.h
r10886 r10909 70 70 Timer actionTimer_; //<! Regularly calls action(). 71 71 bool bFirstAction_; 72 72 float actionTime_; 73 73 }; 74 74 }
Note: See TracChangeset
for help on using the changeset viewer.