Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Added countdown time before shield reload starts

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

Legend:

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

    r8152 r8183  
    6868        this->shieldHealth_ = 0;
    6969        this->shieldAbsorption_ = 0.5;
     70////////////////////////me
     71        this->reloadRate_ = 0;
     72        this->reloadWaitTime_ = 1.0f;
     73        this->reloadWaitCountdown_ = 0;
     74////////////////////////end me
    7075
    7176        this->lastHitOriginator_ = 0;
     
    121126/////// me
    122127        XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
     128        XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
    123129
    124130/////// end me
     
    144150
    145151////////me
    146         this->addShieldHealth(this->getReloadRate() * dt);
     152        if(this->reloadWaitCountdown_ > 0)
     153        {
     154            this->decreaseReloadCountdownTime(dt);
     155        }
     156        else
     157        {
     158            this->addShieldHealth(this->getReloadRate() * dt);
     159            this->resetReloadCountdown();
     160        }
     161
    147162        // TODO max. shield hinzufuegen
    148163////////end me
     
    185200    }
    186201
     202    void Pawn::setReloadWaitTime(float reloadwaittime)
     203    {
     204        this->reloadWaitTime_ = reloadwaittime;
     205        COUT(2) << "RELOAD WAIT TIME SET TO " << this->reloadWaitTime_ << endl;
     206    }
     207
     208    void Pawn::decreaseReloadCountdownTime(float dt)
     209    {
     210        this->reloadWaitCountdown_ -= dt;
     211    }
     212
    187213
    188214///////////////end me
  • code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h

    r8152 r8183  
    6464            inline bool hasShield()
    6565            { return (this->getShieldHealth() > 0); }
     66
     67            virtual void setReloadWaitTime(float reloadwaittime);
     68            inline float getReloadWaitTime() const
     69                { return this->reloadWaitTime_; }
     70
     71            inline void resetReloadCountdown()
     72            { this->reloadWaitCountdown_ = 0; }
     73
     74            inline void startReloadCountdown()
     75            { this->reloadWaitCountdown_ = this->getReloadWaitTime(); } //in projectile.cc einbauen!!!!!!1111!!111!
     76
     77            virtual void decreaseReloadCountdownTime(float dt);
    6678
    6779///////////////////////////////// end me
     
    166178/////////////////////////// me
    167179            float reloadRate_;
     180            float reloadWaitTime_;
     181            float reloadWaitCountdown_;
    168182
    169183////////////////////////// end me
Note: See TracChangeset for help on using the changeset viewer.