Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 9, 2009, 3:21:12 AM (16 years ago)
Author:
landauf
Message:

added TeamGametype

Location:
code/branches/miniprojects/src/orxonox/objects/worldentities
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/miniprojects/src/orxonox/objects/worldentities/Billboard.h

    r2662 r2768  
    3434#include "util/Math.h"
    3535#include "tools/BillboardSet.h"
     36#include "objects/Teamcolourable.h"
    3637
    3738namespace orxonox
    3839{
    39     class _OrxonoxExport Billboard : public StaticEntity
     40    class _OrxonoxExport Billboard : public StaticEntity, public Teamcolourable
    4041    {
    4142        public:
     
    6162                { return this->colour_; }
    6263
     64            virtual void setTeamColour(const ColourValue& colour)
     65                { this->setColour(colour); }
     66
    6367        protected:
    6468            inline BillboardSet& getBillboardSet()
  • code/branches/miniprojects/src/orxonox/objects/worldentities/CMakeLists.txt

    r2710 r2768  
    1919  Planet.cc
    2020  SpawnPoint.cc
     21  TeamSpawnPoint.cc
    2122)
    2223
  • code/branches/miniprojects/src/orxonox/objects/worldentities/Light.h

    r2662 r2768  
    3737
    3838#include "util/Math.h"
     39#include "objects/Teamcolourable.h"
    3940
    4041namespace orxonox
    4142{
    42     class _OrxonoxExport Light : public StaticEntity
     43    class _OrxonoxExport Light : public StaticEntity, public Teamcolourable
    4344    {
    4445        public:
     
    6869            inline const ColourValue& getSpecularColour() const
    6970                { return this->specular_; }
     71
     72            virtual void setTeamColour(const ColourValue& colour)
     73                { this->setDiffuseColour(colour); this->setSpecularColour(colour); }
    7074
    7175            /**
  • code/branches/miniprojects/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r2662 r2768  
    140140    void Pawn::damage(float damage, Pawn* originator)
    141141    {
    142         this->setHealth(this->health_ - damage);
    143         this->lastHitOriginator_ = originator;
    144 
    145         // play damage effect
     142        if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
     143        {
     144            this->setHealth(this->health_ - damage);
     145            this->lastHitOriginator_ = originator;
     146
     147            // play damage effect
     148        }
    146149    }
    147150
    148151    void Pawn::hit(Pawn* originator, const Vector3& force, float damage)
    149152    {
    150         this->damage(damage, originator);
    151         this->setVelocity(this->getVelocity() + force);
    152 
    153         // play hit effect
     153        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator))
     154        {
     155            this->damage(damage, originator);
     156            this->setVelocity(this->getVelocity() + force);
     157
     158            // play hit effect
     159        }
    154160    }
    155161
     
    176182    void Pawn::death()
    177183    {
    178         // Set bAlive_ to false and wait for PawnManager to do the destruction
    179         this->bAlive_ = false;
    180 
    181         this->setDestroyWhenPlayerLeft(false);
    182 
    183         if (this->getGametype())
    184             this->getGametype()->pawnKilled(this, this->lastHitOriginator_);
    185 
    186         if (this->getPlayer())
    187             this->getPlayer()->stopControl(this);
    188 
    189         if (Core::isMaster())
    190             this->deatheffect();
     184        if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
     185        {
     186            // Set bAlive_ to false and wait for PawnManager to do the destruction
     187            this->bAlive_ = false;
     188
     189            this->setDestroyWhenPlayerLeft(false);
     190
     191            if (this->getGametype())
     192                this->getGametype()->pawnKilled(this, this->lastHitOriginator_);
     193
     194            if (this->getPlayer())
     195                this->getPlayer()->stopControl(this);
     196
     197            if (Core::isMaster())
     198                this->deatheffect();
     199        }
     200        else
     201            this->setHealth(1);
    191202    }
    192203
Note: See TracChangeset for help on using the changeset viewer.