TaiZhouCangChu_VRanime/Assets/Scripts/HandMgr.cs

58 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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<ActionBasedControllerManager>().enabled = false;
// // rightHandController.GetComponent<ActionBasedControllerManager>().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<ActionBasedControllerManager>().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");
// }
// }
// }
}