| author | ekku |
| Sun, 07 Dec 2008 18:21:44 +0000 | |
| changeset 247 | b87f68be579f |
| parent 233 | ff4ecea83cf5 |
| child 248 | e40ef56dc62c |
| permissions | -rw-r--r-- |
| 197 | 1 |
#ifndef PROJECTILE_HH |
2 |
#define PROJECTILE_HH |
|
3 |
||
| 201 | 4 |
class Projectile; |
| 197 | 5 |
|
|
222
293ddf4c067d
reorganize PhysicsObject/Player/Projectile lists so that PhysicsObject doesn't need to know about its subclasses anymore, and PhysicsWorld doesn't need to know about GameState
ekku
parents:
211
diff
changeset
|
6 |
#include "GameState.hh" |
| 197 | 7 |
#include "PhysicsObject.hh" |
| 208 | 8 |
#include "Timer.hh" |
|
233
ff4ecea83cf5
start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
terom
parents:
224
diff
changeset
|
9 |
#include "GraphicsPointer.hh" |
| 197 | 10 |
|
| 201 | 11 |
class Projectile : public PhysicsObject {
|
| 197 | 12 |
protected: |
13 |
GameState &state; |
|
14 |
bool visible; |
|
15 |
bool target_visible; |
|
| 208 | 16 |
float radius; |
| 223 | 17 |
|
| 197 | 18 |
public: |
| 208 | 19 |
TickCount birth_tick; |
20 |
TickCount age; |
|
21 |
||
| 223 | 22 |
Projectile (GameState &state, Vector position, Vector velocity, bool visible, float radius, TickCount age=1000000000); |
|
222
293ddf4c067d
reorganize PhysicsObject/Player/Projectile lists so that PhysicsObject doesn't need to know about its subclasses anymore, and PhysicsWorld doesn't need to know about GameState
ekku
parents:
211
diff
changeset
|
23 |
virtual ~Projectile (void); |
| 197 | 24 |
|
|
233
ff4ecea83cf5
start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
terom
parents:
224
diff
changeset
|
25 |
virtual void draw (Graphics *g) const; |
|
222
293ddf4c067d
reorganize PhysicsObject/Player/Projectile lists so that PhysicsObject doesn't need to know about its subclasses anymore, and PhysicsWorld doesn't need to know about GameState
ekku
parents:
211
diff
changeset
|
26 |
|
|
293ddf4c067d
reorganize PhysicsObject/Player/Projectile lists so that PhysicsObject doesn't need to know about its subclasses anymore, and PhysicsWorld doesn't need to know about GameState
ekku
parents:
211
diff
changeset
|
27 |
protected: |
|
224
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
28 |
/* |
|
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
29 |
* Removes ground at given position if applicable, and destroys this PhysicsObject. |
|
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
30 |
* |
|
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
31 |
* This is overriden by Network. |
|
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
32 |
*/ |
|
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
33 |
virtual void onDestroy (Vector position, bool removeGround); |
|
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
34 |
|
|
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
35 |
/* |
|
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
36 |
* Call onDestroy, removingGround |
|
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
37 |
*/ |
|
222
293ddf4c067d
reorganize PhysicsObject/Player/Projectile lists so that PhysicsObject doesn't need to know about its subclasses anymore, and PhysicsWorld doesn't need to know about GameState
ekku
parents:
211
diff
changeset
|
38 |
virtual void onCollision (void); |
|
224
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
39 |
|
|
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
40 |
/* |
|
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
41 |
* If we have expired, call onDestory without removingGround |
|
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
42 |
*/ |
|
222
293ddf4c067d
reorganize PhysicsObject/Player/Projectile lists so that PhysicsObject doesn't need to know about its subclasses anymore, and PhysicsWorld doesn't need to know about GameState
ekku
parents:
211
diff
changeset
|
43 |
virtual void tick (TimeMS dt); |
| 197 | 44 |
}; |
45 |
||
46 |
#endif |