Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Added maxShieldHealth

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

Legend:

Unmodified
Added
Removed
  • 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.