Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 1, 2015, 1:05:54 PM (9 years ago)
Author:
fvultier
Message:

HUD improved. Corrected text rescaling. Renamed reload to shieldRecharge in Pawn.cc, … to avoid confusion with the weapon system.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.cc

    r10692 r10739  
    6161
    6262        this->bAlive_ = true;
    63         this->bReload_ = false;
     63        this->bShieldRecharging_ = false;
    6464
    6565        this->health_ = 0;
     
    7272        this->shieldAbsorption_ = 0.5;
    7373
    74         this->reloadRate_ = 0;
    75         this->reloadWaitTime_ = 1.0f;
    76         this->reloadWaitCountdown_ = 0;
     74        this->shieldRechargeRate_ = 0;
     75        this->shieldRechargeWaitTime_ = 1.0f;
     76        this->shieldRechargeWaitCountdown_ = 0;
    7777
    7878        this->lastHitOriginator_ = 0;
     
    143143        XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPackXML, getWeaponPack, xmlelement, mode);
    144144
    145         XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
    146         XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
     145        XMLPortParam(Pawn, "reloadrate", setShieldRechargeRate, getShieldRechargeRate, xmlelement, mode).defaultValues(0);
     146        XMLPortParam(Pawn, "reloadwaittime", setShieldRechargeWaitTime, getShieldRechargeWaitTime, xmlelement, mode).defaultValues(1.0f);
    147147
    148148        XMLPortParam(Pawn, "explosionSound",  setExplosionSound,  getExplosionSound,  xmlelement, mode);
     
    159159        registerVariable(this->maxShieldHealth_,  VariableDirection::ToClient);
    160160        registerVariable(this->shieldAbsorption_, VariableDirection::ToClient);
    161         registerVariable(this->bReload_,          VariableDirection::ToServer);
     161        registerVariable(this->bShieldRecharging_,          VariableDirection::ToServer);
    162162        registerVariable(this->aimPosition_,      VariableDirection::ToServer);  // For the moment this variable gets only transfered to the server
    163163    }
     
    167167        SUPER(Pawn, tick, dt);
    168168
    169         this->bReload_ = false;
     169        this->bShieldRecharging_ = false;
    170170
    171171        // TODO: use the existing timer functions instead
    172         if(this->reloadWaitCountdown_ > 0)
    173         {
    174             this->decreaseReloadCountdownTime(dt);
    175         }
    176         else
    177         {
    178             this->addShieldHealth(this->getReloadRate() * dt);
    179             this->resetReloadCountdown();
     172        if(this->shieldRechargeWaitCountdown_ > 0)
     173        {
     174            this->decreaseShieldRechargeCountdownTime(dt);
     175        }
     176        else
     177        {
     178            this->addShieldHealth(this->getShieldRechargeRate() * dt);
     179            this->resetShieldRechargeCountdown();
    180180        }
    181181
     
    229229    }
    230230
    231     void Pawn::setReloadRate(float reloadrate)
    232     {
    233         this->reloadRate_ = reloadrate;
    234     }
    235 
    236     void Pawn::setReloadWaitTime(float reloadwaittime)
    237     {
    238         this->reloadWaitTime_ = reloadwaittime;
    239     }
    240 
    241     void Pawn::decreaseReloadCountdownTime(float dt)
    242     {
    243         this->reloadWaitCountdown_ -= dt;
     231    void Pawn::setShieldRechargeRate(float shieldRechargeRate)
     232    {
     233        this->shieldRechargeRate_ = shieldRechargeRate;
     234    }
     235
     236    void Pawn::setShieldRechargeWaitTime(float shieldRechargeWaitTime)
     237    {
     238        this->shieldRechargeWaitTime_ = shieldRechargeWaitTime;
     239    }
     240
     241    void Pawn::decreaseShieldRechargeCountdownTime(float dt)
     242    {
     243        this->shieldRechargeWaitCountdown_ -= dt;
    244244    }
    245245
     
    482482    void Pawn::reload()
    483483    {
    484         this->bReload_ = true;
     484        this->bShieldRecharging_ = true;
    485485    }
    486486
Note: See TracChangeset for help on using the changeset viewer.