Last change
on this file since 3582 was
3580,
checked in by patrick, 19 years ago
|
orxonox/trunk: added character_attributes to orxonox, it will contain, what it is named after. some other changes in projectile.cc
|
File size:
1.9 KB
|
Rev | Line | |
---|
[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 | |
---|
| 30 | class Weapon : public WorldEntity |
---|
| 31 | { |
---|
| 32 | friend class World; |
---|
| 33 | |
---|
| 34 | public: |
---|
| 35 | Weapon (); |
---|
| 36 | virtual ~Weapon (); |
---|
| 37 | |
---|
[3577] | 38 | void enable(); |
---|
| 39 | void disable(); |
---|
| 40 | bool isEnabled(); |
---|
| 41 | |
---|
[3575] | 42 | void setProjectile(Projectile* projectile); |
---|
| 43 | Projectile* getProjectile(); |
---|
| 44 | |
---|
[3580] | 45 | virtual void activate(); |
---|
| 46 | virtual void deactivate(); |
---|
[3575] | 47 | bool isActive(); |
---|
| 48 | |
---|
| 49 | void setWeaponEnergy(int energy); |
---|
[3576] | 50 | int addWeaponEnergy(int addEnergy); |
---|
[3575] | 51 | void substractWeaponEnergy(int subEnergy); |
---|
| 52 | int getWeaponEnergy(); |
---|
| 53 | |
---|
[3580] | 54 | virtual void fire(); |
---|
[3578] | 55 | virtual void hit (WorldEntity* weapon, Vector* loc); |
---|
[3573] | 56 | virtual void destroy (); |
---|
[3575] | 57 | |
---|
| 58 | virtual void tick (float time); |
---|
[3573] | 59 | virtual void draw (); |
---|
| 60 | |
---|
[3575] | 61 | |
---|
[3573] | 62 | private: |
---|
[3577] | 63 | bool enabled; |
---|
[3573] | 64 | float firingRate; |
---|
[3575] | 65 | float localTime; |
---|
[3573] | 66 | float slowDownFactor; |
---|
| 67 | int energyConsumption; |
---|
[3576] | 68 | int energyLimit; |
---|
[3575] | 69 | Projectile* projectile; |
---|
[3573] | 70 | |
---|
| 71 | }; |
---|
| 72 | |
---|
| 73 | #endif /* _WEAPON_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.