A generic Finite-state machine implementation.

Constructor

new(?owner:T, ?state:FlxFSMState<T>)

Variables

age:Float

The age of the active state

name:String

Name of this FSM. Used for locking/unlocking when in a stack.

owner:T

The owner of this FSM instance. Gets passed to each state.

pools:StatePool<T>

Optional map object containing FlxPools for FlxFSMStates

stack:FlxFSMStack<T>

The stack this FSM belongs to or null

state:FlxFSMState<T>

Current state

stateClass:Class<FlxFSMState<T>>

Class of current state

transitions:FlxFSMTransitionTable<T>

Optional transition table for this FSM

type:Int

Binary flag. Used for locking/unlocking when in a stack.

Methods

destroy():Void

Calls exit on current state

update(elapsed:Float):Void

Updates the active state instance.