Orxonox  0.0.5 Codename: Arcturus
ParticleSpawner.h
Go to the documentation of this file.
1 /*
2  * ORXONOX - the hottest 3D action shooter ever to exist
3  * > www.orxonox.net <
4  *
5  *
6  * License notice:
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * Author:
23  * Fabian 'x3n' Landau
24  * Co-authors:
25  * ...
26  *
27  */
28 
29 #ifndef _ParticleSpawner_H__
30 #define _ParticleSpawner_H__
31 
32 #include "OrxonoxPrereqs.h"
33 
34 #include "tools/Timer.h"
35 #include "ParticleEmitter.h"
36 
37 namespace orxonox
38 {
40  {
41  public:
42  ParticleSpawner(Context* context);
43  virtual ~ParticleSpawner();
44 
45  virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
46  virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override;
47 
48  inline void stop(bool bDestroy)
49  { this->bForceDestroy_ = bDestroy; 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_; }
84 
85  private:
86  void startParticleSpawner();
87  void fireParticleSpawner();
88  void stopParticleSpawner();
89  void destroyParticleSpawner();
90 
92 
97  bool bLoop_;
98  float startdelay_;
99  float lifetime_;
101  };
102 }
103 
104 #endif /* _ParticleSpawner_H__ */
void setLifetime(float lifetime)
Definition: ParticleSpawner.h:70
bool getLoop() const
Definition: ParticleSpawner.h:67
bool getDestroyAfterLife() const
Definition: ParticleSpawner.h:62
float lifetime_
Definition: ParticleSpawner.h:99
void setAutoStart(bool autostart)
Definition: ParticleSpawner.h:55
void setDestroydelay(float destroydelay)
Definition: ParticleSpawner.h:80
Definition: ParticleSpawner.h:39
void stop(bool bDestroy)
Definition: ParticleSpawner.h:48
float getDestroydelay() const
Definition: ParticleSpawner.h:82
The MetaPickup destroys all the PickupCarriers&#39; Pickupables.
Definition: ParticleEmitter.h:39
bool bSuppressStart_
Definition: ParticleSpawner.h:93
void spawn()
Definition: ParticleSpawner.h:50
xmlelement
Definition: Super.h:519
Timer timer_
Definition: ParticleSpawner.h:91
float startdelay_
Definition: ParticleSpawner.h:98
Declaration of the Timer class, used to call functions after a given time-interval.
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
bool getAutoStart() const
Definition: ParticleSpawner.h:57
Mode
Definition: CorePrereqs.h:102
void setStartdelay(float startdelay)
Definition: ParticleSpawner.h:75
float getStartdelay() const
Definition: ParticleSpawner.h:77
Shared library macros, enums, constants and forward declarations for the orxonox library ...
bool bForceDestroy_
Definition: ParticleSpawner.h:95
Definition: Context.h:45
float destroydelay_
Definition: ParticleSpawner.h:100
#define _OrxonoxExport
Definition: OrxonoxPrereqs.h:60
void setLoop(bool loop)
Definition: ParticleSpawner.h:65
float getLifetime() const
Definition: ParticleSpawner.h:72
void setDestroyAfterLife(bool destroy)
Definition: ParticleSpawner.h:60
bool bLoop_
Definition: ParticleSpawner.h:97
Timer is a helper class that executes a function after a given amount of seconds in game-time...
Definition: Timer.h:105
bool bAutoDestroy_
Definition: ParticleSpawner.h:96
bool bAutostart_
Definition: ParticleSpawner.h:94