Orxonox  0.0.5 Codename: Arcturus
AsteroidMinable.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  * remartin
24  * Co-authors:
25  * ...
26  *
27  */
28 
29 
73 #ifndef _AsteroidMinable_H__
74 #define _AsteroidMinable_H__
75 
76 #include "AsteroidMiningPrereqs.h"
77 
79 
80 namespace orxonox{
81 
82 
84  {
85  public:
86  AsteroidMinable(Context* context);
87  virtual ~AsteroidMinable();
88 
89  virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
90  virtual void tick(float dt) override;
91 
92  // @brief overloading that to prevent asteroids from taking damage from each other (domino effect etc. )
93  virtual void hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
94  virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
95 
96  void setSize(float s);
97  inline float getSize(){return this->size;}
98 
99  inline void setShattering(bool b){this->generateSmaller = b;}
100  inline bool doesShatter(){return this->generateSmaller;}
101 
102  inline void setDropStuff(bool b){this->dropStuff = b;}
103  inline bool doesDropStuff(){return this->dropStuff;}
104 
105  protected:
106 
107  float size;
109  bool dropStuff;
110 
111  // @brief Überschreibt die Methode in Pawn
112  virtual void death();
113 
114  private:
115 
116  bool initialised;
117 
118  void registerVariables();
119 
120  // @brief Helper method.
121  virtual void putStuff();
122 
123  // @brief If the option generateSmaller is enabled, individual fragments are added with this method.
124  virtual void spawnChildren();
125 
126  }; // tolua_export
127 } // tolua_export
128 
129 #endif /* _AsteroidMinable_H__ */
void setShattering(bool b)
Definition: AsteroidMinable.h:99
Everything in Orxonox that has a health attribute is a Pawn.
Definition: Pawn.h:56
bool generateSmaller
Whether this asteroid leaves fragments.
Definition: AsteroidMinable.h:108
Shared library macros, enums, constants and forward declarations for the AsteroidMining module ...
float size
Implies health and type of dropped pickups.
Definition: AsteroidMinable.h:107
xmlelement
Definition: Super.h:519
bool doesShatter()
Definition: AsteroidMinable.h:100
Definition: AsteroidMinable.h:83
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Mode
Definition: CorePrereqs.h:102
bool doesDropStuff()
Definition: AsteroidMinable.h:103
Definition: Context.h:45
void setDropStuff(bool b)
Definition: AsteroidMinable.h:102
bool dropStuff
Whether this asteroid yields valuable stuff.
Definition: AsteroidMinable.h:109
#define _AsteroidMiningExport
Definition: AsteroidMiningPrereqs.h:60
float getSize()
Definition: AsteroidMinable.h:97
bool initialised
Used in relation to the constructor detour described above.
Definition: AsteroidMinable.h:116