Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: EntityState

[20:7] extends: State

Wraps FXGL's EntityState (com.almasb.fxgl.entity.state.EntityState), a named FSM state used by StateComponent. The base class is concrete and can be constructed directly with a name; custom lifecycle hooks (onEntering, onEnteredFrom, onExitingTo, onExited) require a Java subclass. For ad-hoc FSM work without Aussom-side overrides, use the default-name constructor or supply a unique name; the StateComponent uses the name in its toString.

Methods

  • EntityState (string Name = "DEFAULT")

    Creates a new EntityState with the given name.

    • @p Name is the state name (used in toString).
  • adopt (object Ajo)

    Wraps an existing EntityState AussomJavaObject.

  • toString ()

    Returns the state name.

  • isSubState ()

    Returns false (EntityState is never a substate).

  • isAllowConcurrency ()

    Returns false (EntityState never allows concurrency).

  • IDLE ()

    Returns the singleton IDLE state used by StateComponent.changeStateToIdle.

    • @r An AussomJavaObject around the IDLE EntityState.
  • onCreate ()

    State lifecycle: invoked when the state is created.

  • onDestroy ()

    State lifecycle: invoked when the state is destroyed.

  • onEntering ()

    Fired once when the state is entered. No PrevState argument.

  • onEnteredFrom (object PrevStateAjo)

    Fired when transitioning into this state from PrevState. Pass an EntityState wrapper or raw AJO.

  • onExitingTo (object NextStateAjo)

    Fired when transitioning out of this state to NextState.

  • onExited ()

    Fired after the state has been exited.