Method StartState
- Namespace
- Gamelogic.Extensions
- Assembly
- Gamelogic.Extensions.dll
StartState(TStateData, float, Action)
Starts a state, and returns a token that can be used to stop it again.
public IStateToken<TStateData> StartState(TStateData stateData, float maxTime, Action onTimeOut)
Parameters
stateDataTStateDataCustom state data. This is useful in cases where all the active states needs to be examined. For example, this data can be used to identify states externally.
maxTimefloatThe maximum amount of time this state should survive past the current time.
onTimeOutActionThe action to perform when timing out.
Returns
- IStateToken<TStateData>
A token that wraps the custom state data and can be used to stop the state started with this method.
Remarks
For a state to time out, it is necessary for the Update method to be called regularly (for example, in a MonoBehaviours Update method).
StartState(TStateData, float)
Starts a state, and returns a token that can be used to stop it again.
public IStateToken<TStateData> StartState(TStateData stateData, float maxTime)
Parameters
stateDataTStateDataCustom state data. This is useful in cases where all the active states needs to be examined. For example, this data can be used to identify states externally.
maxTimefloatThe maximum amount of time this state should survive past the current time.
Returns
- IStateToken<TStateData>
A token that wraps the custom state data and can be used to stop the state started with this method.
Remarks
For a state to time out, it is necessary for the Update method to be called regularly (for example, in a MonoBehaviours Update method).