Class StateManager

A class representing a state machine manager.

Constructors

  • Creates a new state machine manager.

    Parameters

    • Optional pStates: Record<string, State>

      Object of state objects to register.

    Returns StateManager

Properties

version: string = "VERSION_REPLACE_ME"

The version of the module.

Methods

  • Registers a new state with the state machine.

    Parameters

    • pName: string

      The name of the state.

    • pState: State

      The state object.

    Returns void

  • Sets the current state of the state machine.

    Parameters

    • pName: string

      The name of the state to set.

    • Rest ...pRest: any[]

      The arguments that were passed when setting this state.

    Returns void

  • Gets the current state.

    Returns null | string

  • Updates the current state of the state machine.

    Parameters

    • pDelta: number

      The delta time since the last update in seconds.

    Returns void