Changeset 3681 in orxonox.OLD for orxonox/branches/textEngine/src/track_manager.h
- Timestamp:
- Mar 30, 2005, 9:02:23 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/textEngine/src/track_manager.h
r3433 r3681 12 12 #define _TRACK_MANAGER_H 13 13 14 #include "stdincl.h" 14 #include "curve.h" 15 #include "base_object.h" 15 16 16 17 class PNode; 18 template<class T> class tList; 17 19 18 // ! condition for choosing a certain Path. \todo implement a useful way.19 struct PathCondition 20 { 21 22 }; 23 20 // Static Definitions 21 22 //! The Default Curve-Type to set for the whole path (if not chosen otherwise). 23 #define TMAN_DEFAULT_CURVETYPE BEZIERCURVE 24 #define TMAN_DEFAULT_DURATION 10 25 #define TMAN_DEFAULT_WIDTH 10 24 26 25 27 //! A Graph-Element, that holds the curve-structure of a Level. … … 35 37 36 38 TrackElement* findByID(unsigned int trackID); 39 bool backLoopCheck(TrackElement* trackElem); 37 40 41 TrackElement* getChild(int childNumber); 42 void setName(const char* name); 43 char* getName(void) const; 44 45 // atributes 38 46 bool isFresh; //!< If no Points where added until now 39 47 bool isHotPoint; //!< If the first node is a specialPoint; … … 42 50 bool isJoined; //!< If the End of the Curve is joined. 43 51 bool mainJoin; //!< If the End of the Curve is joined, and this is the one Curve the others join to. 44 PathCondition cond; //!< The Split Condition;45 52 int ID; //!< The ID of this TrackElement 46 53 float startingTime; //!< The time at which this Track begins. … … 48 55 float endTime; //!< The time at which this Track ends. 49 56 float jumpTime; //!< The Time this Track has to jump to its preceding Track (only >0 if Track isJoined==true) 50 CurveType curveType; //!< The CurveType this will have.57 float width; //!< Th width of the Path. This tells the Player(s), how far he(they) can go to the left/right. 51 58 int nodeCount; //!< The count of points this TrackElement has. 52 char* name; //!< A name for the Trac.53 59 Curve* curve; //!< The Curve of this TrackElement 54 60 int childCount; //!< The number of Children This TrackElement has. 55 TrackElement** children; //!< A TrackElement can have a Tree of following TrackElements. 61 tList<TrackElement>* children; //!< A TrackElement can have a Tree of following TrackElements. 62 63 64 // runtime 65 TrackElement* history; //!< a pointer to the last TrackElement we were on. This is if you want to walk the path backwards again. 66 67 void debug(void); 68 69 // CONDITION FUNCTIONS and STUFF 70 void* subject; //!< The Subject the Condition should act upon. 71 int (TrackElement::*condFunc)(void*); //!< Pointer to the condition function 72 73 int lowest(void* nothing); 74 int highest(void* nothing); 75 int random(void* nothing); 76 77 int leftRight(void* node); 78 int nearest(void* node); 79 // todo int enemyKilled(void* entity); 80 81 private: 82 char* name; //!< A name for the Trac. 83 56 84 }; 57 85 58 86 //! the Condition to choose between the different ways of the game. 87 enum CONDITION {LOWEST, HIGHEST, RANDOM, LEFTRIGHT, NEAREST, ENEMYKILLED}; 59 88 60 89 //! The TrackManager handles the flow of the Players through the game. … … 98 127 TrackManager(void); 99 128 100 static TrackManager* singletonRef; //!< There may only be one TrackManager existing. 129 static TrackManager* singletonRef; //!< There may only be one TrackManager. 130 101 131 TrackElement* firstTrackElem; //!< The first TrackElement that exists. 102 132 TrackElement* currentTrackElem; //!< The TrackElement we are working on. 133 CurveType curveType; //!< The CurveType the entire TrackSystem will have. 103 134 float localTime; //!< The time that has been passed since the traveling the Track. 104 135 float maxTime; //!< The maximal time the track has. 105 136 int trackElemCount; //!< The count of TrackElements that exist. 106 PNode* bindSlave; 137 PNode* bindSlave; //!< The node that is slave to the TrackManager. This node will be moved while update the TrackManager, and must NOT move itself. 138 PNode* trackNode; //!< The main TrackNode of this Track. 107 139 108 140 void initChildren(unsigned int childCount); … … 111 143 112 144 public: 113 ~TrackManager(void); 145 virtual ~TrackManager(void); 146 114 147 static TrackManager* getInstance(void); 115 148 116 149 // Methods to change the Path (initialisation) 117 150 void workOn(unsigned int trackID); 118 inline void setCurveType(CurveType curveType) { this->setCurveType (curveType, this->currentTrackElem);} 151 /** \see setCurveType(CurveType curveType, TrackElement* trackElem); \param curveType the type of the Curve */ 152 inline void setCurveType(CurveType curveType) { this->setCurveType (curveType, this->currentTrackElem);}; 119 153 void setCurveType(CurveType curveType, TrackElement* trackElem); 120 154 void setDuration(float time); … … 125 159 void fork(unsigned int count, ...); 126 160 void forkV(unsigned int count, int* trackIDs); 127 void condition(unsigned int groupID, PathCondition cond); //!< \todo really do this!! 161 void condition(CONDITION cond, void* subject); 162 void condition(unsigned int groupID, CONDITION cond, void* subject); 128 163 void join(unsigned int count, ...); 129 164 void joinV(unsigned int count, int* trackIDs); … … 131 166 132 167 // Methods to calculate the position on the Path (runtime) 133 Vector calcPos(void) const; 134 Vector calcDir(void) const; 168 inline Vector calcPos(void) const; 169 inline Vector calcDir(void) const; 170 float getWidth(void) const; 135 171 void tick(float dt); 136 172 void jumpTo(float time); 137 void choosePath(int graphID);173 inline int choosePath(TrackElement* trackElem); 138 174 139 175 void setBindSlave(PNode* bindSlave); 176 PNode* getTrackNode(void); 140 177 141 178 // DEBUG //
Note: See TracChangeset
for help on using the changeset viewer.