Exemple #1
0
 public void Reset()
 {
     this.currentState.Exit();
     this.currentState   = defaultState;
     this.currentStateID = defaultStateID;
     this.currentState.Enter();
 }
Exemple #2
0
    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);
    }
Exemple #3
0
 public void SetDefaultState(IState <IInvertoryLogic, EInvertoryStateID> state)
 {
     this.defaultState   = state;
     this.defaultStateID = state.StateType;
 }
Exemple #4
0
 public void TransitionState(EInvertoryStateID goal)
 {
     currentState = states.Find(x => x.StateType == goal);
 }
Exemple #5
0
 public FSMInvertory(EInvertoryStateID defaultStateID, ref IInvertoryLogic control)
 {
     this.defaultStateID = defaultStateID;
     this.states         = new List <IState <IInvertoryLogic, EInvertoryStateID> >();
     this.control        = control;
 }