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