- Timestamp:
- Aug 22, 2011, 3:05:26 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/weapons/projectiles/BasicProjectile.h
r8706 r8855 27 27 */ 28 28 29 /** 30 @file BasicProjectile.h 31 @brief Definition of the BasicProjectile class. 32 */ 33 29 34 #ifndef _BasicProjectile_H__ 30 35 #define _BasicProjectile_H__ … … 32 37 #include "weapons/WeaponsPrereqs.h" 33 38 34 #include "tools/Timer.h" 39 #include "worldentities/pawns/Pawn.h" 40 35 41 #include "core/OrxonoxClass.h" 36 42 37 43 namespace orxonox 38 44 { 45 46 /** 47 @brief 48 Baseclass of all projectiles. Defines the damage the projectile does. 49 50 @author 51 Simon Miescher 52 @ingroup WeaponsProjectiles 53 */ 39 54 class _WeaponsExport BasicProjectile : public virtual OrxonoxClass 40 55 { 41 56 public: 42 57 BasicProjectile(); 43 44 58 virtual ~BasicProjectile(); 45 59 46 static bool basicCollidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint, Pawn* owner, BasicProjectile* this_); 47 48 void basicDestroyObject(); 49 60 /** 61 @brief Set the normal damage done by this projectile. 62 Normal damage can be (partially) absorbed by shields. 63 @param damage The amount of damage. Must be non-negative. 64 */ 50 65 inline void setDamage(float damage) 51 { this->damage_ = damage; } 66 { if(damage >= 0.0f) { this->damage_ = damage; return; } COUT(1) << "The input projectile damage must be non-negative. Ignoring..." << endl; } 67 /** 68 @brief Get the normal damage done by this projectile. 69 Normal damage can be (partially) absorbed by shields. 70 @return Returns the amount of damage. Is non-negative. 71 */ 52 72 inline float getDamage() const 53 73 { return this->damage_; } 54 74 75 /** 76 @brief Set the health-damage done by this projectile. 77 Health-damage cannot be absorbed by shields. 78 @param healthdamage The amount of damage. Must be non-negative. 79 */ 55 80 inline void setHealthDamage(float healthdamage) 56 { this->healthdamage_ = healthdamage; } 81 { if(healthdamage >= 0.0f) { this->healthdamage_ = healthdamage; return; } COUT(1) << "The input projectile health-damage must be non-negative. Ignoring..." << endl; } 82 /** 83 @brief Get the health-damage done by this projectile. 84 Health-damage cannot be absorbed by shields. 85 @return healthdamage The amount of damage. Is non-negative. 86 */ 57 87 inline float getHealthDamage() const 58 88 { return this->healthdamage_; } 59 89 90 /** 91 @brief Set the shield-damage done by this projectile. 92 Shield-damage only reduces shield health. 93 @param shielddamage The amount of damage. Must be non-negative. 94 */ 60 95 inline void setShieldDamage(float shielddamage) 61 { this->shielddamage_ = shielddamage; } //ShieldDamage wird korrekt gesettet vom XML-File 96 { if(shielddamage >= 0.0f) { this->shielddamage_ = shielddamage; return; } COUT(1) << "The input projectile shield-damage must be non-negative. Ignoring..." << endl; } 97 /** 98 @brief Get the shield-damage done by this projectile. 99 Shield-damage only reduces shield health. 100 @param shielddamage The amount of damage. Is non-negative. 101 */ 62 102 inline float getShieldDamage() const 63 103 { return this->shielddamage_; } 64 104 105 /** 106 @brief Set the entity that fired the projectile. 107 @param shooter A pointer to the Pawn that fired the projectile. 108 */ 109 virtual void setShooter(Pawn* shooter) 110 { this->shooter_ = shooter; } 111 /** 112 @brief Get the entity that fired the projectile. 113 @return Returns a pointer to the Pawn that fired the projectile. 114 */ 115 inline Pawn* getShooter(void) 116 { return this->shooter_; } 65 117 66 inline void setBDestroy(bool bDestroy) 67 { this->bDestroy_ = bDestroy; } 68 inline float getBDestroy() const 69 { return this->bDestroy_; } 118 virtual void destroyObject(void); 70 119 120 protected: 121 bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint); 122 void destroyCheck(void); 71 123 72 124 private: 73 // WeakPtr<Pawn> owner_; //owner cannot be set in BasicProjectile, because it's already defined in MobileEntity and Movable Entity 125 WeakPtr<Pawn> shooter_; //!< The entity that fired the projectile. 74 126 75 float damage_; 76 float healthdamage_; 77 float shielddamage_; 127 float damage_; //!< The amount of normal damage. Normal damage can be (partially) absorbed by shields. 128 float healthdamage_; //!< The amount of health-damage. Health-damage cannot be absorbed by shields. 129 float shielddamage_; //!< The amount of shield-damage. Shield-damage only reduces shield health. 78 130 79 bool bDestroy_; 131 bool bDestroy_; //!< Boolean, to check whether a projectile should be destroyed. 80 132 }; 81 133 }
Note: See TracChangeset
for help on using the changeset viewer.