Class: States

rune.state.States(owner)

The States class represents a finite-state machine (FSM) that can handle multiple logical states simultaneously. Although several states can be allocated simultaneously, only one state can be active at a time. Switch between states to quickly switch between an object's behavioral logic.

Constructor

new States(owner)

Creates a new instance of the States class, ie a state machine.
Parameters:
Name Type Description
owner Object The state owner.
Source:

Members

(readonly) selected :rune.state.State

The state that is currently selected and thus activated.
Type:
Source:

Methods

load(states) → {undefined}

Load a new batch of states. A "batch" is represented by a list.
Parameters:
Name Type Description
states Array.<rune.state.State> List of instantiated states.
Source:
Throws:
If invalid or empty batch.
Type
Error
Returns:
Type
undefined

select(name) → {boolean}

Selects and activates a state based on its name.
Parameters:
Name Type Description
name string Name of state to be selected.
Source:
Returns:
Whether a state could be selected.
Type
boolean