| Line | |
|---|
| 1 | /*! |
|---|
| 2 | * @file power_up.h |
|---|
| 3 | * @brief A class representing a PowerUp in the world. |
|---|
| 4 | */ |
|---|
| 5 | |
|---|
| 6 | #ifndef _POWER_UP_H |
|---|
| 7 | #define _POWER_UP_H |
|---|
| 8 | |
|---|
| 9 | #include "world_entity.h" |
|---|
| 10 | |
|---|
| 11 | #include "sound_buffer.h" |
|---|
| 12 | #include "sound_source.h" |
|---|
| 13 | |
|---|
| 14 | class Material; |
|---|
| 15 | |
|---|
| 16 | typedef enum PowerUpRespawn { |
|---|
| 17 | RESPAWN_NONE, |
|---|
| 18 | RESPAWN_TIME, |
|---|
| 19 | RESPAWN_size |
|---|
| 20 | } PowerUpRespawn; |
|---|
| 21 | |
|---|
| 22 | class PowerUp : public WorldEntity { |
|---|
| 23 | |
|---|
| 24 | public: |
|---|
| 25 | virtual void loadParams(const TiXmlElement* root); |
|---|
| 26 | void collidesWith (WorldEntity* entity, const Vector& location); |
|---|
| 27 | |
|---|
| 28 | void loadPickupSound(const std::string& pickupSound); |
|---|
| 29 | void loadRespawnSound(const std::string& respawnSound); |
|---|
| 30 | |
|---|
| 31 | virtual void draw () const; |
|---|
| 32 | virtual void tick(float dt); |
|---|
| 33 | void setRespawnType(const std::string& type); |
|---|
| 34 | void setRespawnTime(const float respawn); |
|---|
| 35 | |
|---|
| 36 | int writeState(const byte* data, int length, int sender); |
|---|
| 37 | int readState(byte* data, int maxLength ); |
|---|
| 38 | |
|---|
| 39 | protected: |
|---|
| 40 | PowerUp(float r, float g, float b); |
|---|
| 41 | virtual ~PowerUp (); |
|---|
| 42 | |
|---|
| 43 | protected: |
|---|
| 44 | Model* model; |
|---|
| 45 | |
|---|
| 46 | private: |
|---|
| 47 | OrxSound::SoundSource soundSource; |
|---|
| 48 | OrxSound::SoundBuffer* pickupBuffer; |
|---|
| 49 | OrxSound::SoundBuffer* respawnBuffer; |
|---|
| 50 | Material* sphereMaterial; |
|---|
| 51 | PowerUpRespawn respawnType; |
|---|
| 52 | float respawnTime; |
|---|
| 53 | float respawnStart; |
|---|
| 54 | static const char* respawnTypes[]; |
|---|
| 55 | |
|---|
| 56 | WorldEntity* collider; |
|---|
| 57 | }; |
|---|
| 58 | |
|---|
| 59 | #endif /* _POWER_UP_H */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.