Skip to main content

StateTransitionsManager

A class in Root.Township, Alta.PlayerStates.

Holds the active transitions out of one player state and runs them. The server-side version; clients get RemoteStateTransitionsManager.

Constructors​

MemberWhat it is
StateTransitionsManager(IPlayerState parentState)Creates a StateTransitionsManager from parentState.

Fields​

MemberWhat it is
protected IPlayerState parentStateThe state these transitions leave from.
2 private and internal fields
MemberWhat it is
private static Logger loggerNLog logger for this class.
private HashSet<IPlayerStateTransition> transitionsThe transitions currently added.

Methods​

MemberWhat it is
void Add(IPlayerStateTransition transition)Adds a transition, links it to this manager and the parent state, and turns it on. Warns if already added.
void ListenForStateDeactivation()Hooks the state manager so all transitions are removed when the parent state deactivates.
void Remove(IPlayerStateTransition transition)Turns off and clears one transition. Warns if it wasn't added.
void RemoveAllTransitions()Turns off and clears every transition.
void SetActive(IPlayerStateTransition stateTransition, bool isActive)Turns a transition's listeners on or off without removing it.
virtual void SetToState(PlayerStateType destinationType, PlayerStateHandler preActivationCallback)Switches the player's state manager to the given state, running the callback before it activates.
virtual void TriggerTransition(IPlayerStateTransition stateTransition)Adds the transition if needed, then runs it now.
1 private and internal method
MemberWhat it is
private void ClearAllTransitions(IPlayerState playerState)When the parent state deactivates, removes all transitions and stops listening.