Drag[en]gine Script Module DragonScript  1.23
Dragengine.StateMachineSystem.SMState Class Reference

State machine state. More...

Inheritance diagram for Dragengine.StateMachineSystem.SMState:

Public Member Functions

void addEnterAction (SMStateAction action)
 Add enter action. More...
 
void addExitAction (SMStateAction action)
 Add exit action. More...
 
void addTransition (SMTransition transition)
 Add transition. More...
 
void forEachEnterAction (Block ablock)
 Visit enter actions with block with parameter SMStateAction. More...
 
void forEachExitAction (Block ablock)
 Visit exit actions with block with parameter SMStateAction. More...
 
void forEachTransition (Block ablock)
 Visit transitions with block with parameter SMTransition. More...
 
SMStateAction getEnterActionAt (int index)
 Get enter action at index. More...
 
int getEnterActionCount ()
 Count of enter actions. More...
 
String getID ()
 Unique state identifier or null. More...
 
int indexOfEnterAction (SMStateAction action)
 Index of enter action or -1 if absent. More...
 
int indexOfExitAction (SMStateAction action)
 Index of exit action or -1 if absent. More...
 
int indexOfTransition (SMTransition transition)
 Index of transition or -1 if absent. More...
 
SMState new (String id)
 Create state machine state. More...
 
void removeAllTransitions ()
 Remove all transitions. More...
 
void removeTransition (SMTransition transition)
 Remove transition. More...
 

Detailed Description

State machine state.

States contain a list of actions to do while entering or existing the state and a list of transitions triggered by events.

States are assigned a unique identifier. Strings are used instead of a number to make the state machine more portable across changing save state revisions.

Each state can have multiple transitions matching the same event by using conditions. The first transition matching the send event with fulfilled condition is selected. If no transition matches the event raises an exception.

Action can have optional condition running them only if the condition evaluates to true.

Member Function Documentation

◆ addEnterAction()

void Dragengine.StateMachineSystem.SMState.addEnterAction ( SMStateAction  action)

Add enter action.

◆ addExitAction()

void Dragengine.StateMachineSystem.SMState.addExitAction ( SMStateAction  action)

Add exit action.

◆ addTransition()

void Dragengine.StateMachineSystem.SMState.addTransition ( SMTransition  transition)

Add transition.

◆ forEachEnterAction()

void Dragengine.StateMachineSystem.SMState.forEachEnterAction ( Block  ablock)

Visit enter actions with block with parameter SMStateAction.

◆ forEachExitAction()

void Dragengine.StateMachineSystem.SMState.forEachExitAction ( Block  ablock)

Visit exit actions with block with parameter SMStateAction.

◆ forEachTransition()

void Dragengine.StateMachineSystem.SMState.forEachTransition ( Block  ablock)

Visit transitions with block with parameter SMTransition.

◆ getEnterActionAt()

SMStateAction Dragengine.StateMachineSystem.SMState.getEnterActionAt ( int  index)

Get enter action at index.

◆ getEnterActionCount()

int Dragengine.StateMachineSystem.SMState.getEnterActionCount ( )

Count of enter actions.

◆ getID()

String Dragengine.StateMachineSystem.SMState.getID ( )

Unique state identifier or null.

◆ indexOfEnterAction()

int Dragengine.StateMachineSystem.SMState.indexOfEnterAction ( SMStateAction  action)

Index of enter action or -1 if absent.

◆ indexOfExitAction()

int Dragengine.StateMachineSystem.SMState.indexOfExitAction ( SMStateAction  action)

Index of exit action or -1 if absent.

◆ indexOfTransition()

int Dragengine.StateMachineSystem.SMState.indexOfTransition ( SMTransition  transition)

Index of transition or -1 if absent.

◆ new()

SMState Dragengine.StateMachineSystem.SMState.new ( String  id)

Create state machine state.

Parameters
idIdentifier or null.
Exceptions
EInvalidParamid is empty string.

◆ removeAllTransitions()

void Dragengine.StateMachineSystem.SMState.removeAllTransitions ( )

Remove all transitions.

◆ removeTransition()

void Dragengine.StateMachineSystem.SMState.removeTransition ( SMTransition  transition)

Remove transition.


The documentation for this class was generated from the following file: