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
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gameimmersion/data/levels/test-immersion-shield-01.oxw

    r8184 r8187  
    3636        angularDamping=         "0.7"
    3737
    38         health=                 200
     38        health=                 100
    3939        maxhealth=              150
    40         inithealth=             100
     40        inithealth=             200
    4141
    42         shieldhealth=           200
     42        shieldhealth=           100
     43        initialshieldhealth=    200
     44        maxshieldhealth=        250
     45
    4346        shieldabsorption=       1
    44         maxshieldhealth=        250
    4547
    4648        reloadrate=             "10"
  • 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.