30 void FSMTransition (FSMStateBase src, FSMEventBase e, FSMStateBase dst, FSMActionBase a = NULL, FSMGuardBase g = NULL)
87 void Start (FSMEventBase initial_event = NULL)
107 m_state.OnExit(terminal_event);
136 FSMStateBase curr_state =
m_state;
139 for (
int i = 0; i < count; ++i)
142 if (row.m_srcState.Type() == curr_state.Type() && row.m_event.Type() == e.Type())
145 bool hasGuard = t.m_guard != NULL;
146 if (!hasGuard || (hasGuard && t.m_guard.GuardCondition(e)))
163 if (
LogManager.
IsInventoryHFSMLogEnable())
fsmbDebugPrint(
"[fsm] (local) state=" + t.m_srcState.ToString() +
"-------- event=" + e.ToString() +
"[G=" + t.m_guard.ToString() +
"]/A=" + t.m_action.ToString() +
" --------|> dst=" + t.m_dstState.ToString());
168 t.m_action.Action(e);
172 if (t.m_dstState != NULL)
void fsmbDebugPrint(string s)
void fsmbDebugSpam(string s)
Super root of all classes in Enforce script.
void Terminate(FSMEventBase terminal_event=NULL)
terminates the state machine
FSMStateBase GetCurrentState()
returns currently active state
void FSMBase()
fsm transition table
ProcessEventResult ProcessLocalTransition(FSMTransition< FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase > t, FSMEventBase e)
instructs the state machine to process the event locally - no hierarchy is crossed
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 sta...
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
ref array< ref FSMTransition< FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase > > m_transitions
configurable initial event to start the machine (null by default)
ref FSMStateBase m_initialState
current fsm state
bool IsRunning()
returns true if machine is in running state
ref FSMEventBase m_initialEvent
configurable initial state of the machine
ref FSMStateBase m_dstState
ref FSMStateBase m_srcState
void FSMTransition(FSMStateBase src, FSMEventBase e, FSMStateBase dst, FSMActionBase a=NULL, FSMGuardBase g=NULL)
ref FSMActionBase m_action
represents transition src -— event[guard]/action -—|> dst
static bool IsInventoryHFSMLogEnable()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.