[3573] | 1 | /*! |
---|
| 2 | \file weapon.h |
---|
| 3 | \brief a weapon that a player can use |
---|
| 4 | |
---|
| 5 | A Player has a list of weapons, that can be choosen to shoot projectiles |
---|
| 6 | (projectiles.{cc,h}) at ennemies. These weapons can be shooted sequentially |
---|
| 7 | or (if able) combined. Therefore you can choose the weapon mode = choose |
---|
| 8 | a weapon. |
---|
| 9 | |
---|
| 10 | A weapon is characterized by: |
---|
| 11 | o firing-rate: the initial firing rate of a weapon (1/s = Herz) |
---|
| 12 | o slowdown-factor: this is a factor d: exp(-d*x), d is element of all positive R. it determines how fast the firing-rate will slow down. if no slowdown: d=0, the bigger d is, the faster the weapon will slow down! |
---|
| 13 | o energy-consumption: this determines the energy that has to be used to produce this projectile = costs per projectile |
---|
| 14 | |
---|
| 15 | Furthermore there are some other attributes, that will help to represent a firing |
---|
| 16 | weapon in this world: |
---|
| 17 | o sound file/ressource: this is a pointer to the sound-file/ressource. however it may be represented |
---|
[3575] | 18 | o shooting animation |
---|
[3573] | 19 | |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | #ifndef _WEAPON_H |
---|
| 24 | #define _WEAPON_H |
---|
| 25 | |
---|
| 26 | #include "world_entity.h" |
---|
| 27 | |
---|
[3575] | 28 | class Projectile; |
---|
[3573] | 29 | |
---|
[3583] | 30 | typedef enum { |
---|
| 31 | SHOOT, |
---|
| 32 | EMPTY, |
---|
| 33 | RELOAD, |
---|
| 34 | SPECIAL1, |
---|
| 35 | SPECIAL2, |
---|
| 36 | SPECIAL3 |
---|
| 37 | } weaponSoundType; |
---|
| 38 | |
---|
| 39 | |
---|
[3573] | 40 | class Weapon : public WorldEntity |
---|
| 41 | { |
---|
| 42 | friend class World; |
---|
| 43 | |
---|
| 44 | public: |
---|
| 45 | Weapon (); |
---|
| 46 | virtual ~Weapon (); |
---|
| 47 | |
---|
[3583] | 48 | void enable(void); |
---|
| 49 | void disable(void); |
---|
| 50 | bool isEnabled(void); |
---|
[3577] | 51 | |
---|
[3575] | 52 | void setProjectile(Projectile* projectile); |
---|
[3583] | 53 | Projectile* getProjectile(void); |
---|
[3575] | 54 | |
---|
[3583] | 55 | virtual void activate(void); |
---|
| 56 | virtual void deactivate(void); |
---|
| 57 | bool isActive(void); |
---|
[3575] | 58 | |
---|
[3583] | 59 | virtual void setWeaponIdleTime(float time); |
---|
| 60 | virtual float getWeaponIdleTime(void); |
---|
| 61 | virtual bool hasWeaponIdleTimeElapsed(void); |
---|
[3575] | 62 | |
---|
[3583] | 63 | virtual void fire(void); |
---|
[3578] | 64 | virtual void hit (WorldEntity* weapon, Vector* loc); |
---|
[3583] | 65 | virtual void destroy(void); |
---|
[3575] | 66 | |
---|
[3583] | 67 | virtual void tick(float time); |
---|
| 68 | virtual void weaponIdle(void); |
---|
| 69 | virtual void draw(void); |
---|
[3573] | 70 | |
---|
[3575] | 71 | |
---|
[3573] | 72 | private: |
---|
[3577] | 73 | bool enabled; |
---|
[3575] | 74 | float localTime; |
---|
[3573] | 75 | float slowDownFactor; |
---|
[3575] | 76 | Projectile* projectile; |
---|
[3583] | 77 | //WeaponSound sound; |
---|
[3573] | 78 | |
---|
| 79 | }; |
---|
| 80 | |
---|
| 81 | #endif /* _WEAPON_H */ |
---|