Skip to content

zapparo/state-machine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

#State machine

Manage the behaviour of a class without keeping track of the states of an object with multiple boolean attributes using state transitions and callbacks.

Usage

State

// Create a state with transition callbacks and a list of other state names that are allowed to transition into this state.
var state:State = new State("state", new <String> ["otherState", "otherState2"], enterCallback, updateCallback, exitCallback);

State machine

// Create a state machine with two states
var stateMachine:StateMachine = new StateMachine("State Machine");

stateMachine.add(state1);
stateMachine.add(state2);
			
// set initial state
// if the state machine doesn't have a current state it jumps directly into that state
stateMachine.changeToState(state1.name);

stateMachine.changeToState(state2.name);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published