Drag[en]gine Script Module DragonScript 1.32.1
Loading...
Searching...
No Matches
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.
 
void addExitAction (SMStateAction action)
 Add exit action.
 
void addTransition (SMTransition transition)
 Add transition.
 
SMStateAction findEnterAction (Block ablock)
 Find enter action with block with parameter SMStateAction.
 
SMStateAction findExitAction (Block ablock)
 Find exit action with block with parameter SMStateAction.
 
SMTransition findTransition (Block ablock)
 Find transition with block with parameter SMTransition.
 
void forEachEnterAction (Block ablock)
 Visit enter actions with block with parameter SMStateAction.
 
void forEachExitAction (Block ablock)
 Visit exit actions with block with parameter SMStateAction.
 
void forEachTransition (Block ablock)
 Visit transitions with block with parameter SMTransition.
 
SMStateAction getEnterActionAt (int index)
 Get enter action at index.
 
int getEnterActionCount ()
 Count of enter actions.
 
SMStateAction getExitActionAt (int index)
 Get exit action at index.
 
int getExitActionCount ()
 Count of exit actions.
 
String getID ()
 Unique state identifier or null.
 
String getNextStateID ()
 State to transition to after all enter actions finished or null.
 
SMTransition getTransitionAt (int index)
 Get transition at index.
 
int getTransitionCount ()
 Count of transitions.
 
void importState (SMState state)
 Import state.
 
int indexOfEnterAction (SMStateAction action)
 Index of enter action or -1 if absent.
 
int indexOfExitAction (SMStateAction action)
 Index of exit action or -1 if absent.
 
int indexOfTransition (SMTransition transition)
 Index of transition or -1 if absent.
 
SMState new (SMState state)
 Create copy of state machine state.
 
SMState new (String id)
 Create state machine state.
 
void removeAllTransitions ()
 Remove all transitions.
 
void removeTransition (SMTransition transition)
 Remove transition.
 
void setNextStateID (String id)
 Set state to transition to after all enter actions finished or null.
 

Public Attributes

Array pEnterActions
 
Array pExitActions
 
String pID
 
String pNextStateID
 
Array pTransitions
 

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.

◆ findEnterAction()

SMStateAction Dragengine.StateMachineSystem.SMState.findEnterAction ( Block  ablock)

Find enter action with block with parameter SMStateAction.

◆ findExitAction()

SMStateAction Dragengine.StateMachineSystem.SMState.findExitAction ( Block  ablock)

Find exit action with block with parameter SMStateAction.

◆ findTransition()

SMTransition Dragengine.StateMachineSystem.SMState.findTransition ( Block  ablock)

Find transition with block with parameter SMTransition.

◆ 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.

◆ getExitActionAt()

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

Get exit action at index.

◆ getExitActionCount()

int Dragengine.StateMachineSystem.SMState.getExitActionCount ( )

Count of exit actions.

◆ getID()

String Dragengine.StateMachineSystem.SMState.getID ( )

Unique state identifier or null.

◆ getNextStateID()

String Dragengine.StateMachineSystem.SMState.getNextStateID ( )

State to transition to after all enter actions finished or null.

Version
1.26

◆ getTransitionAt()

SMTransition Dragengine.StateMachineSystem.SMState.getTransitionAt ( int  index)

Get transition at index.

◆ getTransitionCount()

int Dragengine.StateMachineSystem.SMState.getTransitionCount ( )

Count of transitions.

◆ importState()

void Dragengine.StateMachineSystem.SMState.importState ( SMState  state)

Import state.

Version
1.26

◆ 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() [1/2]

SMState Dragengine.StateMachineSystem.SMState.new ( SMState  state)

Create copy of state machine state.

Version
1.26
Parameters
stateState to copy.

◆ new() [2/2]

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.

◆ setNextStateID()

void Dragengine.StateMachineSystem.SMState.setNextStateID ( String  id)

Set state to transition to after all enter actions finished or null.

Version
1.26

Member Data Documentation

◆ pEnterActions

Array Dragengine.StateMachineSystem.SMState.pEnterActions

◆ pExitActions

Array Dragengine.StateMachineSystem.SMState.pExitActions

◆ pID

String Dragengine.StateMachineSystem.SMState.pID

◆ pNextStateID

String Dragengine.StateMachineSystem.SMState.pNextStateID

◆ pTransitions

Array Dragengine.StateMachineSystem.SMState.pTransitions

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