1 | /*! |
---|
2 | \file world_entity.h |
---|
3 | \brief A base class for all objects in the world |
---|
4 | |
---|
5 | This is the base class of all objects in the game-world. If you want to have an object in the world, that can realy interact with other objects and that is also dispbayable etc. you have to extend this class and override the needed functions. |
---|
6 | */ |
---|
7 | |
---|
8 | |
---|
9 | |
---|
10 | #ifndef WORLD_ENTITY_H |
---|
11 | #define WORLD_ENTITY_H |
---|
12 | |
---|
13 | #include "data_tank.h" |
---|
14 | |
---|
15 | class Vector; |
---|
16 | class Ability; |
---|
17 | |
---|
18 | //! WorldEntity |
---|
19 | /** |
---|
20 | A base class for all objects in the world |
---|
21 | |
---|
22 | This is the base class of all objects in the game-world. If you want to have an object in the world, that can realy interact with other objects and that is also dispbayable etc. you have to extend this class and override the needed functions. |
---|
23 | */ |
---|
24 | class WorldEntity { |
---|
25 | |
---|
26 | public: |
---|
27 | WorldEntity (); |
---|
28 | ~WorldEntity (); |
---|
29 | |
---|
30 | |
---|
31 | void setPosition(Vector* position); |
---|
32 | Vector* getPosition(); |
---|
33 | void setOrientation(Vector* orientation); |
---|
34 | Vector* getOrientation(); |
---|
35 | void setSpawnPoint(Vector* place); |
---|
36 | void setSpeed(float speed); |
---|
37 | float getSpeed(); |
---|
38 | void setHealth(float health); |
---|
39 | float getHealth(); |
---|
40 | |
---|
41 | void addAbility(Ability* ability); |
---|
42 | void removeAbility(Ability* ability); |
---|
43 | |
---|
44 | virtual void tick(float dt); |
---|
45 | virtual void paint(); |
---|
46 | /* virtual void actionEvent(Event* event); */ |
---|
47 | virtual void collide(WorldEntity* we, Vector loc); |
---|
48 | virtual void hit(WorldEntity* weapon, Vector loc); |
---|
49 | virtual void destroy(); |
---|
50 | |
---|
51 | virtual void entityPreEnter(); |
---|
52 | virtual void entityPostEnter(); |
---|
53 | virtual void entityPreQuit(); |
---|
54 | virtual void entityPostQuit(); |
---|
55 | |
---|
56 | |
---|
57 | |
---|
58 | private: |
---|
59 | Vector* position; //!< position of the entity |
---|
60 | Vector* orientation; //!< orientation of the entity |
---|
61 | /* List of abilities */ |
---|
62 | float health; //!< health of the entity, if any |
---|
63 | float speed; //!< speed of the entity if any |
---|
64 | /* entity can be in the air or at ground: */ |
---|
65 | int airGround; //!< is it air or bound to the ground (ground=0, air=1) |
---|
66 | |
---|
67 | |
---|
68 | |
---|
69 | }; |
---|
70 | |
---|
71 | #endif |
---|