class OFSMBase<Class FSMStateBase, Class FSMEventBase, Class FSMActionBase, Class FSMGuardBase>Source
base class for Orthogonal Finite State Machine
stores current states (m_states) and transition table with possible transitions from each state to another state via event
Constructors 1
void OFSMBase()Members 3
protected ref array<ref FSMStateBase> m_Statescurrent fsm state
Show 6 more
, ProcessEvent(), ProcessLocalTransition(), SetInitialStates(), Start(), Terminate(), and Update()protected ref array<ref FSMStateBase> m_InitialStatesconfigurable initial state of the machine
protected ref array<ref FSMTransition<FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase>> m_Transitionsfsm transition table
Methods 9
array<ref FSMStateBase> GetCurrentState()returns currently active state
Returns: current state the FSM is in (or NULL)
void SetInitialStates(array<ref FSMStateBase> initial_states)sets the initial_state for starting the machine
void Start(array<ref FSMEventBase> initial_events = null)starts the state machine by entering the initial_state (using intial_event as argument to initial state's onEntry)
- in
e optionalevent for starting the machind
Show 6 more
, OnEntry(), Class.ToString(), Class.ToString(), Class.ToString(), m_InitialStates, and m_Statesbool IsRunning()returns true if machine is in running state
void Terminate(array<ref FSMEventBase> terminal_events = 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
- in
e eventthat will be used to find suitable transition from current state
Returns: FSM_OK if transition found and allowed by guard (if any)
Show 8 more
, GuardCondition(), ProcessLocalTransition(), Class.Type(), Class.Type(), Class.Type(), Class.Type(), m_States, and m_Transitionsprotected 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
- in
t thetransition in m_transitions- in
e eventthat will be used to process transition from current state
Returns: FSM_OK or FSM_TERMINATED