| author | terom |
| Mon, 08 Dec 2008 00:16:43 +0000 | |
| changeset 274 | c35307e8645c |
| parent 271 | bf6784a95b08 |
| child 279 | e36f5e1a1c8d |
| permissions | -rw-r--r-- |
| 212 | 1 |
#include "Weapon.hh" |
2 |
||
|
271
bf6784a95b08
touch up weapon/projectile with comments and slight tweaking
terom
parents:
263
diff
changeset
|
3 |
Weapon::Weapon(WeaponID id, TickCount expire, float velocity, float recoil, float explosionRadius, float radius, |
|
bf6784a95b08
touch up weapon/projectile with comments and slight tweaking
terom
parents:
263
diff
changeset
|
4 |
TimeMS reloadTime, std::string name) : |
|
bf6784a95b08
touch up weapon/projectile with comments and slight tweaking
terom
parents:
263
diff
changeset
|
5 |
id(id), expire(expire), velocity(velocity), recoil(recoil), explosionRadius(explosionRadius), radius(radius), |
|
bf6784a95b08
touch up weapon/projectile with comments and slight tweaking
terom
parents:
263
diff
changeset
|
6 |
reloadTime(reloadTime), name(name), reloadTimer(0) |
| 221 | 7 |
{
|
8 |
||
| 212 | 9 |
} |
10 |
||
| 221 | 11 |
void Weapon::tickReload (TimeMS dt) {
|
12 |
reloadTimer -= dt; |
|
|
271
bf6784a95b08
touch up weapon/projectile with comments and slight tweaking
terom
parents:
263
diff
changeset
|
13 |
|
| 221 | 14 |
if (reloadTimer < 0) |
15 |
reloadTimer = 0; |
|
16 |
} |
|
17 |
||
|
271
bf6784a95b08
touch up weapon/projectile with comments and slight tweaking
terom
parents:
263
diff
changeset
|
18 |
bool Weapon::canShoot() const {
|
| 221 | 19 |
return (reloadTimer == 0); |
20 |
} |
|
21 |
||
| 223 | 22 |
void Weapon::reload (void) {
|
| 221 | 23 |
// set the reload timer |
24 |
reloadTimer = reloadTime; |
|
25 |
} |
|
26 |