ActiveStateUnityEventWrapper Class
Extends MonoBehaviour
The ActiveStateUnityEventWrapper class provides a way to link Unity events with the state of an IActiveState.
This class is designed to trigger Unity events based on changes in the active state, allowing developers to easily connect Interaction SDK logic with Unity's built-in event system.
This class is particularly useful for triggering visual or audio effects, or other Unity-based events in response to changes in an interaction's active state.
UnityEvent WhenActivated[Get]
The Unity event that is triggered during an Update when the provided IActiveState becomes active.
UnityEvent WhenDeactivated[Get]
The Unity event that is triggered during an Update when the provided IActiveState becomes inactive.
This update method monitors the active state and triggers the appropriate Unity event based on the current state.
void InjectAllActiveStateUnityEventWrapper Injects an active state that this ActiveStateUnityEventWrapper will monitor.
This method is used to set up the wrapper with the active state whose changes will trigger the associated Unity events.
ParametersactiveStateThe IActiveState instance that will be monitored.
Sets the active state for the wrapper.
This method is designed to support dependency injection for unit testing.
ParametersactiveStateThe active state to set
void InjectOptionalEmitOnFirstUpdate ( bool emitOnFirstUpdate )
Optionally sets whether to emit events on the first update.
ParametersemitOnFirstUpdateIf true, events will be emitted on the first update.
void InjectOptionalWhenActivated ( UnityEvent whenActivated )
Injects a Unity event that is triggered when the active state is activated.
ParameterswhenActivatedThe Unity event to trigger on activation.
void InjectOptionalWhenDeactivated ( UnityEvent whenDeactivated )
Injects a Unity event that is triggered when the active state is deactivated.
ParameterswhenDeactivatedThe Unity event to trigger on deactivation.