src/Projectile.hh
author terom
Sat, 06 Dec 2008 22:47:08 +0000
changeset 233 ff4ecea83cf5
parent 224 e6faefba2ec1
child 248 e40ef56dc62c
permissions -rw-r--r--
start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
#ifndef PROJECTILE_HH
#define PROJECTILE_HH
 
class Projectile;

#include "GameState.hh"
#include "PhysicsObject.hh"
#include "Timer.hh"
#include "GraphicsPointer.hh"

class Projectile : public PhysicsObject {
protected:
    GameState &state;
    bool visible;
    bool target_visible;
    float radius;

public:
    TickCount birth_tick;
    TickCount age;

    Projectile (GameState &state, Vector position, Vector velocity, bool visible, float radius, TickCount age=1000000000);
    virtual ~Projectile (void);

    virtual void draw (Graphics *g) const;

protected:
    /*
     * Removes ground at given position if applicable, and destroys this PhysicsObject.
     *
     * This is overriden by Network.
     */
    virtual void onDestroy (Vector position, bool removeGround);
    
    /*
     * Call onDestroy, removingGround
     */
    virtual void onCollision (void);

    /*
     * If we have expired, call onDestory without removingGround
     */
    virtual void tick (TimeMS dt);
};
 
#endif