Esempio n. 1
0
    /// <summary>
    /// Gets the player input.
    /// </summary>
    void GetPlayerInput()
    {
        // Read X and Y position of the mouse.
        mouseX += Input.GetAxis("Mouse X") * x_mouseSensitivity * (invertX ? -1 : 1);
        mouseY -= Input.GetAxis("Mouse Y") * y_mouseSensitivity * (invertY ? -1 : 1);

        // Limit the Y rotation between the specified min and max limits.
        mouseY = TP_Helper.ClampAngle(mouseY, minY, maxY);

        if (Input.GetKeyDown(KeyCode.F))
        {
            smoothDamp = !smoothDamp;
            print("SmoothDamp: " + smoothDamp);
        }

        if (Input.GetKeyDown(KeyCode.V))
        {
            FOVKick = !FOVKick;
            print("FOVKick: " + FOVKick);
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            HeadBob = !HeadBob;
            print("HeadBob: " + HeadBob);
        }

        if (Input.GetKeyDown(KeyCode.C))
        {
            hideCursor       = !hideCursor;
            Cursor.lockState = hideCursor ? CursorLockMode.Locked : CursorLockMode.None;
            Cursor.visible   = hideCursor;
            print("HideCursor: " + hideCursor);
        }
    }
Esempio n. 2
0
    void HandlePlayerInput()
    {
        float deadZone = 0.01f;

        //if (Input.GetMouseButton(1) == true) {
        mouseX += Input.GetAxis("Mouse X") * X_MouseSensitivity;
        mouseY += Input.GetAxis("Mouse Y") * -Y_MouseSensitivity; // min weghalen voor inverten
        //}

        mouseY = TP_Helper.ClampAngle(mouseY, Y_MinLimit, Y_MaxLimit);

        if (Input.GetAxis("Mouse ScrollWheel") < -deadZone || Input.GetAxis("Mouse ScrollWheel") > deadZone)
        {
            desiredDistance      = Mathf.Clamp(distance - Input.GetAxis("Mouse ScrollWheel") * MouseWheelSensitivity, distanceMin, distanceMax);
            _preOccludedDistance = desiredDistance;
        }
    }
Esempio n. 3
0
    void HandlePlayerInput()
    {
        float deadZone = 0.01f;

        mouseX += Input.GetAxis(horizontalAxis) * sensitivityX;
        if (!invertY)
        {
            mouseY -= Input.GetAxis(verticalAxis) * sensitivityY;
        }
        else
        {
            mouseY += Input.GetAxis(verticalAxis) * sensitivityY;
        }

        // Limit mouseY
        mouseY = TP_Helper.ClampAngle(mouseY, minLimitY, maxLimitY);

        if (Input.GetAxis(zoomAxis) < -deadZone || Input.GetAxis(zoomAxis) > deadZone)
        {
            desiredDistance = Mathf.Clamp(distance - Input.GetAxis(zoomAxis) * sensitivityZoom, distanceMin, distanceMax);
        }
    }