Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 4, 2011, 3:45:09 PM (14 years ago)
Author:
simonmie
Message:

Added initialShieldHealth and minor changes

Location:
code/branches/gameimmersion/src/orxonox/worldentities/pawns
Files:
2 edited

Legend:

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

    r8184 r8187  
    129129        XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
    130130        XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
     131
    131132        XMLPortParam(Pawn, "maxshieldhealth", setMaxShieldHealth, getMaxShieldHealth, xmlelement, mode).defaultValues(100);
     133        XMLPortParam(Pawn, "initialshieldhealth", setInitialShieldHealth, getInitialShieldHealth, xmlelement, mode).defaultValues(0);
    132134
    133135/////// end me
     
    227229    void Pawn::setHealth(float health)
    228230    {
    229         this->health_ = std::min(health, this->maxHealth_);
     231        this->health_ = std::min(health, this->maxHealth_); //Health can't be set to a value bigger than maxHealth, otherwise it will be reduced at first hit
    230232    }
    231233
  • code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h

    r8184 r8187  
    8080            inline float getMaxShieldHealth() const
    8181                { return this->maxShieldHealth_; }
     82
     83            inline void setInitialShieldHealth(float initialshieldhealth)
     84                { this->initialShieldHealth_ = initialshieldhealth; this->setShieldHealth(initialshieldhealth); }
     85            inline float getInitialShieldHealth() const
     86                { return this->initialShieldHealth_; }
     87
     88            inline void restoreInitialShieldHealth()
     89                { this->setShieldHealth(this->initialShieldHealth_); }
     90            inline void restoreMaxShieldHealth()
     91                { this->setShieldHealth(this->maxShieldHealth_); }
     92
    8293
    8394///////////////////////////////// end me
     
    186197
    187198            float maxShieldHealth_;
     199            float initialShieldHealth_;
    188200
    189201////////////////////////// end me
Note: See TracChangeset for help on using the changeset viewer.