Files
WhaleAdventure_VR/Assets/My project/Fishing Scripts/UI/FishingRodState.cs
2026-06-25 17:39:42 +09:00

38 lines
834 B
C#

using UnityEngine;
/// <summary>
/// 낚싯대를 잡고 있는지 기록하는 간단한 상태 스크립트입니다.
/// FishingRod 오브젝트에 붙이고, XR Grab Interactable의 Select Entered/Exited 이벤트에 연결하세요.
/// </summary>
public class FishingRodState : MonoBehaviour
{
[Header("State")]
[SerializeField] private bool isHeld;
[Header("Debug")]
[SerializeField] private bool showDebugLog = true;
public bool IsHeld => isHeld;
public void MarkHeld()
{
SetHeld(true);
}
public void MarkReleased()
{
SetHeld(false);
}
public void SetHeld(bool value)
{
if (isHeld == value)
return;
isHeld = value;
if (showDebugLog)
Debug.Log(isHeld ? "낚싯대 잡음" : "낚싯대 놓음");
}
}