1 | /*! |
---|
2 | \file player.h |
---|
3 | \brief Implements a basic controllable WorldEntity |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _PLAYER_H |
---|
7 | #define _PLAYER_H |
---|
8 | |
---|
9 | #include "world_entity.h" |
---|
10 | #include "physics_interface.h" |
---|
11 | |
---|
12 | template<class T> class tList; |
---|
13 | class Weapon; |
---|
14 | class WeaponManager; |
---|
15 | class Vector; |
---|
16 | class World; |
---|
17 | |
---|
18 | //! Basic controllable WorldEntity |
---|
19 | class Player : public WorldEntity, public PhysicsInterface |
---|
20 | { |
---|
21 | friend class World; |
---|
22 | |
---|
23 | public: |
---|
24 | Player(); |
---|
25 | Player(const TiXmlElement* root); |
---|
26 | virtual ~Player(); |
---|
27 | |
---|
28 | void addWeapon(Weapon* weapon); |
---|
29 | void removeWeapon(Weapon* weapon); |
---|
30 | |
---|
31 | virtual void postSpawn(); |
---|
32 | virtual void leftWorld(); |
---|
33 | virtual void hit(WorldEntity* weapon, Vector* loc); |
---|
34 | virtual void collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags); |
---|
35 | |
---|
36 | virtual void tick(float time); |
---|
37 | virtual void draw(); |
---|
38 | |
---|
39 | virtual void command(Command* cmd); |
---|
40 | |
---|
41 | private: |
---|
42 | bool bUp; //!< up button pressed. |
---|
43 | bool bDown; //!< down button pressed. |
---|
44 | bool bLeft; //!< left button pressed. |
---|
45 | bool bRight; //!< right button pressed. |
---|
46 | bool bAscend; //!< ascend button pressed. |
---|
47 | bool bDescend; //!< descend button presses. |
---|
48 | bool bFire; //!< fire button pressed. |
---|
49 | bool bWeaponChange; //!< weapon change button pressed |
---|
50 | |
---|
51 | tList<Weapon>* weapons;//!< a list of weapon |
---|
52 | Weapon* activeWeapon; //!< the weapon that is currenty activated |
---|
53 | Weapon* activeWeaponL; //temporary -- FIX THIS |
---|
54 | WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping |
---|
55 | |
---|
56 | World* myWorld; //!< reference to the world object |
---|
57 | |
---|
58 | Vector* velocity; //!< the velocity of the player. |
---|
59 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
60 | float acceleration; //!< the acceleration of the player. |
---|
61 | |
---|
62 | void move(float time); |
---|
63 | void weapon(void); |
---|
64 | |
---|
65 | }; |
---|
66 | |
---|
67 | #endif /* _PLAYER_H */ |
---|