Changeset 5871 in orxonox.OLD for branches/powerups/src/world_entities
- Timestamp:
- Dec 2, 2005, 3:00:24 PM (19 years ago)
- Location:
- branches/powerups/src/world_entities
- Files:
-
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/powerups/src/world_entities/extendable.h
r5849 r5871 4 4 */ 5 5 6 #ifndef _PROTO_CLASS_H 7 #define _PROTO_CLASS_H 8 9 #include "base_object.h" 6 #ifndef _EXTENDABLE_H 7 #define _EXTENDABLE_H 10 8 11 9 // FORWARD DECLARATION … … 14 12 15 13 //! A class for ... 16 class ProtoClass: public BaseObject {14 class Extendable : public BaseObject { 17 15 18 16 public: 19 ProtoClass();20 virtual ~ProtoClass();21 17 // Extendable(); 18 // virtual ~Extendable(); 19 virtual bool pickup(PowerUp* powerUp) { return false; } 22 20 23 21 private: … … 25 23 }; 26 24 27 #endif /* _ PROTO_CLASS_H */25 #endif /* _EXTENDABLE_H */ -
branches/powerups/src/world_entities/power_ups/power_up.cc
r5439 r5871 18 18 19 19 #include "power_up.h" 20 #include "extendable.h" 20 21 21 22 … … 24 25 25 26 26 PowerUp::PowerUp ( )27 PowerUp::PowerUp (PowerUpType type) 27 28 { 28 this->setClassID(CL_POWER_UP, "PowerUp"); 29 29 this->init(); 30 30 } 31 31 32 PowerUp::PowerUp(const TiXmlElement* root) 33 { 34 this->init(); 35 this->loadParams(root); 36 } 32 37 38 void PowerUp::init() { 39 this->setClassID(CL_POWER_UP, "PowerUp"); 40 this->type = type; 41 } 33 42 34 43 PowerUp::~PowerUp () {} 35 44 36 45 37 void PowerUp::loadParam (const TiXmlElement* root)46 void PowerUp::loadParams(const TiXmlElement* root) 38 47 { 39 48 static_cast<WorldEntity*>(this)->loadParams(root); 40 41 49 } 42 50 51 52 void PowerUp::collidesWith (WorldEntity* entity, const Vector& location) 53 { 54 if(entity->isA(CL_EXTENDABLE)) 55 { 56 if(dynamic_cast<Extendable*>(entity)->pickup(this)) 57 { 58 this->setVisibiliy(false); 59 } 60 } 61 } -
branches/powerups/src/world_entities/power_ups/power_up.h
r5434 r5871 9 9 #include "world_entity.h" 10 10 11 typedef enum PowerUpType 12 { 13 PWR_UP_NULL, 14 PWR_UP_SHIELD, 15 PWR_UP_WEAPON, 16 } PowerUpType; 17 11 18 class PowerUp : public WorldEntity { 12 19 13 public: 14 PowerUp (); 20 public: 21 PowerUp(PowerUpType type = PWR_UP_NULL); 22 PowerUp(const TiXmlElement* root); 15 23 virtual ~PowerUp (); 16 void loadParam(const TiXmlElement* root); 24 void loadParams(const TiXmlElement* root); 25 void collidesWith (WorldEntity* entity, const Vector& location); 26 27 private: 28 PowerUpType type; 29 void init(); 17 30 }; 18 31
Note: See TracChangeset
for help on using the changeset viewer.