Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 12, 2016, 4:03:47 PM (9 years ago)
Author:
sagerj
Message:

fix the charging during reloadtime, the hudchargebar working so far…

Location:
code/branches/sagerjFS16/src/orxonox/weaponsystem
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.cc

    r11175 r11185  
    6464        this->bParallelReload_ = true;
    6565        this->chargeable_ = false;
     66        this->charges_ = 0;
     67        this->maxCharges_ = 100;
    6668
    6769        this->reloadTimer_.setTimer(0.0f, false, createExecutor(createFunctor(&WeaponMode::reloaded, this)));
     
    172174    bool WeaponMode::push(float* reloadTime)
    173175    {
    174         orxout() << "push " << chargeable_ << endl;
     176
    175177        if( this->chargeable_)
    176178        {
    177             // setting up a timer for knowing how long the weapon was charged
    178             // and passes the value to this->cTime_
    179             orxout() << "if " << endl;
     179            if(this->charges_ < this->maxCharges_){
     180                this->charges_ += 1;
     181            }
    180182            return false;
    181183        } else {
    182             orxout() << "else " << endl;
    183184            return fire(reloadTime);
    184185        }
     
    187188    bool WeaponMode::release(float* reloadTime)
    188189    {
    189         orxout() << "release " << endl;
    190190        if( this->chargeable_)
    191191        {
    192             orxout() << "if " << endl;
    193192            return fire(reloadTime);
    194193        }else{
    195             orxout() << "else " << endl;
    196194            return false;
    197195        }
  • code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.h

    r11175 r11185  
    110110
    111111            // Fire
     112            inline unsigned int getMaxCharges()
     113                { return this->maxCharges_;}
     114            inline unsigned int getCharges()
     115                { return this->charges_;}
     116            inline bool isChargeable()
     117                { return this->chargeable_;}
    112118            inline void setDamage(float damage)
    113119                { this->damage_ = damage;}
     
    170176            unsigned int initialMagazines_;
    171177            unsigned int munitionPerShot_;
     178            unsigned int charges_;
     179            unsigned int maxCharges_;
    172180
    173181            float reloadTime_;
Note: See TracChangeset for help on using the changeset viewer.