Changeset 4910 in orxonox.OLD for orxonox/trunk/src/world_entities/weapons
- Timestamp:
- Jul 20, 2005, 11:26:16 PM (19 years ago)
- Location:
- orxonox/trunk/src/world_entities/weapons
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/weapons/test_gun.cc
r4906 r4910 102 102 this->setStateDuration(WS_SHOOTING, .4); 103 103 this->setStateDuration(WS_RELOADING, 1); 104 //this->setStateDuration(WS_ACTIVATING, .4);105 //this->setStateDuration(WS_DEACTIVATING, .4);104 this->setStateDuration(WS_ACTIVATING, .4); 105 this->setStateDuration(WS_DEACTIVATING, .4); 106 106 107 107 this->energy = 100; -
orxonox/trunk/src/world_entities/weapons/weapon.cc
r4906 r4910 266 266 // setting up for next action 267 267 this->currentState = WS_ACTIVATING; 268 this->stateDuration = this->times[W A_ACTIVATE] + this->stateDuration;268 this->stateDuration = this->times[WS_ACTIVATING] + this->stateDuration; 269 269 } 270 270 this->requestedAction = WA_NONE; … … 290 290 // setting up for next action 291 291 this->currentState = WS_DEACTIVATING; 292 this->stateDuration = this->times[W A_DEACTIVATE] + this->stateDuration;292 this->stateDuration = this->times[WS_DEACTIVATING] + this->stateDuration; 293 293 } 294 294 this->requestedAction = WA_NONE; … … 314 314 this->requestedAction = WA_NONE; 315 315 this->currentState = WS_CHARGING; 316 this->stateDuration = this->times[W A_CHARGE] + this->stateDuration;316 this->stateDuration = this->times[WS_CHARGING] + this->stateDuration; 317 317 } 318 318 else // deactivate the Weapon if we do not have enough energy … … 342 342 this->energyLoaded -= this->minCharge; 343 343 // setting up for the next state 344 this->stateDuration = this->times[W A_SHOOT] + this->stateDuration;344 this->stateDuration = this->times[WS_SHOOTING] + this->stateDuration; 345 345 this->currentState = WS_SHOOTING; 346 346 this->requestedAction = WA_NONE; … … 390 390 this->requestedAction = WA_NONE; 391 391 this->currentState = WS_RELOADING; 392 this->stateDuration = this->times[W A_RELOAD] + this->stateDuration;392 this->stateDuration = this->times[WS_RELOADING] + this->stateDuration; 393 393 394 394 } … … 400 400 void Weapon::tickW(float dt) 401 401 { 402 printf("%s ", stateToChar(this->currentState)); 403 402 404 // setting up the timing properties 403 405 this->stateDuration -= dt; … … 407 409 if (this->stateDuration <= 0.0) 408 410 { 409 if (unlikely (this->currentState != WS_DEACTIVATING)) 411 if (unlikely (this->currentState == WS_DEACTIVATING)) 412 { 413 this->currentState = WS_INACTIVE; 414 return; 415 } 416 else 410 417 this->currentState = WS_IDLE; 411 else412 this->currentState = WS_INACTIVE;413 418 414 419 if (this->requestedAction != WA_NONE) -
orxonox/trunk/src/world_entities/weapons/weapon.h
r4906 r4910 157 157 158 158 protected: 159 SoundSource* soundSource; //!< A SoundSource to play sound from (this is connected to the PNode of the Weapon)160 159 // it is all about energy 161 160 float energy; //!< The energy stored in the weapons secondary buffers (reserve) … … 163 162 float energyMax; //!< The maximal energy that can be stored in the secondary buffers (reserveMax) 164 163 float energyLoadedMax; //!< The maximal energy that can be stored in the primary buffers 164 //! @todo move this to projectile 165 165 float minCharge; //!< The minimal energy to be loaded onto one projectile if chargeable otherwise the power consumed by one projectile 166 166 float maxCharge; //!< The maximal energy to be loaded onto one projectile (this is only availible if chargeable is enabled) … … 170 170 //////////// 171 171 private: 172 SoundSource* soundSource; //!< A SoundSource to play sound from (this is connected to the PNode of the Weapon) 173 172 174 WeaponState currentState; //!< The State the weapon is in. 173 175 WeaponAction requestedAction; //!< An action to try to Engage after the currentState ends.
Note: See TracChangeset
for help on using the changeset viewer.