Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: State

[16:7] extends: FxObj

Wraps an AussomState (implementation of FXGL's State interface) so Aussom code can author custom FSM states. Each state owns an isSubState flag plus four lifecycle callbacks: onCreate, onDestroy, onEnteredFrom(prevState), onExitingTo (nextState). Configure via the on* methods, then pass to a StateMachine constructor or changeState call.

Methods

  • State (bool IsSubState = false, bool IsAllowConcurrency = false)

    Creates a new State wrapper.

    • @p IsSubState is true when this state should be pushed onto an existing state machine rather than replacing the parent state.
    • @p IsAllowConcurrency is true when this substate should be active alongside the state above it (only meaningful for substates).
  • onCreate (callback Cb)

    Registers an onCreate callback (state activated for the first time).

  • onDestroy (callback Cb)

    Registers an onDestroy callback (state removed from the hierarchy).

  • onEnteredFrom (callback Cb)

    Registers an onEnteredFrom callback (state activated after a transition). Receives the previous State AJO.

  • onExitingTo (callback Cb)

    Registers an onExitingTo callback (state about to be replaced or pushed over). Receives the next State AJO.

  • isSubState ()

    Returns whether this state is a substate.

  • isAllowConcurrency ()

    Returns whether this state allows concurrency.