Class State

java.lang.Object
de.gurkenlabs.litiengine.entities.behavior.State
Direct Known Subclasses:
EntityState

public abstract class State extends Object
Represents an abstract state in a state machine.
  • Constructor Details

    • State

      protected State(String name)
      Initializes a new instance of the State class with the specified name.
      Parameters:
      name - the name of the state
  • Method Details

    • enter

      public void enter()
      Called when the state is entered. Notifies all registered listeners about the state entry.
    • exit

      public void exit()
      Called when the state is exited. Notifies all registered listeners about the state exit.
    • getName

      public String getName()
      Gets the name of the state.
      Returns:
      the name of the state
    • getTransitions

      public List<Transition> getTransitions()
      Gets the list of transitions associated with this state.
      Returns:
      the list of transitions
    • addStateListener

      public void addStateListener(StateListener listener)
      Adds a listener to be notified of state events.
      Parameters:
      listener - the listener to be added
    • removeStateListener

      public void removeStateListener(StateListener listener)
      Removes a listener from being notified of state events.
      Parameters:
      listener - the listener to be removed
    • perform

      protected abstract void perform()
      Performs the actions associated with this state.