Beispiel #1
0
    public void KeyboardMovePressed()
    {
        if (onKeyboardMove != null)
        {
            Vector2 moveVec = new Vector2(inputX.Horizontal(), inputX.Vertical());

            onKeyboardMove(moveVec);
        }
    }
Beispiel #2
0
    //Control input events
    private void Update()
    {
        MouseMoved(mouseRotationSpeed);

        if (Mathf.Abs(inputX.Vertical()) >= .1f || Mathf.Abs(inputX.Horizontal()) >= .1f)
        {
            KeyboardMovePressed();
        }

        if (inputX.isSpace())
        {
            PressingSpace();
        }

        if (inputX.isShiftPressed())
        {
            PressedShift();
        }

        if (inputX.isShiftReleased())
        {
            ReleasedShift();
        }
    }
Beispiel #3
0
    public void SetAnimation()
    {
        bool sneak = false;

        if ((Mathf.Abs(inputX.Vertical()) >= .1f || Mathf.Abs(inputX.Horizontal()) >= .1f))
        {
            if (inputX.isShift())            // ... set the speed parameter to 5.5f.
            {
                anim.SetFloat(hash.speedFloat, 5f, 0f, Time.fixedDeltaTime);
            }
            else
            {
                anim.SetFloat(hash.speedFloat, 2.5f, 0f, Time.fixedDeltaTime);
            }
        }
        else
        {
            // Otherwise set the speed parameter to 0.
            anim.SetFloat(hash.speedFloat, 0, 0f, Time.fixedDeltaTime);
        }

        anim.SetBool(hash.sneakingBool, sneak);
    }