public void Update() { if (planetNavigator.selectedMission != null && CanInteract()) { if (sceneToLoad < 0) { int shift = Mathf.RoundToInt(Input.GetAxis("FormNavigate")); if (shift == 0 && OVRManager.isHmdPresent) { bool triggerLeft = (OVRInput.Get(OVRInput.Axis1D.PrimaryIndexTrigger) > 0 && !isTriggeredLeft); isTriggeredLeft = (triggerLeft) ? true : (OVRInput.Get(OVRInput.Axis1D.PrimaryIndexTrigger) > 0); if (triggerLeft) { shift = -1; } bool triggerRight = (OVRInput.Get(OVRInput.Axis1D.SecondaryIndexTrigger) > 0 && !isTriggeredRight); isTriggeredRight = (triggerRight) ? true : (OVRInput.Get(OVRInput.Axis1D.SecondaryIndexTrigger) > 0); if (triggerRight) { shift = 1; } } if (shift != 0) { planetNavigator.SetMission(planetNavigator.selectedMissionIndex + shift); GUIButton pressed = (shift < 0) ? guiButtonPrevious : guiButtonNext; if (pressed != null) { pressed.Animate(); } } if (Input.GetButtonDown("FormAccept") || OVRInput.Get(OVRInput.Button.One)) { if (planetNavigator.selectedMission.mission.locationScene < SceneManager.sceneCountInBuildSettings) { guiButtonLaunch.Animate(); guiSplashLoading.Animate("fadein"); sceneToLoad = planetNavigator.selectedMission.mission.locationScene; } } } else { SceneManager.LoadSceneAsync(sceneToLoad); sceneToLoad = -1; } } Refresh(); }
public void Update() { if (controllerCenter != null) { GetAimed(controllerLeft); if (itemAimed == null && triggerAimed == null) { GetAimed(controllerRight); } bool triggerLeft = (OVRInput.Get(OVRInput.Axis1D.PrimaryIndexTrigger) > 0 && !isTriggeredLeft); isTriggeredLeft = (triggerLeft) ? true : (OVRInput.Get(OVRInput.Axis1D.PrimaryIndexTrigger) > 0); bool isLeftPressed = (Input.GetButtonDown("InteractLeft") || triggerLeft) && controllerLeftButton != null && !controllerLeftButton.isAnimating; if (isLeftPressed) { controllerLeftButton.Animate(); } bool triggerRight = (OVRInput.Get(OVRInput.Axis1D.SecondaryIndexTrigger) > 0 && !isTriggeredRight); isTriggeredRight = (triggerRight) ? true : (OVRInput.Get(OVRInput.Axis1D.SecondaryIndexTrigger) > 0); bool isRightPressed = (Input.GetButtonDown("InteractRight") || triggerRight) && controllerRightButton != null && !controllerRightButton.isAnimating; if (isRightPressed) { controllerRightButton.Animate(); } if (isLeftPressed || isRightPressed) { if (triggerAimed != null) { triggerAimed.isActivated = true; } else if (itemGrabbed == null) { Grab(); } else { Throw(); } } } }