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

Private Member Functions

void HFSMBase (FSMStateBase ownerState=NULL)
 
FSMStateBase GetCurrentState ()
 
void SetCurrentState (FSMStateBase state)
 
FSMStateBase GetOwnerState ()
 
bool GetHierarchyPath (FSMStateBase state, out array< FSMStateBase > path)
 returns hierarchic state (path to root) of a state
 
void SetInitialState (FSMStateBase initial_state)
 
void AddTransition (FSMTransition< FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase > t)
 adds transition into transition table
 
void Start (FSMEventBase initial_event=NULL, bool useExistingState=false)
 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 Abort (FSMEventBase abort_event=NULL)
 
void Update (float dt)
 if machine running, call OnUpdate() on current state
 
protected ProcessEventResult ProcessAbortTransition (FSMTransition< FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase > t, FSMEventBase e)
 
FSMStateBase FindAbortDestinationState (FSMEventBase e)
 i
 
FSMStateBase ProcessAbortEvent (FSMEventBase e, out ProcessEventResult result)
 instructs the hierarchical state machine to process the event e
 
ProcessEventResult ProcessEvent (FSMEventBase e)
 instructs the hierarchical state machine to process the event e
 
protected int FindFirstUnguardedTransition (FSMEventBase e)
 
FSMStateBase FindTransitionState (FSMStateBase s, FSMEventBase e)
 
FSMStateBase FindGuardedTransitionState (FSMStateBase s, FSMEventBase e)
 
protected int FindFirstCompletionTransition ()
 
protected ProcessEventResult ProcessLocalTransition (FSMTransition< FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase > t, FSMEventBase e)
 instructs the state machine to process the event locally - no hierarchy is crossed
 
protected ProcessEventResult LocalTransition (int i, FSMEventBase e)
 
protected ProcessEventResult ProcessCompletionTransitions ()
 

Private Attributes

protected ref FSMStateBase m_State
 
protected FSMStateBase m_OwnerState
 current fsm state
 
protected ref FSMStateBase m_InitialState
 state that owns this fsm (or null if root)
 
protected ref array< ref FSMTransition< FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase > > m_Transitions = new array<ref FSMTransition<FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase>>
 configurable initial state of the machine
 
protected bool m_HasCompletions = false
 fsm transition table
 

Constructor & Destructor Documentation

◆ HFSMBase()

void HFSMBase ( FSMStateBase  ownerState = NULL)
inlineprivate

Member Function Documentation

◆ Abort()

void Abort ( FSMEventBase  abort_event = NULL)
inlineprivate

◆ AddTransition()

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

adds transition into transition table

References Print().

◆ FindAbortDestinationState()

FindAbortDestinationState ( FSMEventBase  e)
inlineprivate

i

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)
FSM_NO_TRANSITION if no unguarded transition found in submachine or local machine
FSM_TERMINATED state machine has terminated
FSM_ABORTED state machine has aborted

References fsmDebugPrint(), LogManager::IsInventoryHFSMLogEnable(), m_State, ToString(), string::ToString(), and Type.

◆ FindFirstCompletionTransition()

protected int FindFirstCompletionTransition ( )
inlineprivate

References IsRunning(), and m_State.

◆ FindFirstUnguardedTransition()

protected int FindFirstUnguardedTransition ( FSMEventBase  e)
inlineprivate

References m_State.

◆ FindGuardedTransitionState()

FSMStateBase FindGuardedTransitionState ( FSMStateBase  s,
FSMEventBase  e 
)
inlineprivate

◆ FindTransitionState()

FSMStateBase FindTransitionState ( FSMStateBase  s,
FSMEventBase  e 
)
inlineprivate

◆ GetCurrentState()

GetCurrentState ( )
inlineprivate
Returns
returns currently active state within this machine (i.e. not hierarchic state)

References m_State.

◆ GetHierarchyPath()

GetHierarchyPath ( FSMStateBase  state,
out array< FSMStateBase >  path 
)
inlineprivate

returns hierarchic state (path to root) of a state

Parameters
[in]statestate the path is starting
[out]pathcurrent hierarchic state
Returns
true if current state returned in path argument, false otherwise

References string::Insert(), and path.

◆ GetOwnerState()

GetOwnerState ( )
inlineprivate
Returns
returns state that is owner of this fsm submachine. returns null if this is a root machine.

◆ IsRunning()

IsRunning ( )
inlineprivate

returns true if machine is in running state

References m_State.

◆ LocalTransition()

protected ProcessEventResult LocalTransition ( int  i,
FSMEventBase  e 
)
inlineprivate

◆ ProcessAbortEvent()

ProcessAbortEvent ( FSMEventBase  e,
out ProcessEventResult  result 
)
inlineprivate

instructs the hierarchical 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)
FSM_NO_TRANSITION if no unguarded transition found in submachine or local machine
FSM_TERMINATED state machine has terminated
FSM_ABORTED state machine has aborted

References fsmDebugPrint(), LogManager::IsInventoryHFSMLogEnable(), m_State, ToString(), string::ToString(), and Type.

◆ ProcessAbortTransition()

protected ProcessEventResult ProcessAbortTransition ( FSMTransition< FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase >  t,
FSMEventBase  e 
)
inlineprivate

◆ ProcessCompletionTransitions()

protected ProcessEventResult ProcessCompletionTransitions ( )
inlineprivate

References Error().

◆ ProcessEvent()

ProcessEvent ( FSMEventBase  e)
inlineprivate

instructs the hierarchical 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)
FSM_NO_TRANSITION if no unguarded transition found in submachine or local machine
FSM_TERMINATED state machine has terminated

References Error(), fsmDebugPrint(), fsmDebugSpam(), LogManager::IsInventoryHFSMLogEnable(), LogManager::IsWeaponLogEnable(), m_State, ToString(), string::ToString(), and Type.

◆ 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 fsmDebugPrint(), LogManager::IsInventoryHFSMLogEnable(), and m_State.

◆ SetCurrentState()

SetCurrentState ( FSMStateBase  state)
inlineprivate
Returns
returns currently active state within this machine (i.e. not hierarchic state)

References m_State.

◆ SetInitialState()

SetInitialState ( FSMStateBase  initial_state)
inlineprivate
Parameters
[in]initial_statestate the machine will be entered to after Start()
[in]initial_eventevent that will be used to start the machine

◆ Start()

Start ( FSMEventBase  initial_event = NULL,
bool  useExistingState = false 
)
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 fsmDebugPrint(), LogManager::IsInventoryHFSMLogEnable(), m_State, ToString(), and string::ToString().

◆ Terminate()

Terminate ( FSMEventBase  terminal_event = NULL)
inlineprivate

◆ Update()

Update ( float  dt)
inlineprivate

if machine running, call OnUpdate() on current state

References IsRunning(), and m_State.

Field Documentation

◆ m_HasCompletions

protected bool m_HasCompletions = false
private

fsm transition table

◆ m_InitialState

protected ref FSMStateBase m_InitialState
private

state that owns this fsm (or null if root)

◆ m_OwnerState

protected FSMStateBase m_OwnerState
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 = new array<ref FSMTransition<FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase>>
private

configurable initial state of the machine


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