Example #1
0
    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
    }
Example #2
0
    public override State Evaluate(States s)
    {
        State result = currentState.Evaluate(s);

        if (result != currentState)
        {
            currentState.Exit(true);
            currentState = result;
            currentState.Entry(true);
        }

        return(this);
    }
Example #3
0
        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;
 }
Example #5
0
 private void ChangeState(State state)
 {
     if (this.state != state) {
         this.state = state;
         state.Entry();
         if (Logger.IsInfoEnabled) {
             Logger.Info(state.ToString());
         }
     }
 }
Example #6
0
 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());
         }
     }
 }
Example #7
0
 public override void Entry(bool crossFade = false)
 {
     currentState = states["STANDING"];
     currentState.Entry();
 }