Class TimedStateTracker<TStateData>
- Namespace
- Gamelogic.Extensions
- Assembly
- Gamelogic.Extensions.dll
The same as StateTracker, but states can also time out.
public class TimedStateTracker<TStateData>
Type Parameters
TStateData
The type of the t state data.
- Inheritance
-
TimedStateTracker<TStateData>
- Inherited Members
- Extension Methods
Remarks
Time-outs are managed by this class: when the state times out, it is stopped, and an event is raised. This tracker must be updated (typically in a mono-behaviour Update method).
Constructors
- TimedStateTracker()
Initializes a new instance of the TimedStateTracker<TStateData> class.
Properties
- ActiveTokens
Returns all the active tokens: tokens returned when states has been started that has not yet been stopped.
- IsActive
Gets a value indicating whether this tracker is active, that is, whether any state has been started that has not been stopped.
- IsPaused
Gets a value indicating whether this tracker is paused.
Methods
- Pause()
Pauses this tracker.
- StartState(TStateData, float)
Starts a state, and returns a token that can be used to stop it again.
- StartState(TStateData, float, Action)
Starts a state, and returns a token that can be used to stop it again.
- StopState(IStateToken<TStateData>)
Stops the state associated with the token. The token must be one that was returned when the state was started.
- Unpause()
Unpauses this tracker.
- Update(float)
Updates this tracker with the specified current time.
Events
- OnStateActive
Occurs when this tracker is inactive and a state is started (so that this tracker becomes active).
- OnStateInactive
Occurs when all active states are stopped, that is, when this tracker is active and becomes inactive.