author | saiam |
Sun, 07 Dec 2008 19:40:40 +0000 | |
changeset 251 | 6a6208e5c7a1 |
parent 236 | 0048ba274152 |
child 253 | 747b1037d83e |
permissions | -rw-r--r-- |
212 | 1 |
#ifndef WEAPON_HH |
2 |
#define WEAPON_HH |
|
3 |
||
221 | 4 |
// forward-declare |
5 |
class Weapon; |
|
6 |
||
7 |
#include "GameState.hh" |
|
222
293ddf4c067d
reorganize PhysicsObject/Player/Projectile lists so that PhysicsObject doesn't need to know about its subclasses anymore, and PhysicsWorld doesn't need to know about GameState
ekku
parents:
221
diff
changeset
|
8 |
#include "Projectile.hh" |
212 | 9 |
#include "Timer.hh" |
10 |
#include <string> |
|
11 |
||
12 |
class Weapon { |
|
221 | 13 |
protected: |
14 |
std::string name; |
|
212 | 15 |
float velocity; |
16 |
float explosionRadius; |
|
17 |
int reloadTime; //in ms |
|
251
6a6208e5c7a1
Added recoil parameter for weapons, but it is not used yet.
saiam
parents:
236
diff
changeset
|
18 |
float recoil; |
212 | 19 |
|
20 |
int clipSize; |
|
21 |
||
221 | 22 |
bool visible; |
23 |
TickCount age; |
|
24 |
int reloadTimer; |
|
212 | 25 |
|
221 | 26 |
public: |
236 | 27 |
Weapon (TickCount age, float velocity, float explosionRadius, int reloadTime, std::string name); |
221 | 28 |
|
29 |
// advance the reload timer |
|
30 |
void tickReload (TimeMS dt); |
|
31 |
||
32 |
// can the weapon be fired (not reloading, have a clip, etc) |
|
33 |
bool canShoot (void); |
|
34 |
||
223 | 35 |
// get weapon parameters |
233
ff4ecea83cf5
start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
terom
parents:
223
diff
changeset
|
36 |
std::string getName (void) { return name; } |
235 | 37 |
float getSpeed (void) { return velocity; } |
223 | 38 |
float getExplosionRadius (void) { return explosionRadius; } |
39 |
TickCount getExpireTicks (void) { return age; } |
|
40 |
||
41 |
// start reloading |
|
42 |
void reload (void); |
|
212 | 43 |
}; |
44 |
||
45 |
#endif |