52 lines
1.1 KiB
C#
52 lines
1.1 KiB
C#
using BitStrap;
|
|
using Rewired.Integration.UnityUI;
|
|
using UnityEngine;
|
|
|
|
public class VRPlayertUIInput : MonoBehaviour
|
|
{
|
|
public FishingPlayer fishingPlayer;
|
|
|
|
public GameObject gazeParent;
|
|
|
|
public GameObject pointerParent;
|
|
|
|
[ReadOnly]
|
|
public bool isOn;
|
|
|
|
private void Awake()
|
|
{
|
|
gazeParent.SetActive(false);
|
|
pointerParent.SetActive(false);
|
|
}
|
|
|
|
public void TurnOnUIController(bool turnOn)
|
|
{
|
|
if (!VRManager.IsVROn())
|
|
{
|
|
return;
|
|
}
|
|
isOn = turnOn;
|
|
RewiredStandaloneInputModule[] array = Object.FindObjectsOfType<RewiredStandaloneInputModule>();
|
|
for (int i = 0; i < array.Length; i++)
|
|
{
|
|
if ((bool)array[i])
|
|
{
|
|
array[i].gameObject.SetActive(!turnOn);
|
|
}
|
|
}
|
|
gazeParent.SetActive(turnOn && VRManager.Instance.uIInputStyle == VRManager.UIInputStyle.GAZE);
|
|
pointerParent.SetActive(turnOn && VRManager.Instance.uIInputStyle == VRManager.UIInputStyle.POINTER);
|
|
HUDManager.Instance.UpdateControls();
|
|
if (turnOn)
|
|
{
|
|
Cursor.visible = true;
|
|
Cursor.lockState = CursorLockMode.None;
|
|
}
|
|
else
|
|
{
|
|
Cursor.visible = false;
|
|
Cursor.lockState = CursorLockMode.Locked;
|
|
}
|
|
}
|
|
}
|