示例#1
0
        public void Refresh()
        {
            _firstPersonFlyingController = Resources.FindObjectsOfTypeAll <FirstPersonFlyingController>().FirstOrDefault();
            _vrInputModule = _firstPersonFlyingController.GetField <VRInputModule, FirstPersonFlyingController>("_vrInputModule");
            _vrInputModule.transform.SetParent(transform);
            _firstPersonFlyingController.transform.SetParent(transform);

            _firstPersonFlyingController.SetField("_cameraFov", _options.CameraFOV);
            _firstPersonFlyingController.SetField("_moveSensitivity", _options.MoveSensitivity);
            _firstPersonFlyingController.GetField <Camera, FirstPersonFlyingController>("_camera").fieldOfView = _options.CameraFOV;
        }
示例#2
0
 /// <summary>
 /// Refreshes the FPFC Variables.
 /// </summary>
 public void Refresh()
 {
     _firstPersonFlyingController = Resources.FindObjectsOfTypeAll <FirstPersonFlyingController>().FirstOrDefault();
     _vrInputModule = _firstPersonFlyingController.GetField <VRInputModule, FirstPersonFlyingController>("_vrInputModule");
     _camera        = _firstPersonFlyingController.GetField <Camera, FirstPersonFlyingController>("_camera");
     _vrInputModule.transform.SetParent(transform);
     if (_originalOriginLocation == null)
     {
         _originalOriginLocation = _firstPersonFlyingController.transform;
     }
     if (_helper.currentXRDeviceModel == XRDeviceModel.Unknown)
     {
         _camera.fieldOfView = _options.CameraFOV;
     }
     _firstPersonFlyingController.transform.SetParent(transform);
     _firstPersonFlyingController.SetField("_cameraFov", _options.CameraFOV);
     _firstPersonFlyingController.SetField("_moveSensitivity", _options.MoveSensitivity);
     _leftController  = _firstPersonFlyingController.GetField <VRController, FirstPersonFlyingController>("_controller0");
     _rightController = _firstPersonFlyingController.GetField <VRController, FirstPersonFlyingController>("_controller1");
 }
示例#3
0
        public void Toggle(bool state)
        {
            if (_firstPersonFlyingController == null)
            {
                _firstPersonFlyingController = Resources.FindObjectsOfTypeAll <FirstPersonFlyingController>().FirstOrDefault();
                _vrInputModule = _firstPersonFlyingController.GetField <VRInputModule, FirstPersonFlyingController>("_vrInputModule");
                _vrInputModule.transform.SetParent(transform);
                _firstPersonFlyingController.transform.SetParent(transform);

                _firstPersonFlyingController.SetField("_cameraFov", _cameraFOV);
                _firstPersonFlyingController.SetField("_moveSensitivity", _moveSensitivity);
                _firstPersonFlyingController.GetField <Camera, FirstPersonFlyingController>("_camera").fieldOfView = _cameraFOV;
            }

            _vrInputModule.enabled = state;
            _vrInputModule.gameObject.SetActive(true);
            _firstPersonFlyingController.enabled = state;
            Cursor.lockState = state ? CursorLockMode.Locked : CursorLockMode.None;
            Cursor.visible   = !state;
            Enabled          = state;
        }