src/Weapon.hh
author terom
Sun, 07 Dec 2008 20:07:28 +0000
changeset 255 99431fdb0dc8
parent 253 747b1037d83e
child 258 833ad8d7db8b
permissions -rw-r--r--
add PixelDimension/PixelCoordinate types, convert Terrain to use them, and convert/clean up drawing code
#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