Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
orxonox::BasicProjectile Class Reference

Baseclass of all projectiles. More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/modules/weapons/projectiles/BasicProjectile.h>

Inheritance diagram for orxonox::BasicProjectile:
orxonox::OrxonoxInterface orxonox::Configurable orxonox::Destroyable orxonox::Listable orxonox::Identifiable orxonox::GravityBomb orxonox::MineProjectile orxonox::Projectile orxonox::Rocket orxonox::RocketOld orxonox::SimpleRocket orxonox::WagnisProjectile orxonox::BillboardProjectile orxonox::IceGunProjectile orxonox::ParticleProjectile orxonox::LightningGunProjectile orxonox::SplitGunProjectile orxonox::FlameGunProjectile

Public Member Functions

 BasicProjectile ()
 Constructor. More...
 
virtual ~BasicProjectile ()
 
virtual void destroyObject (void)
 Destroys the object. More...
 
float getDamage () const
 Get the normal damage done by this projectile. More...
 
float getHealthDamage () const
 Get the health-damage done by this projectile. More...
 
float getShieldDamage () const
 Get the shield-damage done by this projectile. More...
 
PawngetShooter (void)
 Get the entity that fired the projectile. More...
 
void setDamage (float damage)
 Set the normal damage done by this projectile. More...
 
void setHealthDamage (float healthdamage)
 Set the health-damage done by this projectile. More...
 
void setShieldDamage (float shielddamage)
 Set the shield-damage done by this projectile. More...
 
virtual void setShooter (Pawn *shooter)
 Set the entity that fired the projectile. More...
 
- Public Member Functions inherited from orxonox::OrxonoxInterface
 OrxonoxInterface ()
 
- Public Member Functions inherited from orxonox::Configurable
 Configurable ()
 
void setConfigValues ()
 Function to collect the SetConfigValue-macro calls. More...
 
- Public Member Functions inherited from orxonox::Listable
 Listable ()
 Constructor: Allocates space in the element list. More...
 
 Listable (Context *context)
 Constructor: Allocates space in the element list and assigns the context. More...
 
virtual ~Listable ()
 Destructor: Removes the object from the object-lists. More...
 
ContextgetContext () const
 
void setContext (Context *context)
 Changes the context. More...
 
void unregisterObject ()
 Removes this object from the object-lists. More...
 
- Public Member Functions inherited from orxonox::Identifiable
 Identifiable ()
 Constructor: Sets the default values. More...
 
virtual ~Identifiable ()
 
ORX_FORCEINLINE voidgetDerivedPointer (unsigned int classID)
 Returns a valid pointer of any derived type that is registered in the class hierarchy. More...
 
template<class T >
ORX_FORCEINLINE T * getDerivedPointer (unsigned int classID)
 Version of getDerivedPointer with template. More...
 
template<class T >
ORX_FORCEINLINE const T * getDerivedPointer (unsigned int classID) const
 Const version of getDerivedPointer with template. More...
 
IdentifiergetIdentifier () const
 Returns the Identifier of the object. More...
 
bool isA (const Identifier *identifier)
 Returns true if the object's class is of the given type or a derivative. More...
 
