1 | |
---|
2 | /*! |
---|
3 | * @file helicopter.h |
---|
4 | * Implements the Control of a Helicopter |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef _HELICOPTER_H |
---|
8 | #define _HELICOPTER_H |
---|
9 | |
---|
10 | #include "playable.h" |
---|
11 | |
---|
12 | #include "sound_buffer.h" |
---|
13 | #include "sound_source.h" |
---|
14 | |
---|
15 | class Helicopter : public Playable |
---|
16 | { |
---|
17 | |
---|
18 | public: |
---|
19 | |
---|
20 | Helicopter(); |
---|
21 | Helicopter(const std::string& fileName); |
---|
22 | Helicopter(const TiXmlElement* root); |
---|
23 | virtual ~Helicopter(); |
---|
24 | |
---|
25 | virtual void loadParams(const TiXmlElement* root); |
---|
26 | virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f) {/* FIXME */}; |
---|
27 | |
---|
28 | virtual void enter(); |
---|
29 | virtual void leave(); |
---|
30 | |
---|
31 | virtual void postSpawn(); |
---|
32 | virtual void leftWorld(); |
---|
33 | |
---|
34 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
35 | virtual void tick(float time); |
---|
36 | virtual void draw() const; |
---|
37 | |
---|
38 | virtual void process(const Event &event); |
---|
39 | |
---|
40 | virtual void moveUp(bool move){bUp = move;}; |
---|
41 | |
---|
42 | |
---|
43 | |
---|
44 | private: |
---|
45 | void init(); |
---|
46 | void calculateVelocity(float time); |
---|
47 | |
---|
48 | bool bUp; //!< up button pressed. |
---|
49 | bool bDown; //!< down button pressed. |
---|
50 | bool bLeft; //!< left button pressed. |
---|
51 | bool bRight; //!< right button pressed. |
---|
52 | bool bAscend; //!< ascend button pressed. |
---|
53 | bool bDescend; //!< descend button presses. |
---|
54 | bool bFire; //!< fire button pressed. |
---|
55 | bool bRollL; //!< rolling button pressed (left) |
---|
56 | bool bRollR; //!< rolling button pressed (right) |
---|
57 | |
---|
58 | float xMouse; //!< mouse moved in x-Direction |
---|
59 | float yMouse; //!< mouse moved in y-Direction |
---|
60 | int yInvert; |
---|
61 | float mouseSensitivity; //!< the mouse sensitivity |
---|
62 | int controlVelocityX; //!< defines max velocity of Xaxis of mousecontrol |
---|
63 | int controlVelocityY; //!< defines max velocity of Yaxis of mousecontrol |
---|
64 | |
---|
65 | PNode topRotor; //!< the position of the toprotor |
---|
66 | PNode tailRotor; //!< the position of the tailrotor |
---|
67 | |
---|
68 | PNode cameraNode; //!< the position the camera is locked at (used to look up and down without turning the helicopter) |
---|
69 | |
---|
70 | Vector velocity; //!< the velocity of the player. |
---|
71 | Vector velocityDir; //!< the direction of the velocity of the spaceship |
---|
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 | OrxSound::SoundSource soundSource; |
---|
78 | OrxSound::SoundBuffer*chopperBuffer; |
---|
79 | |
---|
80 | }; |
---|
81 | |
---|
82 | //CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER, |
---|
83 | // addMethod("moveUp", ExecutorLua1<Object,bool>(&Helicopter::moveUp)) |
---|
84 | // ); |
---|
85 | |
---|
86 | |
---|
87 | #endif /* _HELICOPTERS_H */ |
---|