[4597] | 1 | /*! |
---|
[5039] | 2 | * @file projectile.h |
---|
[5498] | 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 | */ |
---|
[3710] | 8 | |
---|
[3573] | 9 | #ifndef _PROJECTILE_H |
---|
| 10 | #define _PROJECTILE_H |
---|
| 11 | |
---|
| 12 | #include "world_entity.h" |
---|
| 13 | |
---|
[4597] | 14 | class Projectile : public WorldEntity |
---|
[3573] | 15 | { |
---|
[4890] | 16 | public: |
---|
[4932] | 17 | Projectile (); |
---|
[4890] | 18 | virtual ~Projectile (); |
---|
[3573] | 19 | |
---|
[4927] | 20 | void setFlightDirection(const Quaternion& flightDirection); |
---|
[4890] | 21 | void setVelocity(const Vector &velocity); |
---|
| 22 | void setLifeSpan(float lifeSpan); |
---|
[3573] | 23 | |
---|
[3632] | 24 | |
---|
[4948] | 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; }; |
---|
[3578] | 32 | |
---|
[3573] | 33 | |
---|
[5443] | 34 | /** @brief This is called, when the Projectile is Emitted */ |
---|
| 35 | virtual void activate() = 0; |
---|
| 36 | /** @brief This is called, when the Projectile is being destroyed, or deleted */ |
---|
| 37 | virtual void deactivate() = 0; |
---|
[4948] | 38 | |
---|
[4890] | 39 | virtual void destroy (); |
---|
[4597] | 40 | |
---|
[4890] | 41 | virtual void tick (float time); |
---|
[5500] | 42 | virtual void draw () const; |
---|
[4890] | 43 | |
---|
| 44 | protected: |
---|
| 45 | // energy |
---|
[5498] | 46 | float energyMin; //!< The minimal Energy a Projectile needs to be emitted. |
---|
| 47 | float energyMax; //!< The maximal Energy a Projectile can take, before being emitted. |
---|
[4948] | 48 | bool bChargeable; //!< if the Projectile is Charegeable |
---|
[4890] | 49 | |
---|
| 50 | float lifeCycle; //!< The percentage of the Lifetime done [0-1] |
---|
[4927] | 51 | float lifeSpan; //!< The entire lifespan of the Shoot. in seconds |
---|
[4890] | 52 | |
---|
[4948] | 53 | Vector flightDirection; //!< DOF direction in which the shoot flighs |
---|
[4890] | 54 | |
---|
| 55 | Vector velocity; //!< velocity of the projectile. |
---|
[3573] | 56 | }; |
---|
| 57 | |
---|
| 58 | #endif /* _PROJECTILE_H */ |
---|