static void Postfix(ref float ___currentZoomVelocity, float ___zoomInTime, float ___zoomOutTime, float ___normalFOV, float ___zoomedFOV) { try { if (thisModEntry.Active && VRManager.IsVREnabled()) { VRTK_ControllerEvents secondaryEvents = VRTK_DeviceFinder.GetControllerRightHand(false).GetComponent <VRTK_ControllerEvents>(); Vector2 axis = secondaryEvents.GetAxis( VRTK_DeviceFinder.GetHeadsetType() == SDK_BaseHeadset.HeadsetType.WindowsMixedReality ? VRTK_ControllerEvents.Vector2AxisAlias.TouchpadTwo : VRTK_ControllerEvents.Vector2AxisAlias.Touchpad ); float zoomedFactor = ___normalFOV / ___zoomedFOV; if (axis.y < 0.625f && XRDevice.fovZoomFactor > 1f) { XRDevice.fovZoomFactor = Mathf.SmoothDamp(XRDevice.fovZoomFactor, 1.0f, ref ___currentZoomVelocity, ___zoomOutTime); } if (axis.y > 0.625f && XRDevice.fovZoomFactor < zoomedFactor) { XRDevice.fovZoomFactor = Mathf.SmoothDamp(XRDevice.fovZoomFactor, zoomedFactor, ref ___currentZoomVelocity, ___zoomInTime); } } } catch (Exception e) { Debug.LogError(string.Format("Exception thrown during CameraZoom.ZoomMechanic postfix patch:\n{0}", e.Message)); OnCriticalFailure(); } }
// Token: 0x06000A02 RID: 2562 RVA: 0x0003DF54 File Offset: 0x0003C154 private void Start() { if (XRDevice.isPresent) { this.pcControls.SetActive(false); this.controlsImage.gameObject.SetActive(true); this.resetButton.interactable = false; VRTK_DeviceFinder.Headsets headsetType = VRTK_DeviceFinder.GetHeadsetType(true); if (headsetType == VRTK_DeviceFinder.Headsets.OculusRift) { this.controlsImage.sprite = this.oculusRiftSprite; return; } if (headsetType == VRTK_DeviceFinder.Headsets.Vive) { this.controlsImage.sprite = this.htcViveSprite; return; } Debug.LogError(string.Concat(new object[] { "Device not found for controls: ", XRDevice.model, " : ", VRTK_DeviceFinder.GetHeadsetType(true) })); this.controlsImage.sprite = this.oculusRiftSprite; } }
// Update is called once per frame void Update() { if (headsetType == SDK_BaseHeadset.HeadsetType.Undefined) { headsetType = VRTK_DeviceFinder.GetHeadsetType(); } if (headsetType == SDK_BaseHeadset.HeadsetType.OculusRift) { transform.localPosition = OculusRiftPosition; transform.localRotation = Quaternion.Euler(OculusRiftRotation); } }
public void evaluateControllerType() { SDK_BaseHeadset.HeadsetType headset = VRTK_DeviceFinder.GetHeadsetType(); if (headset == SDK_BaseHeadset.HeadsetType.OculusRift) { setOculusTouchControls(); } else if (headset == SDK_BaseHeadset.HeadsetType.HTCVive) { setViveWandControls(); } else { Debug.LogWarning("Unrecognized controller type, using default input"); } }
// Token: 0x060007FD RID: 2045 RVA: 0x0002FC68 File Offset: 0x0002DE68 private void Start() { if (FileBasedPrefs.GetInt("isTutorial", 0) == 1) { GameController.instance.OnGhostSpawned.AddListener(new UnityAction(this.GhostSpawned)); GameController.instance.isTutorial = true; this.missionWhiteBoard.SetActive(false); this.tutorialWhiteBoard.SetActive(true); SetupPhaseController.instance.BeginHuntingPhase(); this.tvLight.enabled = true; this.tvLight.intensity = 0.4f; this.trainingTVCanvas.gameObject.SetActive(true); Object.Destroy(this.tvRemote); this.trainingRemote.enabled = true; for (int i = 0; i < this.probes.Length; i++) { this.probes[i].RenderProbe(); } for (int j = 0; j < this.slides.Length; j++) { this.slides[j].SetActive(false); } this.slides[0].SetActive(true); if (XRDevice.isPresent) { this.VRControls.SetActive(true); VRTK_DeviceFinder.Headsets headsetType = VRTK_DeviceFinder.GetHeadsetType(true); if (headsetType == VRTK_DeviceFinder.Headsets.OculusRift) { this.OculusControls.SetActive(true); return; } if (headsetType == VRTK_DeviceFinder.Headsets.Vive) { this.ViveControls.SetActive(true); return; } } else { this.NonVRControls.SetActive(true); } } }
// Update is called once per frame void Update() { //スワイプ値リセット IsOnSwipeHorizontal = false; IsOnSwipeVertical = false; diffTouchPadX = 0f; diffTouchPadY = 0f; VRTK_ControllerReference reference = VRTK_ControllerReference.GetControllerReference(gameObject); if (headsetType == SDK_BaseHeadset.HeadsetType.Undefined) { headsetType = VRTK_DeviceFinder.GetHeadsetType(); } if (headsetType == SDK_BaseHeadset.HeadsetType.OculusRift) { //Riftでのタッチパッドの移動量取得 var axis = VRTK_SDK_Bridge.GetControllerAxis(SDK_BaseController.ButtonTypes.Touchpad, reference); var absX = Mathf.Abs(axis.x); var absY = Mathf.Abs(axis.y); if (absX > absY) //X軸スワイプ { if (absX > TOUCH_MARGIN) { IsOnSwipeHorizontal = true; diffTouchPadX = (axis.x - TOUCH_MARGIN) * 0.05f * Time.deltaTime * 30f; } } else //Y軸スワイプ { if (absY > TOUCH_MARGIN) { IsOnSwipeVertical = true; diffTouchPadY = (axis.y - TOUCH_MARGIN) * 0.05f * Time.deltaTime * 30f; } } } else //Rift以外の場合 { //Viveでのタッチパッドの移動量取得 if (VRTK_SDK_Bridge.GetControllerButtonState(SDK_BaseController.ButtonTypes.Touchpad, SDK_BaseController.ButtonPressTypes.TouchDown, reference)) { touchMarginSumX = 0f; touchMarginSumY = 0f; prevTouchPadX = VRTK_SDK_Bridge.GetControllerAxis(SDK_BaseController.ButtonTypes.Touchpad, reference).x; prevTouchPadY = VRTK_SDK_Bridge.GetControllerAxis(SDK_BaseController.ButtonTypes.Touchpad, reference).y; } else if (VRTK_SDK_Bridge.GetControllerButtonState(SDK_BaseController.ButtonTypes.Touchpad, SDK_BaseController.ButtonPressTypes.Touch, reference)) { float nowTouchPadX = VRTK_SDK_Bridge.GetControllerAxis(SDK_BaseController.ButtonTypes.Touchpad, reference).x; diffTouchPadX = nowTouchPadX - prevTouchPadX; if (touchMarginSumX > TOUCH_MARGIN) //タッチ移動量がマージンを超えたら { IsOnSwipeHorizontal = true; } prevTouchPadX = nowTouchPadX; touchMarginSumX += Mathf.Abs(diffTouchPadX); float nowTouchPadY = VRTK_SDK_Bridge.GetControllerAxis(SDK_BaseController.ButtonTypes.Touchpad, reference).y; diffTouchPadY = nowTouchPadY - prevTouchPadY; if (touchMarginSumY > TOUCH_MARGIN) //タッチ移動量がマージンを超えたら { IsOnSwipeVertical = true; } prevTouchPadY = nowTouchPadY; touchMarginSumY += Mathf.Abs(diffTouchPadY); } } }