DayZ Scripts
PC Stable Documentation
 
Loading...
Searching...
No Matches
FSMBase< Class FSMStateBase, Class FSMEventBase, Class FSMActionBase, Class FSMGuardBase > Class Reference

Private Member Functions

void FSMBase ()
 fsm transition table
 
FSMStateBase GetCurrentState ()
 returns currently active state
 
void SetInitialState (FSMStateBase initial_state)
 sets the initial_state for starting the machine
 
void Start (FSMEventBase initial_event=NULL)
 starts the state machine by entering the initial_state (using intial_event as argument to initial state's onEntry)
 
bool IsRunning ()
 returns true if machine is in running state
 
void Terminate (FSMEventBase terminal_event=NULL)
 terminates the state machine
 
void Update (float dt)
 if machine running, call OnUpdate() on current state
 
void AddTransition (FSMTransition< FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase > t)
 adds transition into transition table
 
ProcessEventResult ProcessEvent (FSMEventBase e)
 instructs the state machine to process the event e
 
protected ProcessEventResult ProcessLocalTransition (FSMTransition< FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase > t, FSMEventBase e)
 instructs the state machine to process the event locally - no hierarchy is crossed
 

Private Attributes

protected ref FSMStateBase m_state
 
protected ref FSMStateBase m_initialState
 current fsm state
 
protected ref FSMEventBase m_initialEvent
 configurable initial state of the machine
 
protected ref array< ref FSMTransition< FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase > > m_transitions
 configurable initial event to start the machine (null by default)
 

Constructor & Destructor Documentation

◆ FSMBase()

void FSMBase ( )
inlineprivate

fsm transition table

Member Function Documentation

◆ AddTransition()

AddTransition ( FSMTransition< FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase >  t)
inlineprivate

adds transition into transition table

◆ GetCurrentState()

GetCurrentState ( )
inlineprivate

returns currently active state

Returns
current state the FSM is in (or NULL)

◆ IsRunning()

IsRunning ( )
inlineprivate

returns true if machine is in running state

◆ ProcessEvent()

ProcessEvent ( FSMEventBase  e)
inlineprivate

instructs the state machine to process the event e

Parameters
[in]eevent that will be used to find suitable transition from current state
Returns
FSM_OK if transition found and allowed by guard (if any)

◆ ProcessLocalTransition()

ProcessLocalTransition ( FSMTransition< FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase >  t,
FSMEventBase  e 
)
inlineprivate

instructs the state machine to process the event locally - no hierarchy is crossed

Parameters
[in]tthe transition in m_transitions
[in]eevent that will be used to process transition from current state
Returns
FSM_OK or FSM_TERMINATED

References fsmbDebugPrint(), and LogManager::IsInventoryHFSMLogEnable().

◆ SetInitialState()

SetInitialState ( FSMStateBase  initial_state)
inlineprivate

sets the initial_state for starting the machine

◆ Start()

Start ( FSMEventBase  initial_event = NULL)
inlineprivate

starts the state machine by entering the initial_state (using intial_event as argument to initial state's onEntry)

Parameters
[in]eoptional event for starting the machind

References fsmbDebugPrint(), LogManager::IsInventoryHFSMLogEnable(), ToString(), and string::ToString().

◆ Terminate()

Terminate ( FSMEventBase  terminal_event = NULL)
inlineprivate

terminates the state machine

References IsRunning().

◆ Update()

Update ( float  dt)
inlineprivate

if machine running, call OnUpdate() on current state

References IsRunning().

Field Documentation

◆ m_initialEvent

protected ref FSMEventBase m_initialEvent
private

configurable initial state of the machine

◆ m_initialState

protected ref FSMStateBase m_initialState
private

current fsm state

◆ m_state

protected ref FSMStateBase m_state
private

◆ m_transitions

protected ref array<ref FSMTransition<FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase> > m_transitions
private

configurable initial event to start the machine (null by default)


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