public void ChangeState(string newState) { switch (newState) { case "idle": currentState = idleState; break; case "run": currentState = runState; break; case "jump": currentState = jumpState; break; case "shoot": currentState = shootState; break; default: Debug.Log(newState + " is not a valid state for the player to change to"); break; } currentState.Entry(); //Assuming we always change state when calling this method }
public override State Evaluate(States s) { State result = currentState.Evaluate(s); if (result != currentState) { currentState.Exit(true); currentState = result; currentState.Entry(true); } return(this); }
public void SetAnimationStateMachine(RigType rig, States initialState) { state = initialState; switch (rig) { case RigType.FOOT: animationStateMachine = new PlayerState(initialState, "Player State Machine", this.gameObject); break; case RigType.CHARSELECT: animationStateMachine = new CharSelectState(initialState, "Char Select State Machine", this.gameObject); break; default: break; } animationStateMachine.Entry(); }
public override void EnterStartState() { State.Entry(this); return; }
private void ChangeState(State state) { if (this.state != state) { this.state = state; state.Entry(); if (Logger.IsInfoEnabled) { Logger.Info(state.ToString()); } } }
private void ChangeState(State state) { if (this.state != state) { State prev = this.state; this.state = state; state.Entry(); if (log.IsInfoEnabled) { log.Info(state.ToString()); } } }
public override void Entry(bool crossFade = false) { currentState = states["STANDING"]; currentState.Entry(); }