Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/weapons/projectile.h @ 5443

Last change on this file since 5443 was 5443, checked in by bensch, 19 years ago

orxonox/trunk: heavy ParticleEmission from the Bullets

@patrick: i think, this is what you wanted me to do…

File size: 2.5 KB
Line 
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 shoots, but this isn't the real idea. If you want to just test, if the
6    shooting funcions work, use the Projectile class. But if you want to implement your own shoots its
7    different:<br>
8    Make a new class and derive it from Projectile. To have a weapon work well, reimplement the functions
9    - void tick()
10    - void draw()
11    - void hit() (only if you have working collision detection)
12    When you have implemented these functions you have just to add the projectiles to your weapon. You ll want
13    to make this by looking into the function
14    - Weapon::fire()
15    there you just change the line:
16    Projectile* pj = new Projectile();    TO     Projectile* pj = new MyOwnProjectileClass();
17    and schwups it works... :)
18*/
19
20#ifndef _PROJECTILE_H
21#define _PROJECTILE_H
22
23#include "world_entity.h"
24#include "vector.h"
25
26class Projectile : public WorldEntity
27{
28  public:
29    Projectile ();
30    virtual ~Projectile ();
31
32    void setFlightDirection(const Quaternion& flightDirection);
33    void setVelocity(const Vector &velocity);
34    void setLifeSpan(float lifeSpan);
35
36
37    void setEnergies(float energyMin, float energyMax);
38    /** @returns the minimal charched energy */
39    inline float getEnergyMin() { return this->energyMin; };
40    /** @returns the maximal charched energy */
41    inline float getEnergyMax() { return this->energyMax; };
42    /** @returns if the Projectile can be charged */
43    inline bool isChageable() { return this->bChargeable; };
44
45
46    /** @brief This is called, when the Projectile is Emitted */
47    virtual void activate() = 0;
48    /** @brief This is called, when the Projectile is being destroyed, or deleted */
49    virtual void deactivate() = 0;
50
51    virtual void destroy ();
52
53    virtual void tick (float time);
54    virtual void draw ();
55
56  protected:
57    // energy
58    float                 energyMin;
59    float                 energyMax;
60    bool                  bChargeable;               //!< if the Projectile is Charegeable
61
62    float                 lifeCycle;                 //!< The percentage of the Lifetime done [0-1]
63    float                 lifeSpan;                  //!< The entire lifespan of the Shoot. in seconds
64
65    Vector                flightDirection;           //!< DOF direction in which the shoot flighs
66
67    Vector                velocity;                  //!< velocity of the projectile.
68};
69
70#endif /* _PROJECTILE_H */
Note: See TracBrowser for help on using the repository browser.