Contains the information on when to transition from a given state to another.

Constructor

new()

Methods

add(from:Class<FlxFSMState<T>>, to:Class<FlxFSMState<T>>, condition:T ‑> Bool):FlxFSMTransitionTable<T>

Adds a transition condition to the table.

Parameters:

from

The state the condition applies to

to

The state to transition

condition

Function that returns true if the transition conditions are met

addGlobal(to:Class<FlxFSMState<T>>, condition:T ‑> Bool):FlxFSMTransitionTable<T>

Adds a global transition condition to the table.

Parameters:

to

The state to transition

condition

Function that returns true if the transition conditions are met

addTransition(transition:Transition<T>):Void

Add a transition directly

Parameters:

transition

The transition to add

hasTransition(?from:Class<FlxFSMState<T>>, ?to:Class<FlxFSMState<T>>, ?condition:T ‑> Bool):Bool

Tells if the table contains specific transition or transitions.

Parameters:

from

From State

to

To State

condition

Condition function

Returns:

True if match found

poll(currentState:Class<FlxFSMState<T>>, owner:T):Class<FlxFSMState<T>>

Polls the transition table for active states

Parameters:

currentState

The class of the current FlxFSMState

owner

The FlxFSMState the table belongs to

Returns:

The state that should become or remain active.

@:value({ removeNow : false })remove(?from:Class<FlxFSMState<T>>, ?to:Class<FlxFSMState<T>>, ?condition:T ‑> Bool, removeNow:Bool = false):Void

Removes a transition condition from the table

Parameters:

from

From state. If null, this arg is ignored

to

To state. If null, this arg is ignored

condition

Condition function. If null, this arg is ignored

removeNow

If true, the transition is removed immediately, otherwise it's removed when the target is not in the specified from state

@:value({ removeNow : false })replace(target:Class<FlxFSMState<T>>, replacement:Class<FlxFSMState<T>>, removeNow:Bool = false):Void

Replaces given state class with another.

Parameters:

target

State class to replace

replacement

State class to replace with

removeNow

If true, the transition is removed immediately, otherwise it's removed when the target is not in the specified from state

start(with:Class<FlxFSMState<T>>):FlxFSMTransitionTable<T>

Sets the starting State

Parameters:

with

The class of the starting State