Editar

Compartilhar via


StateManager Class

Definition

Manages the state values of Interaction States within BaseInteractiveElement's States list. This class contains helper methods for setting, getting and creating new Interaction States for the States list.

public ref class StateManager
public class StateManager
type StateManager = class
Public Class StateManager
Inheritance
StateManager

Constructors

StateManager(List<InteractionState>, BaseInteractiveElement)

Create a new state manager with a given states scriptable object.

Properties

EventReceiverManager

The Event Receiver Manager for this State Manager. Each state can contain an event configuration scriptable which defines the events associated with the state. The Event Receiver Manager depends on a State Manager.

InteractiveElement
OnStateActivated

The Unity Event with the activated state as the event data. This event is invoked when a state is set to on.

OnStateDeactivated

The Unity Event with the previous active state and the current active state. The event is invoked when a state is set to off.

States

The read only dictionary for the Interaction States. To modify this dictionary use the AddNewState() RemoveState() methods. To set the value of a state in this dictionary use SetStateOn/Off() methods.

Methods

AddNewState(String)

Create and add a new state to track given the new state name. Also sets the state's event configuration.

AddNewStateWithCustomEventConfiguration(String, BaseInteractionEventConfiguration)

Create and add a new state given the state name and the associated existing event configuration.

GetState(String)

Gets a state by using the state name.

IsStateActive(String)

Check if a state is currently active.

IsStatePresent(String)

Check if a state is currently being tracked by this state manager.

RemoveState(String)

Removes a state. The state will no longer be tracked if it is removed.

ResetAllStates()

Reset all the state values in the list to 0. State values are reset when the Active property is set to false.

SetState(String, Int32)

Gets and sets state given the state name and state value.

SetStateOff(String)

Gets and sets a state to Off and invokes the OnStateDeactivated event. Setting a state off changes the state value to 0.

SetStateOn(String)

Gets and sets a state to On and invokes the OnStateActivated event. Setting a state on changes the state value to 1.

Applies to