[4780] | 1 | /*! |
---|
[4885] | 2 | * @file player.h |
---|
| 3 | * Implements a basic controllable WorldEntity |
---|
[4818] | 4 | */ |
---|
[3471] | 5 | |
---|
| 6 | #ifndef _PLAYER_H |
---|
| 7 | #define _PLAYER_H |
---|
| 8 | |
---|
| 9 | #include "world_entity.h" |
---|
[4382] | 10 | #include "physics_interface.h" |
---|
[4404] | 11 | #include "event_listener.h" |
---|
[3471] | 12 | |
---|
[3583] | 13 | template<class T> class tList; |
---|
| 14 | class Weapon; |
---|
[3873] | 15 | class WeaponManager; |
---|
[3608] | 16 | class Vector; |
---|
[4404] | 17 | class Event; |
---|
[3471] | 18 | |
---|
| 19 | //! Basic controllable WorldEntity |
---|
[4885] | 20 | /** |
---|
| 21 | * this is the debug player - actualy we would have to make a new |
---|
| 22 | class derivated from Player for each player. for now, we just use |
---|
| 23 | the player.cc for debug also |
---|
| 24 | */ |
---|
[5257] | 25 | class Player : public WorldEntity, public EventListener |
---|
[3471] | 26 | { |
---|
| 27 | friend class World; |
---|
[4780] | 28 | |
---|
[4818] | 29 | public: |
---|
| 30 | Player(); |
---|
[4975] | 31 | Player(const char* fileName); |
---|
[4818] | 32 | Player(const TiXmlElement* root); |
---|
| 33 | virtual ~Player(); |
---|
[3583] | 34 | |
---|
[4818] | 35 | void init(); |
---|
| 36 | void loadParams(const TiXmlElement* root); |
---|
[4780] | 37 | |
---|
[4818] | 38 | void addWeapon(Weapon* weapon); |
---|
| 39 | void removeWeapon(Weapon* weapon); |
---|
[4780] | 40 | |
---|
[4818] | 41 | virtual void postSpawn(); |
---|
| 42 | virtual void leftWorld(); |
---|
[3583] | 43 | |
---|
[5435] | 44 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
[4818] | 45 | virtual void tick(float time); |
---|
| 46 | virtual void draw(); |
---|
[3583] | 47 | |
---|
[4818] | 48 | virtual void process(const Event &event); |
---|
[4780] | 49 | |
---|
[3471] | 50 | |
---|
[4818] | 51 | private: |
---|
| 52 | void move(float time); |
---|
[4885] | 53 | void weaponAction(); |
---|
[3755] | 54 | |
---|
[5435] | 55 | // !! temporary !! |
---|
| 56 | void ADDWEAPON(); |
---|
[3583] | 57 | |
---|
[4818] | 58 | private: |
---|
[4885] | 59 | bool bUp; //!< up button pressed. |
---|
| 60 | bool bDown; //!< down button pressed. |
---|
| 61 | bool bLeft; //!< left button pressed. |
---|
| 62 | bool bRight; //!< right button pressed. |
---|
| 63 | bool bAscend; //!< ascend button pressed. |
---|
| 64 | bool bDescend; //!< descend button presses. |
---|
| 65 | bool bFire; //!< fire button pressed. |
---|
[4780] | 66 | |
---|
[4885] | 67 | WeaponManager* weaponMan; //!< the weapon manager: managing a list of weapon to wepaon-slot mapping |
---|
[4780] | 68 | |
---|
[5212] | 69 | Vector velocity; //!< the velocity of the player. |
---|
[4885] | 70 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
| 71 | float acceleration; //!< the acceleration of the player. |
---|
[3471] | 72 | }; |
---|
| 73 | |
---|
| 74 | #endif /* _PLAYER_H */ |
---|