Orxonox  0.0.5 Codename: Arcturus
BasicProjectile.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  * simonmie
24  * Co-authors:
25  * ...
26  *
27  */
28 
34 #ifndef _BasicProjectile_H__
35 #define _BasicProjectile_H__
36 
37 #include "weapons/WeaponsPrereqs.h"
38 
40 
42 
43 namespace orxonox
44 {
45 
55  {
56  public:
58  virtual ~BasicProjectile();
59 
65  inline void setDamage(float damage)
66  { if(damage >= 0.0f) { this->damage_ = damage; return; } orxout(internal_warning) << "The input projectile damage must be non-negative. Ignoring..." << endl; }
72  inline float getDamage() const
73  { return this->damage_; }
74 
80  inline void setHealthDamage(float healthdamage)
81  { if(healthdamage >= 0.0f) { this->healthdamage_ = healthdamage; return; } orxout(internal_warning) << "The input projectile health-damage must be non-negative. Ignoring..." << endl; }
87  inline float getHealthDamage() const
88  { return this->healthdamage_; }
89 
95  inline void setShieldDamage(float shielddamage)
96  { if(shielddamage >= 0.0f) { this->shielddamage_ = shielddamage; return; } orxout(internal_warning) << "The input projectile shield-damage must be non-negative. Ignoring..." << endl; }
100  inline float getShieldDamage() const
101  { return this->shielddamage_; }
102 
107  virtual void setShooter(Pawn* shooter)
108  { this->shooter_ = shooter; }
113  inline Pawn* getShooter(void)
114  { return this->shooter_; }
115 
116  virtual void destroyObject(void);
117 
118  protected:
119  bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs);
120  void destroyCheck(void);
121  inline void setDestroyAfterCollision(bool destroyAfterCollision)
122  { destroyAfterCollision_ = destroyAfterCollision; }
123  inline bool getDestroyAfterCollision() const
124  { return destroyAfterCollision_; }
125 
126  private:
127  bool isObjectRelatedToShooter(WorldEntity* otherObject);
128 
130 
131  float damage_;
134 
135  bool bDestroy_;
137  };
138 }
139 
140 #endif /* _BasicProjectile_H__ */
float getShieldDamage() const
Get the shield-damage done by this projectile.
Definition: BasicProjectile.h:100
Everything in Orxonox that has a health attribute is a Pawn.
Definition: Pawn.h:56
float getHealthDamage() const
Get the health-damage done by this projectile.
Definition: BasicProjectile.h:87
virtual void setShooter(Pawn *shooter)
Set the entity that fired the projectile.
Definition: BasicProjectile.h:107
Shared library macros, enums, constants and forward declarations for the weapons module ...
float damage_
The amount of normal damage. Normal damage can be (partially) absorbed by shields.
Definition: BasicProjectile.h:131
Output level, used for warnings which are important for developers.
Definition: OutputDefinitions.h:96
WeakPtr< Pawn > shooter_
The entity that fired the projectile.
Definition: BasicProjectile.h:129
This is the class from which all interfaces of the game-logic (not the engine) are derived from...
Definition: OrxonoxInterface.h:50
WeakPtr wraps a pointer to an object, which becomes nullptr if the object is deleted.
Definition: CorePrereqs.h:236
The WorldEntity represents everything that can be put in a Scene at a certain location.
Definition: WorldEntity.h:72
void setHealthDamage(float healthdamage)
Set the health-damage done by this projectile.
Definition: BasicProjectile.h:80
Pawn * getShooter(void)
Get the entity that fired the projectile.
Definition: BasicProjectile.h:113
OutputStream & orxout(OutputLevel level=level::debug_output, const OutputContextContainer &context=context::undefined())
This helper function returns a reference to a commonly used instance of OutputStream.
Definition: Output.h:81
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
bool bDestroy_
Boolean, to check whether a projectile should be destroyed.
Definition: BasicProjectile.h:135
Declaration of OrxonoxInterface, the base class of all interfaces in Orxonox.
float getDamage() const
Get the normal damage done by this projectile.
Definition: BasicProjectile.h:72
void setDestroyAfterCollision(bool destroyAfterCollision)
Definition: BasicProjectile.h:121
void setShieldDamage(float shielddamage)
Set the shield-damage done by this projectile.
Definition: BasicProjectile.h:95
bool destroyAfterCollision_
Boolean, defines whether the projectile gets detroyed after a collision.
Definition: BasicProjectile.h:136
Baseclass of all projectiles.
Definition: BasicProjectile.h:54
bool getDestroyAfterCollision() const
Definition: BasicProjectile.h:123
void setDamage(float damage)
Set the normal damage done by this projectile.
Definition: BasicProjectile.h:65
float shielddamage_
The amount of shield-damage. Shield-damage only reduces shield health.
Definition: BasicProjectile.h:133
#define _WeaponsExport
Definition: WeaponsPrereqs.h:60
float healthdamage_
The amount of health-damage. Health-damage cannot be absorbed by shields.
Definition: BasicProjectile.h:132