The TrackManager handles the flow of the Players through the game.
The TrackManager works as followed:
- Initialize it, by setting up the Graph. You can do this by using the following Commands.
- workOn(): changes the ID that will be altered through the changes.
- setCurveType(): lets you set the CurveType of the Curve we are Working on. (default is BezierCurve, set this as early as possible, for his uses resources).
- setDuration(): sets the length of the current path in seconds.
- addPoint(): adds a point to the Curve.
- addHotPoint(): adds save/splitpoint.
- fork(): adds some interessting non-linear movments through the level (fork will force addHotPoint if not done then).
- condition(): decides under what condition a certain Path will be chosen.
- join(): joins some tracks together again. Join will set the localTime to the longest time a Path has to get to this Point)
- setSavePoint(): Sets a HotPoint into a savePoint. A Savepoint can be used as a rollbackpoint if a Player gets shot.
HotPoints and Joins are at the beginning of a TrackElement. SavePoints and Forks are at the end of a TrackElement. Look out: SAVEPOINTS CAN NOT BE FORKS (but joins), because the condition is really hard to guess if you do not give some impuls.
- Runtime knows the following:
- calcPos(): returns the current position on the track
- calcDir(): returns the current Direction the track is flying on.
- tick(): makes a Step on the Path. increases localTime by dt.
- choosePath(): a Function that decides which Path we should follow.
TrackManager can be handled as a StateMachine.
- TrackManager: handles Tracks
- Track: The Track that the ship can follow
- Path: one way through the Level, that is dependent on conditionals.
- Conditional: A decition making device, that chooses betwen different TrackElements? for the Path.
- TrackElement: A Part of A whole Track