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 | void addWeapon(Weapon* weapon ); |
---|
30 | void removeWeapon(Weapon* weapon); |
---|
31 | |
---|
32 | virtual void postSpawn(); |
---|
33 | virtual void leftWorld(); |
---|
34 | |
---|
35 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
36 | virtual void tick(float time); |
---|
37 | virtual void draw() const; |
---|
38 | |
---|
39 | virtual void process(const Event &event); |
---|
40 | |
---|
41 | |
---|
42 | |
---|
43 | private: |
---|
44 | |
---|
45 | void calculateVelocity(float time); |
---|
46 | void weaponAction(); |
---|
47 | |
---|
48 | // !! temporary !! |
---|
49 | void ADDWEAPON(); |
---|
50 | |
---|
51 | bool bUp; //!< up button pressed. |
---|
52 | bool bDown; //!< down button pressed. |
---|
53 | bool bLeft; //!< left button pressed. |
---|
54 | bool bRight; //!< right button pressed. |
---|
55 | bool bAscend; //!< ascend button pressed. |
---|
56 | bool bDescend; //!< descend button presses. |
---|
57 | bool bFire; //!< fire button pressed. |
---|
58 | bool bRollL; //!< rolling button pressed (left) |
---|
59 | bool bRollR; //!< rolling button pressed (right) |
---|
60 | |
---|
61 | float xMouse; //!< mouse moved in x-Direction |
---|
62 | float yMouse; //!< mouse moved in y-Direction |
---|
63 | float mouseSensitivity; //!< the mouse sensitivity |
---|
64 | float cycle; //!< hovercycle |
---|
65 | |
---|
66 | Vector velocity; //!< the velocity of the player. |
---|
67 | Quaternion mouseDir; //!< the direction where the player wants to fly |
---|
68 | Quaternion rotQuat; |
---|
69 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
70 | float acceleration; //!< the acceleration of the player. |
---|
71 | |
---|
72 | float airViscosity; |
---|
73 | |
---|
74 | }; |
---|
75 | |
---|
76 | #endif /* _SPACE_SHIPS_H */ |
---|