// Update is called once per frame void Update() { device = SteamVR_Controller.Input((int)trackedObject.index); if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Touchpad)) { if (!isLeftHand) { objectMenuManager.EnableMenu(); touchLast = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).x; } } if (device.GetTouch(SteamVR_Controller.ButtonMask.Touchpad)) { if (!isLeftHand) { // TODO: This resets when I move the figure back to the middle touchCurrent = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).x; distance = touchCurrent - touchLast; touchLast = touchCurrent; swipeSum += distance; if (!hasSwipedRight) { if (swipeSum > 0.5f) { swipeSum = 0; objectMenuManager.MenuRight(); hasSwipedRight = true; hasSwipedLeft = false; } } if (!hasSwipedLeft) { if (swipeSum < -0.5f) { swipeSum = 0; objectMenuManager.MenuLeft(); hasSwipedLeft = true; hasSwipedRight = false; } } } } if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Touchpad)) { if (!isLeftHand) { objectMenuManager.DisableMenu(); swipeSum = 0; touchCurrent = 0; touchLast = 0; hasSwipedLeft = false; hasSwipedRight = false; } } if (device.GetPressDown(SteamVR_Controller.ButtonMask.Trigger)) { if (introMenu != null && introMenu.activeSelf) { introMenu.SetActive(false); } if (sceneManager.IsLevelComplete()) { sceneManager.LoadNextLevel(); } if (!isLeftHand && objectMenuManager.IsMenuEnabled()) { objectMenuManager.SpawnCurrentObject(); } } }
void hideMenu() { objectMenuManager.DisableMenu(); isMenuActive = false; }