Пример #1
0
    public void UpdateMachine(float time)
    {
        if (states.Count == 0)
        {
            return;
        }

        if (currentStateID == EOrcCombatState.None)
        {
            currentState   = defaultState;
            currentStateID = defaultStateID;
        }
        if (currentState == null)
        {
            return;
        }

        goalID = currentState.CheckTransition();

        if (goalID != currentStateID)
        {
            currentState.Exit();
            TransitionState(goalID);
            currentStateID        = goalID;
            this.concurrentCanRun = currentState.ConcurrentStateCanRun;
            currentState.Enter();

            if (StateChanged != null)
            {
                StateChanged();
            }
        }
        currentState.Update(time);
    }
Пример #2
0
 public OrcAttackState(bool conCurrentCanRun, ref IOrcAttackLogic control,
                       EOrcCombatState stateID, ref IInvertoryLogic invertoryLogic, ref Animator animator)
 {
     this.conCurrentCanRun = conCurrentCanRun;
     this.control          = control;
     this.currentID        = stateID;
     this.invertoryLogic   = invertoryLogic;
     this.animator         = animator;
 }
Пример #3
0
 public void TransitionState(EOrcCombatState goal)
 {
     currentState = states.Find(x => x.StateType == goal);
 }
Пример #4
0
 public void SetDefaultState(IState <IOrcAttackLogic, EOrcCombatState> state)
 {
     this.defaultState   = state;
     this.defaultStateID = state.StateType;
 }
Пример #5
0
 public void Exit()
 {
     currentState.Exit();
     currentState   = defaultState;
     currentStateID = defaultStateID;
 }
Пример #6
0
 public OrcMeleeIdle(bool conCurrentCanRun, ref IOrcAttackLogic control, EOrcCombatState currentID)
 {
     this.conCurrentCanRun = conCurrentCanRun;
     this.control          = control;
     this.currentID        = currentID;
 }