24 ref FSMStateBase m_srcState;
26 ref FSMStateBase m_dstState;
28 ref FSMGuardBase m_guard;
30 void FSMTransition (FSMStateBase src, FSMEventBase e, FSMStateBase dst, FSMActionBase a = NULL, FSMGuardBase g = NULL)
80 m_initialState = initial_state;
87 void Start (FSMEventBase initial_event = NULL)
89 if (
LogManager.IsInventoryHFSMLogEnable())
fsmbDebugPrint(
"[fsm] " + this.
ToString() +
"::Start(" + initial_event.ToString() +
"), init_state=" + m_initialState.ToString());
91 m_state = m_initialState;
92 m_state.OnEntry(initial_event);
107 m_state.OnExit(terminal_event);
118 m_state.OnUpdate(dt);
126 m_transitions.Insert(t);
136 FSMStateBase curr_state = m_state;
138 int count = m_transitions.Count();
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)))
148 ProcessLocalTransition(t, 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);
170 m_state = t.m_dstState;
172 if (t.m_dstState != NULL)
179 if (
LogManager.IsInventoryHFSMLogEnable())
fsmbDebugPrint(
"[fsm] terminating fsm: state=" + t.m_srcState.ToString() +
" event=" + e.ToString());
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
base class for finite state machine
represents transition src -— event[guard]/action -—|> dst
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
ref HandEventBase m_event
void fsmbDebugPrint(string s)
void fsmbDebugSpam(string s)
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...
class WeaponEndAction extends WeaponStartAction m_action