Files
UltimateFishing/Assets/Scripts/Assembly-CSharp/CurvedUI/CurvedUIHandSwitcher.cs
2026-02-21 16:45:37 +08:00

30 lines
981 B
C#

using UnityEngine;
namespace CurvedUI
{
public class CurvedUIHandSwitcher : MonoBehaviour
{
[SerializeField]
private GameObject LaserBeam;
[Tooltip("If true, when player clicks the trigger on the other hand, we'll instantly set it as UI controlling hand and move the pointer to it.")]
[SerializeField]
private bool autoSwitchHands = true;
private void SwitchHandTo(CurvedUIInputModule.Hand newHand)
{
CurvedUIInputModule.Instance.UsedHand = newHand;
if ((bool)CurvedUIInputModule.Instance.ControllerTransform)
{
LaserBeam.transform.SetParent(CurvedUIInputModule.Instance.ControllerTransform);
LaserBeam.transform.ResetTransform();
LaserBeam.transform.LookAt(LaserBeam.transform.position + CurvedUIInputModule.Instance.ControllerPointingDirection);
}
else
{
Debug.LogError("CURVEDUI: No Active controller that can be used as a parent of the pointer. Is the controller gameobject present on the scene and active?");
}
}
}
}