public FSMState(string identifier, StateUpdateHandler updateHandler = null, StateEnteredCallback enteredCallback = null, StateExitedCallback exitedCallback = null) { this.Identifier = identifier; this.EnteredCallback = enteredCallback; this.ExitedCallback = exitedCallback; this.UpdateHandler = updateHandler; }
public void AddStateUpdateCallback(BattleStates state, StateUpdateHandler handler) { if (state <= 0 || state >= BattleStates.Count || handler == null) { return; } m_stateHandlers[(int)state] -= handler; m_stateHandlers[(int)state] += handler; }
public void AddState(string state, StateUpdateHandler updateHandler = null, StateEnteredCallback enteredCallback = null, StateExitedCallback exitedCallback = null) { _states[state] = new FSMState(state, updateHandler, enteredCallback, exitedCallback); }
/// <summary> /// Change the state -- the parent object registers a state by passing a reference to the parent's state handler. /// ex: "m_stateMachine.SetState (UpdateCountDown2);" sets the current state handler to "UpdateCountdown2" /// </summary> public void SetState(StateUpdateHandler newState) { if(CurrentState != newState) CurrentState = newState; }