-
Notifications
You must be signed in to change notification settings - Fork 0
/
weapon.hh
52 lines (33 loc) · 799 Bytes
/
weapon.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef WEAPON_HH
#define WEAPON_HH
#include <ClanLib/core.h>
#include "crosshair.hh"
#include "bullet.hh"
#include "bulletmanager.hh"
class Weapon
{
public:
explicit Weapon(size_t fireRate, size_t damage, CL_ResourceManager& rm) : fireRate(fireRate), damage(damage), rm(rm)
{}
//virtual destructor
~Weapon() {}
virtual bool reload(double dt) = 0;
virtual bool shoot(float x, float y, Crosshair* crosshair, double timeSinceLastShot) = 0;
virtual size_t getAmmo() const = 0;
virtual void addDamage(size_t amount) = 0;
virtual void draw(CL_GraphicContext gc, Crosshair* crosshair)
{}
size_t getFireRate() const
{
return fireRate;
}
size_t getDamage() const
{
return damage;
}
protected:
size_t fireRate;
size_t damage;
CL_ResourceManager rm;
};
#endif