Changeset 2065 for code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleSpawner.h
- Timestamp:
- Oct 30, 2008, 2:44:48 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleSpawner.h
r2044 r2065 32 32 #include "OrxonoxPrereqs.h" 33 33 34 #include "P ositionableEntity.h"34 #include "ParticleEmitter.h" 35 35 #include "tools/Timer.h" 36 36 37 37 namespace orxonox 38 38 { 39 class _OrxonoxExport ParticleSpawner : public P ositionableEntity39 class _OrxonoxExport ParticleSpawner : public ParticleEmitter 40 40 { 41 41 public: 42 ParticleSpawner(); 43 ParticleSpawner(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime = 0, float startdelay = 0, float destroydelay = 0, const Vector3& direction = Vector3::ZERO); 42 ParticleSpawner(BaseObject* creator); 44 43 virtual ~ParticleSpawner(); 45 void destroy();46 44 47 void setParticle(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime = 0, float startdelay = 0, float destroydelay = 0, const Vector3& direction = Vector3::ZERO); 48 inline ParticleInterface* getParticleInterface() const 49 { return this->particle_; } 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 46 virtual void processEvent(Event& event); 50 47 51 void setVisible(bool visible); 48 inline void destroy() 49 { this->bForceDestroy_ = true; this->stopParticleSpawner(); } 50 inline void spawn() 51 { this->bSuppressStart_ = false; this->startParticleSpawner(); } 52 53 void configure(float lifetime = 0, float startdelay = 0, float destroydelay = 0, bool autodestroy = true); 54 55 inline void setAutoStart(bool autostart) 56 { this->bAutostart_ = autostart; this->bSuppressStart_ = !autostart; } 57 inline bool getAutoStart() const 58 { return this->bAutostart_; } 59 60 inline void setDestroyAfterLife(bool destroy) 61 { this->bAutoDestroy_ = destroy; } 62 inline bool getDestroyAfterLife() const 63 { return this->bAutoDestroy_; } 64 65 inline void setLoop(bool loop) 66 { this->bLoop_ = loop; } 67 inline bool getLoop() const 68 { return this->bLoop_; } 69 70 inline void setLifetime(float lifetime) 71 { this->lifetime_ = lifetime; this->startParticleSpawner(); } 72 inline float getLifetime() const 73 { return this->lifetime_; } 74 75 inline void setStartdelay(float startdelay) 76 { this->startdelay_ = startdelay; this->startParticleSpawner(); } 77 inline float getStartdelay() const 78 { return this->startdelay_; } 79 80 inline void setDestroydelay(float destroydelay) 81 { this->destroydelay_ = destroydelay; this->startParticleSpawner(); } 82 inline float getDestroydelay() const 83 { return this->destroydelay_; } 52 84 53 85 private: 54 void createParticleSpawner(float lifetime); 86 void startParticleSpawner(); 87 void fireParticleSpawner(); 88 void stopParticleSpawner(); 55 89 void destroyParticleSpawner(); 56 90 57 91 Timer<ParticleSpawner> timer_; 58 ParticleInterface* particle_; 92 93 bool bSuppressStart_; 94 bool bAutostart_; 95 bool bForceDestroy_; 96 bool bAutoDestroy_; 97 bool bLoop_; 98 float startdelay_; 99 float lifetime_; 59 100 float destroydelay_; 60 101 };
Note: See TracChangeset
for help on using the changeset viewer.