Interface State
-
- All Implemented Interfaces:
public interface StateBase interface for representing states within a StateMachine.
This interface defines the lifecycle contract for states, providing methods for initialization and finalization. States implementing this interface can be used within any state machine to define specific behaviors and transitions. Both methods have default no-operation implementations, allowing states to override only the methods they need for their specific functionality.
-
-
Method Summary
Modifier and Type Method Description Unitinitialize()Called when the state is entered and becomes the current state. UnitcleanUp()Called when the state is being exited and another state is becoming current. -
-
Method Detail
-
initialize
Unit initialize()
Called when the state is entered and becomes the current state.
This method is invoked by the StateMachine when transitioning to this state. States should use this method to perform any initialization logic, set up listeners, start operations, or configure resources needed for the state.
-
cleanUp
Unit cleanUp()
Called when the state is being exited and another state is becoming current.
This method is invoked by the StateMachine before transitioning away from this state. States should use this method to perform cleanup operations, remove listeners, cancel ongoing operations, or release resources associated with the state.
-
-
-
-