34 lines
723 B
C#
34 lines
723 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class VRChooseHand : MonoBehaviour
|
|
{
|
|
public bool leftHand;
|
|
|
|
public Toggle toggle;
|
|
|
|
private void OnEnable()
|
|
{
|
|
if (toggle == null)
|
|
{
|
|
toggle = GetComponent<Toggle>();
|
|
}
|
|
if ((bool)GlobalSettings.Instance && leftHand == VRControllersManager.Instance.IsLeftHanded())
|
|
{
|
|
toggle.isOn = true;
|
|
}
|
|
}
|
|
|
|
public void ValueChanged()
|
|
{
|
|
if (toggle.isOn)
|
|
{
|
|
if (leftHand != VRControllersManager.Instance.IsLeftHanded())
|
|
{
|
|
VRControllersManager.Instance.SetLeftHanded(leftHand);
|
|
}
|
|
VRManager.Instance.pointerInputParent.GetComponent<HandedInputSelector>().SetActiveController(leftHand ? OVRInput.Controller.LTouch : OVRInput.Controller.RTouch);
|
|
}
|
|
}
|
|
}
|