Made forceq to contain time again.
#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:
/**
* Reference to the world that we live in
*/
GameState &state;
/**
* Projectiles can be inivisble, e.g. for digging
*/
bool visible;
/**
* The projectile is diamond-shaped, and this is the dimanond's "radius"
*/
float radius;
/**
* The radius of earth removed by this projectile on impact
*/
float explosionRadius;
/**
* How many ticks this projectile lasts before being expiring
*/
TickCount expire;
/**
* The tick we were spawned at
*/
TickCount birth_tick;
public:
/**
* Construct a Projectile using the given parameters and add it to the world's list of projectiles
*/
Projectile (GameState &state, Vector position, Vector velocity, float explosionRadius, float radius,
TickCount expire, bool visible = true);
/**
* Like above, but using the parameters of the given weapon
*
* @see Projectile
*/
Projectile (GameState &state, Vector position, Vector velocity, Weapon *weapon, bool visible = true);
/**
* Removes this from the world's list of projectiles
*/
virtual ~Projectile (void);
/**
* Draw
*/
virtual void draw (Graphics *g, PixelCoordinate camera) const;
protected:
/**
* Initialize shape and add to world projectiles list
*/
void initialize (void);
/**
* 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 (Vector collisionPoint, PhysicsObject *other);
/**
* If we have expired, call onDestory and removeGround
*/
virtual void tick (TimeMS dt);
};
#endif