template<class B >
bool isA (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is of the given type or a derivative. More...
 
bool isA (const Identifiable *object)
 Returns true if the object's class is of the given type or a derivative. More...
 
bool isChildOf (const Identifier *identifier)
 Returns true if the object's class is a child of the given type. More...
 
template<class B >
bool isChildOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a child of the given type. More...
 
bool isChildOf (const Identifiable *object)
 Returns true if the object's class is a child of the given type. More...
 
bool isDirectChildOf (const Identifier *identifier)
 Returns true if the object's class is a direct child of the given type. More...
 
template<class B >
bool isDirectChildOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a direct child of the given type. More...
 
bool isDirectChildOf (const Identifiable *object)
 Returns true if the object's class is a direct child of the given type. More...
 
bool isDirectParentOf (const Identifier *identifier)
 Returns true if the object's class is a direct parent of the given type. More...
 
template<class B >
bool isDirectParentOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a direct parent of the given type. More...
 
bool isDirectParentOf (const Identifiable *object)
 Returns true if the object's class is a direct child of the given type. More...
 
bool isExactlyA (const Identifier *identifier)
 Returns true if the object's class is exactly of the given type. More...
 
template<class B >
bool isExactlyA (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is exactly of the given type. More...
 
bool isExactlyA (const Identifiable *object)
 Returns true if the object's class is exactly of the given type. More...
 
bool isParentOf (const Identifier *identifier)
 Returns true if the object's class is a parent of the given type. More...
 
template<class B >
bool isParentOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a parent of the given type. More...
 
bool isParentOf (const Identifiable *object)
 Returns true if the object's class is a parent of the given type. More...
 
- Public Member Functions inherited from orxonox::Destroyable
 Destroyable ()
 Constructor: Sets the default values. More...
 
virtual ~Destroyable ()
 Destructor: Notifies all DestructionListener (for example weak pointers) that this object is being deleted. More...
 
void destroy ()
 Deletes the object if no strong pointers point to this object. More...
 
void destroyLater ()
 Works like destroy() but doesn't destroy the object until the current tick has ended. More...
 
unsigned int getReferenceCount () const
 Returns the number of strong pointers that point to this object. More...
 

Protected Member Functions

void destroyCheck (void)
 Check whether the projectile needs to be destroyed and destroys it if so. More...
 
bool getDestroyAfterCollision () const
 
bool processCollision (WorldEntity *otherObject, btManifoldPoint &contactPoint, const btCollisionShape *cs)
 The function called when a projectile hits another thing. More...
 
void setDestroyAfterCollision (bool destroyAfterCollision)
 
- Protected Member Functions inherited from orxonox::Destroyable
virtual void preDestroy ()
 This virtual function is called if destroy() is called and no StrongPtr points to this object. More...
 

Private Member Functions

bool isObjectRelatedToShooter (WorldEntity *otherObject)
 Returns true if otherObject is equal to the shooter or if one of otherObject's parents is equal to the shooter or if one of the shooter's parent is equal to otherObject. More...
 

Private Attributes

bool bDestroy_
 Boolean, to check whether a projectile should be destroyed. More...
 
float damage_
 The amount of normal damage. Normal damage can be (partially) absorbed by shields. More...
 
bool destroyAfterCollision_
 Boolean, defines whether the projectile gets detroyed after a collision. More...
 
float healthdamage_
 The amount of health-damage. Health-damage cannot be absorbed by shields. More...
 
float shielddamage_
 The amount of shield-damage. Shield-damage only reduces shield health. More...
 
WeakPtr< Pawnshooter_
 The entity that fired the projectile. More...
 

Detailed Description

Baseclass of all projectiles.

Defines the damage the projectile does.

Author
Simon Miescher

Constructor & Destructor Documentation

orxonox::BasicProjectile::BasicProjectile ( )

Constructor.

Registers the object and initializes some default values.

orxonox::BasicProjectile::~BasicProjectile ( )
virtual

Member Function Documentation

void orxonox::BasicProjectile::destroyCheck ( void  )
protected

Check whether the projectile needs to be destroyed and destroys it if so.

Needs to be called in the tick() by every Class directly inheriting from BasicProjectile, to make sure the projectile is destroyed after it has hit something.

void orxonox::BasicProjectile::destroyObject ( void  )
virtual

Destroys the object.

Reimplemented in orxonox::Rocket, and orxonox::RocketOld.

float orxonox::BasicProjectile::getDamage ( ) const
inline

Get the normal damage done by this projectile.

Normal damage can be (partially) absorbed by shields.

Returns
Returns the amount of damage. Is non-negative.
bool orxonox::BasicProjectile::getDestroyAfterCollision ( ) const
inlineprotected
float orxonox::BasicProjectile::getHealthDamage ( ) const
inline

Get the health-damage done by this projectile.

Health-damage cannot be absorbed by shields.

Returns
healthdamage The amount of damage. Is non-negative.
float orxonox::BasicProjectile::getShieldDamage ( ) const
inline

Get the shield-damage done by this projectile.

Pawn* orxonox::BasicProjectile::getShooter ( void  )
inline

Get the entity that fired the projectile.

Returns
Returns a pointer to the Pawn that fired the projectile.
bool orxonox::BasicProjectile::isObjectRelatedToShooter ( WorldEntity otherObject)
private

Returns true if otherObject is equal to the shooter or if one of otherObject's parents is equal to the shooter or if one of the shooter's parent is equal to otherObject.

bool orxonox::BasicProjectile::processCollision ( WorldEntity otherObject,
btManifoldPoint &  contactPoint,
const btCollisionShape *  cs 
)
protected

The function called when a projectile hits another thing.

Calls the hit-function, starts the shield recharge countdown, displays visual hit effects defined in Pawn. Needs to be called in the collidesAgainst() function by every Class directly inheriting from BasicProjectile.

Parameters
otherObjectA pointer to the object the Projectile has collided against.
contactPointA btManifoldPoint indicating the point of contact/impact.
csThe btCollisionShape of the other object
Returns
Returns true if the collision resulted in a successful hit.
See also
Pawn.h
void orxonox::BasicProjectile::setDamage ( float  damage)
inline

Set the normal damage done by this projectile.

Normal damage can be (partially) absorbed by shields.

Parameters
damageThe amount of damage. Must be non-negative.
void orxonox::BasicProjectile::setDestroyAfterCollision ( bool  destroyAfterCollision)
inlineprotected
void orxonox::BasicProjectile::setHealthDamage ( float  healthdamage)
inline

Set the health-damage done by this projectile.

Health-damage cannot be absorbed by shields.

Parameters
healthdamageThe amount of damage. Must be non-negative.
void orxonox::BasicProjectile::setShieldDamage ( float  shielddamage)
inline

Set the shield-damage done by this projectile.

Shield-damage only reduces shield health.

Parameters
shielddamageThe amount of damage. Must be non-negative.
virtual void orxonox::BasicProjectile::setShooter ( Pawn shooter)
inlinevirtual

Set the entity that fired the projectile.

Parameters
shooterA pointer to the Pawn that fired the projectile.

Reimplemented in orxonox::SimpleRocket, orxonox::Rocket, and orxonox::RocketOld.

Member Data Documentation

bool orxonox::BasicProjectile::bDestroy_
private

Boolean, to check whether a projectile should be destroyed.

float orxonox::BasicProjectile::damage_
private

The amount of normal damage. Normal damage can be (partially) absorbed by shields.

bool orxonox::BasicProjectile::destroyAfterCollision_
private

Boolean, defines whether the projectile gets detroyed after a collision.

float orxonox::BasicProjectile::healthdamage_
private

The amount of health-damage. Health-damage cannot be absorbed by shields.

float orxonox::BasicProjectile::shielddamage_
private

The amount of shield-damage. Shield-damage only reduces shield health.

WeakPtr<Pawn> orxonox::BasicProjectile::shooter_
private

The entity that fired the projectile.


The documentation for this class was generated from the following files: