public void Reset() { this.currentState.Exit(); this.currentState = defaultState; this.currentStateID = defaultStateID; this.currentState.Enter(); }
public void UpdateMachine(float time) { if (states.Count == 0) { return; } if (currentState == null) { currentState = defaultState; return; } goalID = currentState.CheckTransition(); if (goalID != currentStateID) { currentState.Exit(); TransitionState(goalID); currentStateID = goalID; concurrentMachineCanRun = currentState.ConcurrentStateCanRun; currentState.Enter(); if (StateChanged != null) { StateChanged(); } } currentState.Update(time); }
public void SetDefaultState(IState <IInvertoryLogic, EInvertoryStateID> state) { this.defaultState = state; this.defaultStateID = state.StateType; }
public void TransitionState(EInvertoryStateID goal) { currentState = states.Find(x => x.StateType == goal); }
public FSMInvertory(EInvertoryStateID defaultStateID, ref IInvertoryLogic control) { this.defaultStateID = defaultStateID; this.states = new List <IState <IInvertoryLogic, EInvertoryStateID> >(); this.control = control; }