1 | |
---|
2 | /*! |
---|
3 | * @file space_ship.h |
---|
4 | * Implements the Control of a Spaceship |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef _SPACE_SHIP_H |
---|
8 | #define _SPACE_SHIP_H |
---|
9 | |
---|
10 | #include "playable.h" |
---|
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 | Vector velocityDir; //!< the direction of the velocity of the spaceship |
---|
68 | float travelSpeed; //!< the current speed of the player (to make soft movement) |
---|
69 | float acceleration; //!< the acceleration of the player. |
---|
70 | |
---|
71 | }; |
---|
72 | |
---|
73 | #endif /* _SPACE_SHIPS_H */ |
---|