Grail (C#)  1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
Grail.FSM.FiniteStateMachine Class Reference

Class representing basic Finite State Machine. More...

Inheritance diagram for Grail.FSM.FiniteStateMachine:
Collaboration diagram for Grail.FSM.FiniteStateMachine:

Public Member Functions

 FiniteStateMachine (Dictionary< IState, Func< IState >> transitionFunctions, IState initialState, string stateMachineName="state machine")
 Constructor.

Parameters
transitionFunctionsTransition functions for states. Functions should return the next state or, null - if no transition is to be made.
initialStateState with which this state machine will be initialized.
stateMachineNameName of this state machine.
More...
 
 FiniteStateMachine (List<(IState sourceState, IState destinationState, Func< bool > condition)> transitions, IState initialState, string stateMachineName="state machine")
 Constructor.

Parameters
transitionsTransition function for states defined as (source state, destination state, condition).
initialStateState with which this state machine will be initialized.
stateMachineNameName of this state machine.
More...
 
override void Enter ()
 Called once after machine enters this state. More...
 
override void Update (float deltaTime)
 Performs state transition, if one is required, and runs update for resulting state. More...
 
- Public Member Functions inherited from Grail.FSM.DefaultState
virtual void Exit ()
 Called once after machine exits this state. More...
 

Public Attributes

IState CurrentState => currentState
 Current state. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Grail.FSM.DefaultState
 DefaultState (string stateName)
 
- Properties inherited from Grail.FSM.DefaultState
string Name [get]
 Name of this state. More...
 
- Properties inherited from Grail.FSM.IState
string Name [get]
 Name of this state. More...
 

Detailed Description

Class representing basic Finite State Machine.

Constructor & Destructor Documentation

◆ FiniteStateMachine() [1/2]

Grail.FSM.FiniteStateMachine.FiniteStateMachine ( Dictionary< IState, Func< IState >>  transitionFunctions,
IState  initialState,
string  stateMachineName = "state machine" 
)
inline

Constructor.

Parameters
transitionFunctionsTransition functions for states. Functions should return the next state or, null - if no transition is to be made.
initialStateState with which this state machine will be initialized.
stateMachineNameName of this state machine.

◆ FiniteStateMachine() [2/2]

Grail.FSM.FiniteStateMachine.FiniteStateMachine ( List<(IState sourceState, IState destinationState, Func< bool > condition)>  transitions,
IState  initialState,
string  stateMachineName = "state machine" 
)
inline

Constructor.

Parameters
transitionsTransition function for states defined as (source state, destination state, condition).
initialStateState with which this state machine will be initialized.
stateMachineNameName of this state machine.

Member Function Documentation

◆ Enter()

override void Grail.FSM.FiniteStateMachine.Enter ( )
inlinevirtual

Called once after machine enters this state.

Reimplemented from Grail.FSM.DefaultState.

◆ Update()

override void Grail.FSM.FiniteStateMachine.Update ( float  deltaTime)
inlinevirtual

Performs state transition, if one is required, and runs update for resulting state.

Reimplemented from Grail.FSM.DefaultState.

Member Data Documentation

◆ CurrentState

IState Grail.FSM.FiniteStateMachine.CurrentState => currentState

Current state.


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