Example #1
0
    void Update()
    {
        //if (Input.GetKeyDown(KeyCode.BackQuote)) {
        //    _movementEnabled = !_movementEnabled;
        //    if (_movementEnabled) {
        //        Cursor.lockState = CursorLockMode.Locked;
        //        Cursor.visible = false;
        //    } else {
        //        Cursor.lockState = CursorLockMode.None;
        //        Cursor.visible = true;
        //    }
        //}

        if (!_movementEnabled)
        {
            return;
        }

        float xRotation = Input.GetAxis("Mouse X") * _mouseSensitivity;
        float yRotation = Input.GetAxis("Mouse Y") * _mouseSensitivity;

        _playerController.Rotate(xRotation, yRotation);

        if (Input.GetKeyDown(KeyCode.Space))
        {
            _playerController.Jump();
        }

        //if (Input.GetKeyDown(KeyCode.Q)) {
        //    _playerController.ToggleNoClip();
        //}
    }