Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 4, 2011, 2:53:53 PM (14 years ago)
Author:
simonmie
Message:

Added maxShieldHealth

Location:
code/branches/gameimmersion
Files:
3 edited

Legend:

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

    r8183 r8184  
    3636        angularDamping=         "0.7"
    3737
    38         health=                 100
     38        health=                 200
    3939        maxhealth=              150
    4040        inithealth=             100
     
    4242        shieldhealth=           200
    4343        shieldabsorption=       1
     44        maxshieldhealth=        250
    4445
    4546        reloadrate=             "10"
    46         reloadwaittime=         5
     47        reloadwaittime=         1
    4748
    4849>
  • code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc

    r8183 r8184  
    7272        this->reloadWaitTime_ = 1.0f;
    7373        this->reloadWaitCountdown_ = 0;
     74
     75        this->maxShieldHealth_ = 0;
    7476////////////////////////end me
    7577
     
    127129        XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
    128130        XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
     131        XMLPortParam(Pawn, "maxshieldhealth", setMaxShieldHealth, getMaxShieldHealth, xmlelement, mode).defaultValues(100);
    129132
    130133/////// end me
    131 
     134        //TODO: DEFINES fuer defaultwerte (hier und weiter oben dieselben)
    132135    }
    133136
     
    160163        }
    161164
    162         // TODO max. shield hinzufuegen
    163165////////end me
    164166        if (GameMode::isMaster())
     
    211213    }
    212214
     215    void Pawn::setMaxShieldHealth(float maxshieldhealth)
     216    {
     217        this->maxShieldHealth_ = maxshieldhealth;
     218    }
     219
     220    void Pawn::setShieldHealth(float shieldHealth)
     221    {
     222        this->shieldHealth_ = std::min(shieldHealth, this->maxShieldHealth_);
     223    }
    213224
    214225///////////////end me
     
    219230    }
    220231
     232//////////////////me edit
    221233    void Pawn::damage(float damage, Pawn* originator)
    222234    {
     
    249261        }
    250262    }
     263////////////////////end edit
    251264
    252265    void Pawn::hit(Pawn* originator, const Vector3& force, float damage)
  • code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h

    r8183 r8184  
    7676
    7777            virtual void decreaseReloadCountdownTime(float dt);
     78
     79            virtual void setMaxShieldHealth(float maxshieldhealth);
     80            inline float getMaxShieldHealth() const
     81                { return this->maxShieldHealth_; }
    7882
    7983///////////////////////////////// end me
     
    97101                { return this->initialHealth_; }
    98102
    99             inline void setShieldHealth(float shieldHealth)
    100             { this->shieldHealth_ = shieldHealth; }
     103            virtual void setShieldHealth(float shieldHealth);
     104
    101105            inline float getShieldHealth()
    102106            { return this->shieldHealth_; }
     
    181185            float reloadWaitCountdown_;
    182186
     187            float maxShieldHealth_;
     188
    183189////////////////////////// end me
    184190
Note: See TracChangeset for help on using the changeset viewer.