[10084] | 1 | /*! |
---|
| 2 | * @file track.h |
---|
| 3 | */ |
---|
[10088] | 4 | |
---|
[10084] | 5 | #ifndef _TRACK_H_ |
---|
| 6 | #define _TRACK_H_ |
---|
| 7 | |
---|
| 8 | #include "curve.h" |
---|
| 9 | #include "base_object.h" |
---|
| 10 | |
---|
[10085] | 11 | // Forward Definition |
---|
| 12 | class PNode; |
---|
| 13 | class TiXmlElement; |
---|
[10698] | 14 | class ActionBox; |
---|
[10085] | 15 | |
---|
[10084] | 16 | class Track : public BaseObject |
---|
| 17 | { |
---|
[10088] | 18 | ObjectListDeclaration(Track); |
---|
| 19 | |
---|
[10085] | 20 | public: |
---|
[10088] | 21 | Track(); |
---|
| 22 | Track(const TiXmlElement* root); |
---|
| 23 | virtual ~Track(); |
---|
| 24 | |
---|
[10091] | 25 | virtual void loadParams(const TiXmlElement* root); |
---|
| 26 | void addPoint(float x, float y, float z); |
---|
[10284] | 27 | void addPointV(Vector newPoint); |
---|
[10297] | 28 | void setSpeed(float speed); |
---|
[10385] | 29 | void setMode(int newMode); |
---|
[10498] | 30 | void pauseTrack(bool stop); |
---|
[10088] | 31 | |
---|
[10284] | 32 | //void finalize(); |
---|
[10091] | 33 | inline Vector calcPos() const; |
---|
| 34 | inline Vector calcDir() const; |
---|
| 35 | void tick(float dt); |
---|
[10088] | 36 | |
---|
[10091] | 37 | PNode* getTrackNode(); |
---|
[10410] | 38 | |
---|
| 39 | void drawGraph(float dt = 0.01) const; |
---|
| 40 | |
---|
[10096] | 41 | //float startingTime; //!< The time at which this Track begins. |
---|
[10454] | 42 | float speed; |
---|
[10091] | 43 | float duration; //!< The time used to cross this Track (curve). |
---|
| 44 | float endTime; //!< The time at which this Track ends. |
---|
[10698] | 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 |
---|
[10088] | 49 | |
---|
[10091] | 50 | int nodeCount; //!< The count of points this Track has. |
---|
| 51 | Curve* curve; //!< The Curve of this Track |
---|
[10698] | 52 | |
---|
| 53 | ActionBox* getActionBox(){ return this->actionBox; } |
---|
[10088] | 54 | |
---|
[10091] | 55 | private: |
---|
| 56 | void init(); |
---|
[10698] | 57 | |
---|
[10085] | 58 | private: |
---|
[10091] | 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. |
---|
[10385] | 62 | int mode; //!< Defines the behaviour of the Track. |
---|
[10498] | 63 | bool pause; //!< Defines if the track runs (false) or not (true) |
---|
[10698] | 64 | |
---|
| 65 | ActionBox* actionBox; |
---|
| 66 | |
---|
| 67 | void addActionBox( float width_2, float height_2, float depth, float stretch ); |
---|
| 68 | |
---|
| 69 | |
---|
[10085] | 70 | }; |
---|
| 71 | |
---|
| 72 | #endif /* _TRACK_H */ |
---|