1 | /*! |
---|
2 | * @file space_ship.h |
---|
3 | * Implements the Control of a Spaceship |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _SPACE_SHIP_H |
---|
7 | #define _SPACE_SHIP_H |
---|
8 | |
---|
9 | #include "playable.h" |
---|
10 | #include "extendable.h" |
---|
11 | |
---|
12 | |
---|
13 | template<class T> class tList; |
---|
14 | class Vector; |
---|
15 | class Event; |
---|
16 | |
---|
17 | class SpaceShip : public Playable, public Extendable |
---|
18 | { |
---|
19 | |
---|
20 | public: |
---|
21 | |
---|
22 | SpaceShip(); |
---|
23 | SpaceShip(const char* fileName); |
---|
24 | SpaceShip(const TiXmlElement* root); |
---|
25 | virtual ~SpaceShip(); |
---|
26 | |
---|
27 | void init(); |
---|
28 | void loadParams(const TiXmlElement* root); |
---|
29 | |
---|
30 | virtual void enter(); |
---|
31 | virtual void leave(); |
---|
32 | |
---|
33 | void addWeapon(Weapon* weapon ); |
---|
34 | void removeWeapon(Weapon* weapon); |
---|
35 | |
---|
36 | virtual void postSpawn(); |
---|
37 | virtual void leftWorld(); |
---|
38 | |
---|
39 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
40 | virtual void tick(float time); |
---|
41 | virtual void draw() const; |
---|
42 | |
---|
43 | virtual void process(const Event &event); |
---|
44 | bool pickup(PowerUp* powerUp); |
---|
45 | |
---|
46 | virtual int writeBytes(const byte* data, int length, int sender); |
---|
47 | virtual int readBytes(byte* data, int maxLength, int * reciever); |
---|
48 | |
---|
49 | |
---|
50 | private: |
---|
51 | |
---|
52 | void calculateVelocity(float time); |
---|
53 | void weaponAction(); |
---|
54 | |
---|
55 | // !! temporary !! |
---|
56 | void ADDWEAPON(); |
---|
57 | |
---|
58 | bool bUp; //!< up button pressed. |
---|
59 | bool bDown; //!< down button pressed. |
---|
60 | bool bLeft; //!< left button pressed. |
---|
61 | bool bRight; //!< right button pressed. |
---|
62 | bool bAscend; //!< ascend button pressed. |
---|
63 | bool bDescend; //!< descend button presses. |
---|
64 | bool bFire; //!< fire button pressed. |
---|
65 | bool bRollL; //!< rolling button pressed (left) |
---|
66 | bool bRollR; //!< rolling button pressed (right) |
---|
67 | |
---|
68 | float xMouse; //!< mouse moved in x-Direction |
---|
69 | float yMouse; //!< mouse moved in y-Direction |
---|
70 | float mouseSensitivity; //!< the mouse sensitivity |
---|
71 | float cycle; //!< hovercycle |
---|
72 | |
---|
73 | Vector velocity; //!< the velocity of the player. |
---|
74 | Quaternion mouseDir; //!< the direction where the player wants to fly |
---|
75 | Quaternion rotQuat; |
---|
76 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
77 | float acceleration; //!< the acceleration of the player. |
---|
78 | |
---|
79 | float airViscosity; |
---|
80 | |
---|
81 | }; |
---|
82 | |
---|
83 | #endif /* _SPACE_SHIPS_H */ |
---|