Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

File:
1 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        }
Note: See TracChangeset for help on using the changeset viewer.