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.

Location:
code/branches/fabienHS15/src/orxonox/worldentities/pawns
Files:
2 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
  • code/branches/fabienHS15/src/orxonox/worldentities/pawns/Pawn.h

    r10692 r10739  
    116116                { return this->shieldAbsorption_; }
    117117
    118             // TODO: Rename to shieldRechargeRate
    119             virtual void setReloadRate(float reloadrate);
    120             inline float getReloadRate() const
    121                 { return this->reloadRate_; }
    122 
    123             virtual void setReloadWaitTime(float reloadwaittime);
    124             inline float getReloadWaitTime() const
    125                 { return this->reloadWaitTime_; }
    126 
    127             inline void resetReloadCountdown()
    128                 { this->reloadWaitCountdown_ = 0; }
    129 
    130             inline void startReloadCountdown()
    131                 { this->reloadWaitCountdown_ = this->getReloadWaitTime(); } // TODO: Implement in Projectile.cc
    132 
    133             virtual void decreaseReloadCountdownTime(float dt);
     118            virtual void setShieldRechargeRate(float shieldRechargeRate);
     119            inline float getShieldRechargeRate() const
     120                { return this->shieldRechargeRate_; }
     121
     122            virtual void setShieldRechargeWaitTime(float shieldRechargeWaitTime);
     123            inline float getShieldRechargeWaitTime() const
     124                { return this->shieldRechargeWaitTime_; }
     125
     126            inline void resetShieldRechargeCountdown()
     127                { this->shieldRechargeWaitCountdown_ = 0; }
     128
     129            inline void startShieldRechargeCountdown()
     130                { this->shieldRechargeWaitCountdown_ = this->getShieldRechargeWaitTime(); } // TODO: Implement in Projectile.cc
     131
     132            virtual void decreaseShieldRechargeCountdownTime(float dt);
    134133
    135134            inline ControllableEntity* getLastHitOriginator() const
    136135                { return this->lastHitOriginator_; }
    137136
    138             //virtual void hit(Pawn* originator, const Vector3& force, float damage);
    139             //virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
    140137            virtual void hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
    141138            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
     
    210207            virtual void spawneffect();
    211208
    212             //virtual void damage(float damage, Pawn* originator = 0);
    213209            virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
    214210
     
    229225            float initialShieldHealth_;
    230226            float shieldAbsorption_; ///< Has to be between 0 and 1
    231             float reloadRate_;
    232             float reloadWaitTime_;
    233             float reloadWaitCountdown_;
     227            float shieldRechargeRate_;
     228            float shieldRechargeWaitTime_;
     229            float shieldRechargeWaitCountdown_;
    234230
    235231            float damageMultiplier_; ///< Used by the Damage Boost Pickup.
     
    238234
    239235            WeaponSystem* weaponSystem_;
    240             bool bReload_;
     236            bool bShieldRecharging_;
    241237
    242238            std::string spawnparticlesource_;
Note: See TracChangeset for help on using the changeset viewer.