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); }
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; }
public void TransitionState(EOrcCombatState goal) { currentState = states.Find(x => x.StateType == goal); }
public void SetDefaultState(IState <IOrcAttackLogic, EOrcCombatState> state) { this.defaultState = state; this.defaultStateID = state.StateType; }
public void Exit() { currentState.Exit(); currentState = defaultState; currentStateID = defaultStateID; }
public OrcMeleeIdle(bool conCurrentCanRun, ref IOrcAttackLogic control, EOrcCombatState currentID) { this.conCurrentCanRun = conCurrentCanRun; this.control = control; this.currentID = currentID; }