48 for (
int s = 0;
s < m_States.Count(); ++
s)
50 m_States[
s] = m_InitialStates[
s];
55 m_States[
s].OnEntry(
null);
64 int sc = m_States.Count();
67 for (
int s = 0;
s <
sc; ++
s)
68 if (m_States[
s] !=
null)
81 for (
int s = 0;
s < m_States.Count(); ++
s)
86 m_States[
s].OnExit(
null);
100 for (
int s = 0;
s < m_States.Count(); ++
s)
110 m_Transitions.Insert(
t);
120 int count = m_Transitions.Count();
124 if (
row.m_event.Type() ==
e.Type())
126 for (
int s = 0;
s < m_States.Count(); ++
s)
128 if (
row.m_srcState.Type() == m_States[
s].Type() &&
row.m_event.Type() ==
e.Type())
134 ProcessLocalTransition(
s,
t,
e);
153 m_States[
s].OnExit(
e);
156 t.m_action.Action(
e);
158 m_States[
s] =
t.m_dstState;
160 if (
t.m_dstState !=
NULL)
162 m_States[
s].OnEntry(
e);
void fsmbDebugPrint(string s)
Super root of all classes in Enforce script.
static bool IsInventoryHFSMLogEnable()
void AddTransition(FSMTransition< FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase > t)
adds transition into transition table
ProcessEventResult ProcessLocalTransition(int s, FSMTransition< FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase > t, FSMEventBase e)
instructs the state machine to process the event locally - no hierarchy is crossed
ref array< ref FSMStateBase > m_States
ProcessEventResult ProcessEvent(FSMEventBase e)
instructs the state machine to process the event e
void Update(float dt)
if machine running, call OnUpdate() on current state
void OFSMBase()
fsm transition table
ref array< ref FSMStateBase > m_InitialStates
current fsm state
void Start(array< ref FSMEventBase > initial_events=null)
starts the state machine by entering the initial_state (using intial_event as argument to initial sta...
void Terminate(array< ref FSMEventBase > terminal_events=null)
terminates the state machine
void SetInitialStates(array< ref FSMStateBase > initial_states)
ref array< ref FSMTransition< FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase > > m_Transitions
configurable initial state of the machine
array< ref FSMStateBase > GetCurrentState()
bool IsRunning()
returns true if machine is in running state
base class for Orthogonal Finite State Machine