C# Class FsmSystem, nightmare_cooperative

FSMSystem class represents the Finite State Machine class. It has a List with the States the NPC has and methods to add, delete a state, and to change the current state the Machine is on.
Datei anzeigen Open project: jonbro/nightmare_cooperative Class Usage Examples

Public Methods

Method Description
AddState ( FsmState, s ) : void

This method places new states inside the FSM, or prints an ERROR message if the state was already inside the List. First state added is also the initial state.

DeleteState ( FsmStateId id ) : void

This method delete a state from the FSM List if it exists, or prints an ERROR message if the state was not on the List.

FsmSystem ( ) : System
PerformTransition ( FsmTransitionId trans ) : void

This method tries to change the state the FSM is in based on the current state and the transition passed. If current state doesn't have a target state for the transition passed, an ERROR message is printed.

Start ( ) : void

Call this to trigger the before action on the first state in the list

Method Details

AddState() public method

This method places new states inside the FSM, or prints an ERROR message if the state was already inside the List. First state added is also the initial state.
public AddState ( FsmState, s ) : void
s FsmState,
return void

DeleteState() public method

This method delete a state from the FSM List if it exists, or prints an ERROR message if the state was not on the List.
public DeleteState ( FsmStateId id ) : void
id FsmStateId
return void

FsmSystem() public method

public FsmSystem ( ) : System
return System

PerformTransition() public method

This method tries to change the state the FSM is in based on the current state and the transition passed. If current state doesn't have a target state for the transition passed, an ERROR message is printed.
public PerformTransition ( FsmTransitionId trans ) : void
trans FsmTransitionId
return void

Start() public method

Call this to trigger the before action on the first state in the list
public Start ( ) : void
return void