[11610] | 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 | |
---|
[11664] | 28 | /** |
---|
| 29 | |
---|
[11667] | 30 | @file |
---|
| 31 | @author remartin |
---|
[11664] | 32 | @brief Asteroid field with lots of parameters. Derived from asteroidField.lua |
---|
| 33 | |
---|
[11667] | 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 | |
---|
[11664] | 38 | */ |
---|
| 39 | |
---|
[11610] | 40 | #ifndef _SpicedAsteroidField_H__ |
---|
| 41 | #define _SpicedAsteroidField_H__ |
---|
| 42 | |
---|
| 43 | #include "OrxonoxPrereqs.h" |
---|
| 44 | |
---|
| 45 | #include <string> |
---|
| 46 | #include <vector> |
---|
[11664] | 47 | |
---|
[11610] | 48 | #include "worldentities/ControllableEntity.h" |
---|
| 49 | #include "../../orxonox/worldentities/pawns/Pawn.h" |
---|
| 50 | |
---|
| 51 | namespace orxonox // tolua_export |
---|
| 52 | { |
---|
| 53 | |
---|
| 54 | // tolua_export |
---|
[11640] | 55 | class _OrxonoxExport SpicedAsteroidField : public Pawn // need pawn to get tick for clean argument passing |
---|
[11610] | 56 | { // tolua_export |
---|
| 57 | |
---|
| 58 | public: |
---|
| 59 | SpicedAsteroidField(Context* context);// This constructor is for XML access only! |
---|
[11664] | 60 | SpicedAsteroidField(Context* c, Vector3 p, int minS, int maxS, int w, int count, bool f, float mD, float fD); |
---|
[11610] | 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 | |
---|
[11615] | 68 | inline void setCount(float s){this->count = s;} |
---|
| 69 | inline float getCount(){return this->count;} |
---|
[11610] | 70 | |
---|
[11615] | 71 | inline void setMineralDensity(float d){this->mDensity = d;} |
---|
| 72 | inline float getMineralDensity(){return this->mDensity;} |
---|
[11610] | 73 | |
---|
[11615] | 74 | inline void setPosition(Vector3 v){this->position = v;} |
---|
[11640] | 75 | inline Vector3 getPosition(){return this->position;} |
---|
[11610] | 76 | |
---|
[11615] | 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 | |
---|
[11640] | 89 | inline void setFogDensity(float fd){this->fogDensity = fd;} |
---|
| 90 | inline float getFogDensity(){return this->fogDensity;} |
---|
| 91 | |
---|
[11610] | 92 | protected: |
---|
[11664] | 93 | |
---|
| 94 | Context* context; |
---|
| 95 | |
---|
[11667] | 96 | float count; //!< Number of asteroids generated |
---|
| 97 | float mDensity; //!< Mineral density, between 0 and 1; |
---|
[11615] | 98 | |
---|
[11667] | 99 | Vector3 position; //!< The center |
---|
[11640] | 100 | |
---|
[11667] | 101 | int maxSize; //!< Upper bound to asteroid size |
---|
| 102 | int minSize; //!< Lower bound to asteroid size |
---|
[11610] | 103 | |
---|
[11667] | 104 | float radius; //!< Asteroids can appear within a sphere. |
---|
| 105 | bool foggy; //!< Whether there's fog |
---|
[11640] | 106 | float fogDensity; |
---|
[11615] | 107 | |
---|
[11610] | 108 | |
---|
| 109 | private: |
---|
| 110 | void registerVariables(); |
---|
| 111 | |
---|
[11667] | 112 | virtual void create(); |
---|
| 113 | |
---|
| 114 | |
---|
[11610] | 115 | }; // tolua_export |
---|
| 116 | } // tolua_export |
---|
| 117 | |
---|
| 118 | #endif /* _SpicedAsteroidField_H__ */ |
---|