Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8145


Ignore:
Timestamp:
Mar 28, 2011, 3:55:04 PM (14 years ago)
Author:
simonmie
Message:

First try of self-reloading shield

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

Legend:

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

    r7889 r8145  
    118118        XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode);
    119119        XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPackXML, getWeaponPack, xmlelement, mode);
     120
     121/////// me
     122        XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
     123
     124/////// end me
     125
    120126    }
    121127
     
    137143        this->bReload_ = false;
    138144
     145////////me
     146        this->addShieldHealth(this->getReloadRate() * dt);
     147////////end me
    139148        if (GameMode::isMaster())
    140149            if (this->health_ <= 0 && bAlive_)
    141150            {
    142                 this->fireEvent(); // Event to notify anyone who want's to know about the death.
     151                this->fireEvent(); // Event to notify anyone who wants to know about the death.
    143152                this->death();
    144153            }
     
    167176        ControllableEntity::removePlayer();
    168177    }
     178
     179//////////////////me
     180    void Pawn::setReloadRate(float reloadrate)
     181    {
     182        this->reloadRate_ = reloadrate;
     183        COUT(2) << "RELOAD RATE SET TO " << this->reloadRate_ << endl;
     184    }
     185
     186
     187///////////////end me
    169188
    170189    void Pawn::setHealth(float health)
     
    186205                healthdamage += shielddamage-this->getShieldHealth();
    187206                this->setShieldHealth(0);
     207                COUT(3) << "### SHIELD KAPUTT ###" << endl;
    188208            }
     209
     210            else { COUT(3) << "## SHIELD : " << this->getShieldHealth() << endl; }
    189211
    190212            this->setHealth(this->health_ - healthdamage);
  • code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h

    r7889 r8145  
    5353            inline bool isAlive() const
    5454                { return this->bAlive_; }
     55
     56///////////////////////////////// me
     57            virtual void setReloadRate(float reloadrate);
     58            inline float getReloadRate() const
     59                { return this->reloadRate_; }
     60
     61            inline void addShieldHealth(float amount)
     62            { this->setShieldHealth(this->shieldHealth_ + amount); }
     63
     64///////////////////////////////// end me
    5565
    5666            virtual void setHealth(float health);
     
    151161                { return NULL; }
    152162
     163/////////////////////////// me
     164            float reloadRate_;
     165
     166////////////////////////// end me
     167
    153168            float health_;
    154169            float maxHealth_;
Note: See TracChangeset for help on using the changeset viewer.