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 | |
---|
30 | @file |
---|
31 | @author remartin |
---|
32 | @brief Asteroid field with lots of parameters. Derived from asteroidField.lua |
---|
33 | |
---|
34 | Generates a bunch of asteroids that may contain some stuff. |
---|
35 | It is required to wait until all XML-arguments are set. That's why the actual |
---|
36 | generation happens when tick() gets called for the first time. |
---|
37 | |
---|
38 | */ |
---|
39 | |
---|
40 | #ifndef _SpicedAsteroidField_H__ |
---|
41 | #define _SpicedAsteroidField_H__ |
---|
42 | |
---|
43 | #include "OrxonoxPrereqs.h" |
---|
44 | |
---|
45 | #include <string> |
---|
46 | #include <vector> |
---|
47 | |
---|
48 | #include "worldentities/ControllableEntity.h" |
---|
49 | #include "../../orxonox/worldentities/pawns/Pawn.h" |
---|
50 | |
---|
51 | namespace orxonox // tolua_export |
---|
52 | { |
---|
53 | |
---|
54 | // tolua_export |
---|
55 | class _OrxonoxExport SpicedAsteroidField : public Pawn // need pawn to get tick for clean argument passing |
---|
56 | { // tolua_export |
---|
57 | |
---|
58 | public: |
---|
59 | SpicedAsteroidField(Context* context);// This constructor is for XML access only! |
---|
60 | SpicedAsteroidField(Context* c, Vector3 p, int minS, int maxS, int w, int count, bool f, float mD, float fD); |
---|
61 | |
---|
62 | virtual ~SpicedAsteroidField(); |
---|
63 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
64 | virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; |
---|
65 | virtual void tick(float dt) override; |
---|
66 | |
---|
67 | |
---|
68 | inline void setCount(float s){this->count = s;} |
---|
69 | inline float getCount(){return this->count;} |
---|
70 | |
---|
71 | inline void setMineralDensity(float d){this->mDensity = d;} |
---|
72 | inline float getMineralDensity(){return this->mDensity;} |
---|
73 | |
---|
74 | inline void setPosition(Vector3 v){this->position = v;} |
---|
75 | inline Vector3 getPosition(){return this->position;} |
---|
76 | |
---|
77 | inline void setMaxSize(int i){this->maxSize = i;} |
---|
78 | inline int getMaxSize(){return this->maxSize;} |
---|
79 | |
---|
80 | inline void setMinSize(int i){this->minSize = i;} |
---|
81 | inline int getMinSize(){return this->minSize;} |
---|
82 | |
---|
83 | inline void setRadius(float r){this->radius = r;} |
---|
84 | inline int getRadius(){return this->radius;} |
---|
85 | |
---|
86 | inline void setFog(bool f){this->foggy = f;} |
---|
87 | inline bool isFoggy(){return this->foggy;} |
---|
88 | |
---|
89 | inline void setFogDensity(float fd){this->fogDensity = fd;} |
---|
90 | inline float getFogDensity(){return this->fogDensity;} |
---|
91 | |
---|
92 | protected: |
---|
93 | |
---|
94 | Context* context; |
---|
95 | |
---|
96 | float count; //!< Number of asteroids generated |
---|
97 | float mDensity; //!< Mineral density, between 0 and 1; |
---|
98 | |
---|
99 | Vector3 position; //!< The center |
---|
100 | |
---|
101 | int maxSize; //!< Upper bound to asteroid size |
---|
102 | int minSize; //!< Lower bound to asteroid size |
---|
103 | |
---|
104 | float radius; //!< Asteroids can appear within a sphere. |
---|
105 | bool foggy; //!< Whether there's fog |
---|
106 | float fogDensity; |
---|
107 | |
---|
108 | |
---|
109 | private: |
---|
110 | void registerVariables(); |
---|
111 | |
---|
112 | virtual void create(); |
---|
113 | |
---|
114 | |
---|
115 | }; // tolua_export |
---|
116 | } // tolua_export |
---|
117 | |
---|
118 | #endif /* _SpicedAsteroidField_H__ */ |
---|