1 | |
---|
2 | /*! |
---|
3 | * @file spacecraft_2d.h |
---|
4 | * Implements the Control of a Spacecraft2D |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef _SPACECRAFT_2D_H |
---|
8 | #define _SPACECRAFT_2D_H |
---|
9 | |
---|
10 | #include "playable.h" |
---|
11 | |
---|
12 | // Forward Declaration |
---|
13 | class ParticleEmitter; |
---|
14 | class ParticleSystem; |
---|
15 | |
---|
16 | class Spacecraft2D : public Playable |
---|
17 | { |
---|
18 | public: |
---|
19 | Spacecraft2D(const std::string& fileName); |
---|
20 | Spacecraft2D(const TiXmlElement* root = NULL); |
---|
21 | virtual ~Spacecraft2D(); |
---|
22 | |
---|
23 | virtual void loadParams(const TiXmlElement* root); |
---|
24 | virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f); |
---|
25 | void setTravelDirecton(const Quaternion& rot, float speed = 0.0); |
---|
26 | void setTravelSpeed(float travelSpeed); |
---|
27 | |
---|
28 | virtual void enter(); |
---|
29 | virtual void leave(); |
---|
30 | |
---|
31 | |
---|
32 | |
---|
33 | virtual void postSpawn(); |
---|
34 | virtual void leftWorld(); |
---|
35 | |
---|
36 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
37 | virtual void tick(float dt); |
---|
38 | virtual void draw() const; |
---|
39 | |
---|
40 | virtual void process(const Event &event); |
---|
41 | |
---|
42 | private: |
---|
43 | void init(); |
---|
44 | void movement(float dt); |
---|
45 | |
---|
46 | private: |
---|
47 | bool bForward; //!< forward button pressed. |
---|
48 | bool bBackward; //!< backward button pressed. |
---|
49 | bool bLeft; //!< left button pressed. |
---|
50 | bool bRight; //!< right button pressed. |
---|
51 | |
---|
52 | int yInvert; |
---|
53 | float mouseSensitivity; //!< the mouse sensitivity |
---|
54 | |
---|
55 | |
---|
56 | |
---|
57 | PNode travelNode; |
---|
58 | float travelSpeed; |
---|
59 | |
---|
60 | float cameraLook; |
---|
61 | float rotation; |
---|
62 | |
---|
63 | // Vector velocity; //!< the velocity of the Spacecraft2D. |
---|
64 | Quaternion direction; //!< the direction of the Spacecraft2D. |
---|
65 | float acceleration; //!< the acceleration of the Spacecraft2D. |
---|
66 | float maxSpeed; //!< The Maximal speed of the Spacecraft2D. |
---|
67 | |
---|
68 | float altitude; //!< The height in the Entity. |
---|
69 | |
---|
70 | ParticleEmitter* burstEmitter; |
---|
71 | ParticleSystem* burstSystem; |
---|
72 | }; |
---|
73 | |
---|
74 | #endif /* _SPACECRAFT_2DS_H */ |
---|