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