Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 30, 2008, 2:44:48 AM (16 years ago)
Author:
landauf
Message:

added two more graphical classes, ParticleEmitter and ParticleSpawner

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleSpawner.h

    r2044 r2065  
    3232#include "OrxonoxPrereqs.h"
    3333
    34 #include "PositionableEntity.h"
     34#include "ParticleEmitter.h"
    3535#include "tools/Timer.h"
    3636
    3737namespace orxonox
    3838{
    39     class _OrxonoxExport ParticleSpawner : public PositionableEntity
     39    class _OrxonoxExport ParticleSpawner : public ParticleEmitter
    4040    {
    4141        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);
    4443            virtual ~ParticleSpawner();
    45             void destroy();
    4644
    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);
    5047
    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_; }
    5284
    5385        private:
    54             void createParticleSpawner(float lifetime);
     86            void startParticleSpawner();
     87            void fireParticleSpawner();
     88            void stopParticleSpawner();
    5589            void destroyParticleSpawner();
    5690
    5791            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_;
    59100            float destroydelay_;
    60101    };
Note: See TracChangeset for help on using the changeset viewer.