| 1 | /*! | 
|---|
| 2 |  * @file projectile.h | 
|---|
| 3 |  * a projectile, that is been shooted by a weapon | 
|---|
| 4 |  * | 
|---|
| 5 |  * You can use this class to make some Projectiles/Bullets/Lasers/Rockets/etc. | 
|---|
| 6 |  * | 
|---|
| 7 |  */ | 
|---|
| 8 |  | 
|---|
| 9 | #ifndef _PROJECTILE_H | 
|---|
| 10 | #define _PROJECTILE_H | 
|---|
| 11 |  | 
|---|
| 12 | #include "world_entity.h" | 
|---|
| 13 |  | 
|---|
| 14 | class Projectile : public WorldEntity | 
|---|
| 15 | { | 
|---|
| 16 |   public: | 
|---|
| 17 |     Projectile (); | 
|---|
| 18 |     virtual ~Projectile (); | 
|---|
| 19 |  | 
|---|
| 20 |     void setFlightDirection(const Quaternion& flightDirection); | 
|---|
| 21 |     void setVelocity(const Vector &velocity); | 
|---|
| 22 |     void setLifeSpan(float lifeSpan); | 
|---|
| 23 |  | 
|---|
| 24 |  | 
|---|
| 25 |     void setEnergies(float energyMin, float energyMax); | 
|---|
| 26 |     /** @returns the minimal charched energy */ | 
|---|
| 27 |     inline float getEnergyMin() { return this->energyMin; }; | 
|---|
| 28 |     /** @returns the maximal charched energy */ | 
|---|
| 29 |     inline float getEnergyMax() { return this->energyMax; }; | 
|---|
| 30 |     /** @returns if the Projectile can be charged */ | 
|---|
| 31 |     inline bool isChageable() { return this->bChargeable; }; | 
|---|
| 32 |  | 
|---|
| 33 |     void setTarget(PNode* target); | 
|---|
| 34 |  | 
|---|
| 35 |     /** @brief This is called, when the Projectile is Emitted */ | 
|---|
| 36 |     virtual void activate() = 0; | 
|---|
| 37 |     /** @brief This is called, when the Projectile is being destroyed, or deleted */ | 
|---|
| 38 |     virtual void deactivate() = 0; | 
|---|
| 39 |  | 
|---|
| 40 |     virtual void destroy (); | 
|---|
| 41 |  | 
|---|
| 42 |     virtual void tick (float time); | 
|---|
| 43 |     virtual void draw () const; | 
|---|
| 44 |  | 
|---|
| 45 |   protected: | 
|---|
| 46 |     // energy | 
|---|
| 47 |     float                 energyMin;                 //!< The minimal Energy a Projectile needs to be emitted. | 
|---|
| 48 |     float                 energyMax;                 //!< The maximal Energy a Projectile can take, before being emitted. | 
|---|
| 49 |     bool                  bChargeable;               //!< if the Projectile is Charegeable | 
|---|
| 50 |  | 
|---|
| 51 |     float                 lifeCycle;                 //!< The percentage of the Lifetime done [0-1] | 
|---|
| 52 |     float                 lifeSpan;                  //!< The entire lifespan of the Shoot. in seconds | 
|---|
| 53 |  | 
|---|
| 54 |     Vector                flightDirection;           //!< DOF direction in which the shoot flighs | 
|---|
| 55 |  | 
|---|
| 56 |     Vector                velocity;                  //!< velocity of the projectile. | 
|---|
| 57 |  | 
|---|
| 58 |     PNode*                target;                    //!< A target for guided Weapons. | 
|---|
| 59 | }; | 
|---|
| 60 |  | 
|---|
| 61 | #endif /* _PROJECTILE_H */ | 
|---|