src/Weapon.hh
author saiam
Sun, 07 Dec 2008 19:54:00 +0000
changeset 253 747b1037d83e
parent 251 6a6208e5c7a1
child 258 833ad8d7db8b
permissions -rw-r--r--
Added recoil to weapon constructor. Recoil still not used.
#ifndef WEAPON_HH
#define WEAPON_HH

// forward-declare
class Weapon;

#include "GameState.hh"
#include "Projectile.hh"
#include "Timer.hh"
#include <string>

class Weapon {
protected:
    std::string name;
    float velocity;
    float explosionRadius;
    int reloadTime; //in ms
    float recoil;

    int clipSize;

    bool visible;
    TickCount age;
    int reloadTimer;

public:
    Weapon (TickCount age, float velocity, float recoil, float explosionRadius, int reloadTime, std::string name);
    
    // advance the reload timer
    void tickReload (TimeMS dt);
    
    // can the weapon be fired (not reloading, have a clip, etc)
    bool canShoot (void);
    
    // get weapon parameters
    std::string getName (void) { return name; }
    float getSpeed (void) { return velocity; }
    float getExplosionRadius (void) { return explosionRadius; }
    TickCount getExpireTicks (void) { return age; }
    
    // start reloading
    void reload (void);
};

#endif