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 | |
---|
47 | private: |
---|
48 | |
---|
49 | void calculateVelocity(float time); |
---|
50 | void weaponAction(); |
---|
51 | |
---|
52 | // !! temporary !! |
---|
53 | void ADDWEAPON(); |
---|
54 | |
---|
55 | bool bUp; //!< up button pressed. |
---|
56 | bool bDown; //!< down button pressed. |
---|
57 | bool bLeft; //!< left button pressed. |
---|
58 | bool bRight; //!< right button pressed. |
---|
59 | bool bAscend; //!< ascend button pressed. |
---|
60 | bool bDescend; //!< descend button presses. |
---|
61 | bool bFire; //!< fire button pressed. |
---|
62 | bool bRollL; //!< rolling button pressed (left) |
---|
63 | bool bRollR; //!< rolling button pressed (right) |
---|
64 | |
---|
65 | float xMouse; //!< mouse moved in x-Direction |
---|
66 | float yMouse; //!< mouse moved in y-Direction |
---|
67 | float mouseSensitivity; //!< the mouse sensitivity |
---|
68 | float cycle; //!< hovercycle |
---|
69 | |
---|
70 | Vector velocity; //!< the velocity of the player. |
---|
71 | Quaternion mouseDir; //!< the direction where the player wants to fly |
---|
72 | Quaternion rotQuat; |
---|
73 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
74 | float acceleration; //!< the acceleration of the player. |
---|
75 | |
---|
76 | float airViscosity; |
---|
77 | |
---|
78 | }; |
---|
79 | |
---|
80 | #endif /* _SPACE_SHIPS_H */ |
---|