Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/weapon2/src/orxonox/objects/worldentities/ParticleSpawner.h @ 2691

Last change on this file since 2691 was 2103, checked in by rgrieder, 16 years ago

Merged r2101 (objecthierarchy) to trunk.

  • Property svn:eol-style set to native
  • Property svn:mergeinfo set to (toggle deleted branches)
    /code/branches/ceguilua/src/orxonox/objects/ParticleSpawner.h1802-1808
    /code/branches/core3/src/orxonox/objects/ParticleSpawner.h1572-1739
    /code/branches/gcc43/src/orxonox/objects/ParticleSpawner.h1580
    /code/branches/gui/src/orxonox/objects/ParticleSpawner.h1635-1723
    /code/branches/input/src/orxonox/objects/ParticleSpawner.h1629-1636
    /code/branches/objecthierarchy/src/orxonox/objects/worldentities/ParticleSpawner.h2100
    /code/branches/script_trigger/src/orxonox/objects/ParticleSpawner.h1295-1953,​1955
File size: 3.5 KB
Line 
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 "ParticleEmitter.h"
35#include "tools/Timer.h"
36
37namespace orxonox
38{
39    class _OrxonoxExport ParticleSpawner : public ParticleEmitter
40    {
41        public:
42            ParticleSpawner(BaseObject* creator);
43            virtual ~ParticleSpawner();
44
45            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
46            virtual void processEvent(Event& event);
47
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_; }
84
85        private:
86            void startParticleSpawner();
87            void fireParticleSpawner();
88            void stopParticleSpawner();
89            void destroyParticleSpawner();
90
91            Timer<ParticleSpawner> timer_;
92
93            bool  bSuppressStart_;
94            bool  bAutostart_;
95            bool  bForceDestroy_;
96            bool  bAutoDestroy_;
97            bool  bLoop_;
98            float startdelay_;
99            float lifetime_;
100            float destroydelay_;
101    };
102}
103
104#endif /* _ParticleSpawner_H__ */
Note: See TracBrowser for help on using the repository browser.