2026.06.25 Fishing scene
This commit is contained in:
37
Assets/My project/Fishing Scripts/UI/FishingRodState.cs
Normal file
37
Assets/My project/Fishing Scripts/UI/FishingRodState.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
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 ? "낚싯대 잡음" : "낚싯대 놓음");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user