Changeset 10927 for code/branches/campaignHS15
- Timestamp:
- Dec 7, 2015, 1:56:45 PM (9 years ago)
- Location:
- code/branches/campaignHS15/src/orxonox/controllers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
r10925 r10927 42 42 this->ticks_ = 0; 43 43 this->bPatrolling_ = false; 44 this->maneuverCounter_ = 0;45 44 this->bInLoop_ = false; 46 45 this->bLoop_ = false; … … 55 54 this->bFirstTick_ = true; 56 55 this->bStartedDodging_ = false; 57 this->timeDodged_ = 0;58 56 this->bDefaultPatrol_ = true; 59 57 this->bDefaultFightAll_ = true; … … 100 98 void ActionpointController::tick(float dt) 101 99 { 102 if (!this || !this->getControllableEntity() )100 if (!this || !this->getControllableEntity() || !this->isActive()) 103 101 return; 104 102 ++this->ticks_; … … 113 111 return; 114 112 115 if ( this->ticks_ == 1)113 if (ActionpointController::sTicks_ == 1) 116 114 { 117 115 … … 124 122 } 125 123 } 126 if ( this->ticks_ == 1)124 if (ActionpointController::sTicks_ == 1) 127 125 { 128 126 this->timeOffset_ = 0.0f; … … 167 165 this->timeout_ -= dt; 168 166 } 169 if (this->bStartedDodging_) 170 { 171 this->timeDodged_ += dt; 172 } 173 maneuverCounter_ += dt; 167 174 168 175 169 if (!this || !this->getControllableEntity()) … … 177 171 //maneuver every 0.25 sec -> 178 172 int step = 4; 173 if (ActionpointController::sTicks_ % 100 <= 10) 174 { 175 this->bDodge_ = false; 176 } 177 else 178 { 179 this->bDodge_ = true; 180 } 179 181 if (ActionpointController::sTicks_ % 100 == step * this->actionpointControllerId_ + 1) 180 182 { … … 189 191 if (this->hasTarget() && ActionpointController::sTicks_ % (ActionpointController::nextActionpointControllerId_ + 1) == (this->actionpointControllerId_)) 190 192 { 191 if (maneuverCounter_ > 6.0f) 192 this->maneuverCounter_ = 0; 193 if (this->bStartedDodging_ && this->timeDodged_ > 4.0f) 194 { 195 this->bStartedDodging_ = false; 196 this->timeDodged_ = 0; 197 } 193 194 198 195 if (!this || !this->getControllableEntity()) 199 196 return; -
code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc
r10925 r10927 150 150 return; 151 151 // if (this->actionCounter_ % 3 == 0) 152 if ( maneuverCounter_ <= 1.2)152 if (!this->bDodge_) 153 153 { 154 154 // orxout(internal_error) << "attacking" << endl; 155 this->bStartedDodging_ = false; 156 155 157 this->setTargetPosition(this->positionOfTarget_ - diffUnit * 50.0f); 156 158 return; -
code/branches/campaignHS15/src/orxonox/controllers/FightingController.h
r10906 r10927 82 82 Pawn* closestTarget() const; 83 83 84 bool bDodge_; 84 85 int attackRange_; 85 86 bool bShooting_; 86 float maneuverCounter_;87 87 bool bLookAtTarget_; 88 88 float deltaHp; 89 89 float previousHp; 90 90 bool bStartedDodging_; 91 float timeDodged_;92 91 //WEAPONSYSTEM DATA 93 92 int rocketsLeft_;
Note: See TracChangeset
for help on using the changeset viewer.