using Microsoft.MixedReality.Toolkit.UI; using UnityEngine; public class HandConstraintMenu : MonoBehaviour { public static HandConstraintMenu Instance; [HideInInspector] public bool isConstraint = false; public PressableButtonHoloLens2 CommandPanelMenu; public PressableButtonHoloLens2 ReceiveCommandMenu; public PressableButtonHoloLens2 QuitMenu; public GameObject commandpanel; public GameObject receiveCommand; public Transform anchorObj; public ImpotAnchorScript impotAnchorScript; public FunctionSync_PositionRoate positionRoate; private void Awake() { Instance = this; Init(); } private void Init() { isConstraint = true; QuitMenu.ButtonPressed.AddListener(() => ControlManager.Instance.EndofRoom()); ReceiveCommandMenu.ButtonPressed.AddListener(() => ShowPanel(receiveCommand)); CommandPanelMenu.ButtonPressed.AddListener(() => ShowPanel(commandpanel)); } public void OnHandActive(GameObject ShowObj) { // if (isConstraint) ShowObj.SetActive(true); } public void ShowPanel(GameObject showPanel) { if (showPanel.activeInHierarchy) { showPanel.SetActive(false); } else { showPanel.SetActive(true); } } private void OnDestroy() { Destroy(gameObject); } public void UP() { anchorObj.localPosition += new Vector3(0, 0.05f, 0); positionRoate.GetControl(); //if (anchorObj.localPosition.y > impotAnchorScript.anchorOriginalPos.y + 5) //{ // anchorObj.localPosition = new Vector3(impotAnchorScript.anchorOriginalPos.x, impotAnchorScript.anchorOriginalPos.y + 3, impotAnchorScript.anchorOriginalPos.z); // positionRoate.GetControl(); //} //else //{ // anchorObj.localPosition += new Vector3(0, 0.05f, 0); // positionRoate.GetControl(); //} } public void Down() { anchorObj.localPosition += new Vector3(0, -0.05f, 0); positionRoate.GetControl(); //if (anchorObj.localPosition.y <= impotAnchorScript.anchorOriginalPos.y) //{ // anchorObj.localPosition = new Vector3(impotAnchorScript.anchorOriginalPos.x, impotAnchorScript.anchorOriginalPos.y, impotAnchorScript.anchorOriginalPos.z); // positionRoate.GetControl(); //} //else //{ // anchorObj.localPosition += new Vector3(0, -0.05f, 0); // positionRoate.GetControl(); //} } }