1 | /*! |
---|
2 | * @file track.h |
---|
3 | */ |
---|
4 | |
---|
5 | #ifndef _TRACK_H_ |
---|
6 | #define _TRACK_H_ |
---|
7 | |
---|
8 | #include "curve.h" |
---|
9 | #include "base_object.h" |
---|
10 | |
---|
11 | // Forward Definition |
---|
12 | class PNode; |
---|
13 | class TiXmlElement; |
---|
14 | class ActionBox; |
---|
15 | |
---|
16 | class Track : public BaseObject |
---|
17 | { |
---|
18 | ObjectListDeclaration(Track); |
---|
19 | |
---|
20 | public: |
---|
21 | Track(); |
---|
22 | Track(const TiXmlElement* root); |
---|
23 | virtual ~Track(); |
---|
24 | |
---|
25 | virtual void loadParams(const TiXmlElement* root); |
---|
26 | void addPoint(float x, float y, float z); |
---|
27 | void addPointV(Vector newPoint); |
---|
28 | void setSpeed(float speed); |
---|
29 | void setMode(int newMode); |
---|
30 | void pauseTrack(bool stop); |
---|
31 | |
---|
32 | //void finalize(); |
---|
33 | inline Vector calcPos() const; |
---|
34 | inline Vector calcDir() const; |
---|
35 | void tick(float dt); |
---|
36 | |
---|
37 | PNode* getTrackNode(); |
---|
38 | |
---|
39 | void drawGraph(float dt = 0.01) const; |
---|
40 | |
---|
41 | //float startingTime; //!< The time at which this Track begins. |
---|
42 | float speed; |
---|
43 | float duration; //!< The time used to cross this Track (curve). |
---|
44 | float endTime; //!< The time at which this Track ends. |
---|
45 | float width; //!< The width of the action box, next to the player. |
---|
46 | float height; //!< The Height of the action box, next to the player |
---|
47 | float depth; //!< Depth of the action box |
---|
48 | float stretch; //!< multiplyer between w/h at player and w/h at far end of the action box |
---|
49 | |
---|
50 | int nodeCount; //!< The count of points this Track has. |
---|
51 | Curve* curve; //!< The Curve of this Track |
---|
52 | |
---|
53 | ActionBox* getActionBox(){ return this->actionBox; } |
---|
54 | |
---|
55 | private: |
---|
56 | void init(); |
---|
57 | |
---|
58 | private: |
---|
59 | CurveType curveType; //!< The CurveType the entire TrackSystem will have. |
---|
60 | float localTime; //!< The time that has been passed since the traveling the Track. |
---|
61 | PNode* trackNode; //!< The node that is slave to the Track. This node will be moved while update the Track, and must NOT move itself. |
---|
62 | int mode; //!< Defines the behaviour of the Track. |
---|
63 | bool pause; //!< Defines if the track runs (false) or not (true) |
---|
64 | |
---|
65 | ActionBox* actionBox; |
---|
66 | |
---|
67 | void addActionBox( float width_2, float height_2, float depth, float stretch ); |
---|
68 | |
---|
69 | |
---|
70 | }; |
---|
71 | |
---|
72 | #endif /* _TRACK_H */ |
---|