author | terom |
Sat, 06 Dec 2008 22:47:08 +0000 | |
changeset 233 | ff4ecea83cf5 |
parent 223 | 2fcaf54ed37b |
child 235 | 0a0c729365ee |
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 |
GameState &st; |
|
15 |
std::string name; |
|
212 | 16 |
float velocity; |
17 |
float explosionRadius; |
|
18 |
int reloadTime; //in ms |
|
19 |
||
20 |
int clipSize; |
|
21 |
||
221 | 22 |
bool visible; |
23 |
TickCount age; |
|
24 |
int reloadTimer; |
|
212 | 25 |
|
221 | 26 |
public: |
27 |
Weapon (GameState &st, TickCount age, float velocity, float explosionRadius, int reloadTime, std::string name); |
|
28 |
Weapon (const Weapon& orig); |
|
29 |
Weapon& operator= (const Weapon& orig); |
|
30 |
||
31 |
// advance the reload timer |
|
32 |
void tickReload (TimeMS dt); |
|
33 |
||
34 |
// can the weapon be fired (not reloading, have a clip, etc) |
|
35 |
bool canShoot (void); |
|
36 |
||
223 | 37 |
// 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
|
38 |
std::string getName (void) { return name; } |
221 | 39 |
float getVelocity (void) { return velocity; } |
223 | 40 |
float getExplosionRadius (void) { return explosionRadius; } |
41 |
TickCount getExpireTicks (void) { return age; } |
|
42 |
||
43 |
// start reloading |
|
44 |
void reload (void); |
|
212 | 45 |
}; |
46 |
||
47 |
#endif |