using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class HandMgr : MonoBehaviour { // public ActionBasedController rightHandController; // private bool isFalse = false; // private void Start() // { // // leftHandController.GetComponent().enabled = false; // // rightHandController.GetComponent().enabled = false; // // // // leftHandController.transform.Find("Ray Interactor").gameObject.SetActive(isFalse); // // rightHandController.transform.Find("Ray Interactor").gameObject.SetActive(isFalse); // // isFalse = true; // } // // private float longPressDuration = 0.5f; // 长按的持续时间 // private bool isButtonPressed = false; // private float buttonPressedTime; // private void Update() // { // //只会在按下那一刻返回true // if (rightHandController.selectAction.action.triggered) // { // // if (isFalse) // { // isFalse = false; // } // else // { // isFalse = true; // } // // rightHandController.GetComponent().enabled = isFalse; // // rightHandController.transform.Find("Ray Interactor").gameObject.SetActive(isFalse); // buttonPressedTime = Time.time; // } // // //如果Grip处于按下状态,会一直返回true // if (rightHandController.selectAction.action.IsPressed()) // { // // if (Time.time - buttonPressedTime >= longPressDuration) // { Debug.Log("按住手柄上的Grip键"); // isButtonPressed = false; // 防止重复触发 // // SceneManager.LoadScene("menu"); // } // } // } }