public void SwitchToNewState(MotorStates newStateType)
    {
        if (currentStateType != newStateType)
        {
            currentStateType = newStateType;

            currentStateClass.StateExit();
            currentStateClass = stateClassLookup[newStateType];
            currentStateClass.StateEntry();
        }
    }
    }                                                     //The component that does the raycast checks.


    #region Public
    public void SwitchToNewState(MotorStates newStateType) //This method tells the class to change to a state
    {
        if (currentStateType != newStateType)              //Only change the state when we're not already there
        {
            currentStateType = newStateType;

            currentStateClass.StateExit();  //Tell the current state we're exiting, so it can perform clean ups.
            currentStateClass = stateClassLookup[newStateType];
            currentStateClass.StateEntry(); //Tell the new state we're entering, so it can perform initializations.
        }
    }
    void Awake()
    {
        //Reference
        rb        = GetComponent <Rigidbody2D>();
        raycaster = GetComponent <MotorRaycaster>();
        Feedbacks = GetComponentInChildren <Player2DFeedbacks>();

        //Initialize various variables
        status           = new MotorStatus();
        stateClassLookup = new Dictionary <MotorStates, MotorStateBase> //Store all the FSM classes using their common base class
        {
            { MotorStates.OnGround, new MotorState_MoveOnGround(this, Feedbacks) },
            { MotorStates.Aerial, new MotorState_Aerial(this, Feedbacks) },
            { MotorStates.WallClimb, new MotorState_WallClimb(this, Feedbacks) },
            { MotorStates.Hurt, new MotorState_Hurt(this, Feedbacks) },
        };

        currentStateType  = MotorStates.OnGround;
        currentStateClass = stateClassLookup[currentStateType];
    }
    private void Awake()
    {
        //Reference
        Rb               = GetComponent <Rigidbody>();
        Raycaster        = GetComponent <MotorRaycaster>();
        feedback         = GetComponentInChildren <PlayerFeedbacks>();
        cameraController = GetComponent <Player3rdPersonCamera>();

        //Initialize
        Status           = new PlayerStatus();
        stateClassLookup = new Dictionary <MotorStates, MotorStateBase>
        {
            { MotorStates.OnGround, new MotorState_MoveOnGround(this, feedback) },
            { MotorStates.Aerial, new MotorState_Aerial(this, feedback) },
            //{MotorStates.Hurt,      new MotorState_Hurt(this, Feedbacks)},
        };

        currentStateType  = MotorStates.OnGround;
        currentStateClass = stateClassLookup[currentStateType];
    }