Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4910 in orxonox.OLD for orxonox/trunk/src/world_entities/weapons


Ignore:
Timestamp:
Jul 20, 2005, 11:26:16 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: flush

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  
    102102  this->setStateDuration(WS_SHOOTING, .4);
    103103  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);
    106106
    107107  this->energy = 100;
  • orxonox/trunk/src/world_entities/weapons/weapon.cc

    r4906 r4910  
    266266    // setting up for next action
    267267    this->currentState = WS_ACTIVATING;
    268     this->stateDuration = this->times[WA_ACTIVATE] + this->stateDuration;
     268    this->stateDuration = this->times[WS_ACTIVATING] + this->stateDuration;
    269269  }
    270270  this->requestedAction = WA_NONE;
     
    290290        // setting up for next action
    291291    this->currentState = WS_DEACTIVATING;
    292     this->stateDuration = this->times[WA_DEACTIVATE] + this->stateDuration;
     292    this->stateDuration = this->times[WS_DEACTIVATING] + this->stateDuration;
    293293  }
    294294  this->requestedAction = WA_NONE;
     
    314314    this->requestedAction = WA_NONE;
    315315    this->currentState = WS_CHARGING;
    316     this->stateDuration = this->times[WA_CHARGE] + this->stateDuration;
     316    this->stateDuration = this->times[WS_CHARGING] + this->stateDuration;
    317317  }
    318318  else // deactivate the Weapon if we do not have enough energy
     
    342342    this->energyLoaded -= this->minCharge;
    343343          // setting up for the next state
    344     this->stateDuration = this->times[WA_SHOOT] + this->stateDuration;
     344    this->stateDuration = this->times[WS_SHOOTING] + this->stateDuration;
    345345    this->currentState = WS_SHOOTING;
    346346    this->requestedAction = WA_NONE;
     
    390390  this->requestedAction = WA_NONE;
    391391  this->currentState = WS_RELOADING;
    392   this->stateDuration = this->times[WA_RELOAD] + this->stateDuration;
     392  this->stateDuration = this->times[WS_RELOADING] + this->stateDuration;
    393393
    394394}
     
    400400void Weapon::tickW(float dt)
    401401{
     402  printf("%s ", stateToChar(this->currentState));
     403
    402404  // setting up the timing properties
    403405  this->stateDuration -= dt;
     
    407409    if (this->stateDuration <= 0.0)
    408410    {
    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
    410417        this->currentState = WS_IDLE;
    411       else
    412         this->currentState = WS_INACTIVE;
    413418
    414419      if (this->requestedAction != WA_NONE)
  • orxonox/trunk/src/world_entities/weapons/weapon.h

    r4906 r4910  
    157157
    158158  protected:
    159     SoundSource*         soundSource;                      //!< A SoundSource to play sound from (this is connected to the PNode of the Weapon)
    160159    // it is all about energy
    161160    float                energy;                           //!< The energy stored in the weapons secondary buffers (reserve)
     
    163162    float                energyMax;                        //!< The maximal energy that can be stored in the secondary buffers (reserveMax)
    164163    float                energyLoadedMax;                  //!< The maximal energy that can be stored in the primary buffers
     164    //! @todo move this to projectile
    165165    float                minCharge;                        //!< The minimal energy to be loaded onto one projectile if chargeable otherwise the power consumed by one projectile
    166166    float                maxCharge;                        //!< The maximal energy to be loaded onto one projectile (this is only availible if chargeable is enabled)
     
    170170    ////////////
    171171  private:
     172    SoundSource*         soundSource;                      //!< A SoundSource to play sound from (this is connected to the PNode of the Weapon)
     173
    172174    WeaponState          currentState;                     //!< The State the weapon is in.
    173175    WeaponAction         requestedAction;                  //!< An action to try to Engage after the currentState ends.
Note: See TracChangeset for help on using the changeset viewer.