Click or drag to resize

StateTrackerTStateData Class

Tracks a number of states. Events are raised when any state is started, and when all has stopped.
Inheritance Hierarchy
SystemObject
  Gamelogic.ExtensionsStateTrackerTStateData

Namespace:  Gamelogic.Extensions
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public class StateTracker<TStateData>

Type Parameters

TStateData
The type of the t state data.

The StateTrackerTStateData type exposes the following members.

Constructors
  NameDescription
Public methodStateTrackerTStateData
Initializes a new instance of the StateTrackerTStateData class.
Top
Properties
  NameDescription
Public propertyActiveTokens
Returns all the active tokens: tokens returned when states has been started that has not yet been stopped.
Public propertyIsActive
Gets a value indicating whether this tracker is active, that is, whether any state has been started that has not been stopped.
Top
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodStartState
Starts a state, and returns a token that can be used to stop it again.
Public methodStopState
Stops the state associated with the token. The token must be one that was returned when the state was started.
Public methodToString (Inherited from Object.)
Top
Events
  NameDescription
Public eventOnStateActive
Occurs when this tracker is inactive and a state is started (so that this tracker becomes active).
Public eventOnStateInactive
Occurs when all active states are stopped, that is, when this tracker is active and becomes inactive.
Top
Extension Methods
  NameDescription
Public Extension MethodThrowIfNull
Throws a NullReferenceException if the object is null.
(Defined by ObjectExtensions.)
Top
Remarks
A loading bar is a typical use case. The loading bar should be displayed when any of a number of load processes has started; it should be removed when all has stopped. Another use-case is keeping track of poisoning, when the poisoning can be caused by a number of poisons, and each poison is cured independently.
See Also