2026.06.29
This commit is contained in:
@@ -46,6 +46,18 @@ public enum StartMode
|
||||
ManualOnly
|
||||
}
|
||||
|
||||
public enum BiteStartMode
|
||||
{
|
||||
[Tooltip("캐스팅이 끝나면 물 감지와 상관없이 입질 대기를 시작합니다. 개발/테스트 단계에서 추천합니다.")]
|
||||
AfterCastAlways,
|
||||
|
||||
[Tooltip("BobberLineStartPoint가 Water Collider로 감지될 때만 입질 대기를 시작합니다. 완성 단계에서 추천합니다.")]
|
||||
WhenBobberInWater,
|
||||
|
||||
[Tooltip("자동 입질 대기를 시작하지 않습니다. ForceBite() 또는 별도 이벤트로만 입질을 발생시킵니다.")]
|
||||
ManualOnly
|
||||
}
|
||||
|
||||
[Header("Core References")]
|
||||
[SerializeField] private FishingGameManager fishingGameManager;
|
||||
[SerializeField] private FishingHapticManager haptic;
|
||||
@@ -158,6 +170,10 @@ public enum StartMode
|
||||
[SerializeField] private bool useWaterTag = true;
|
||||
[SerializeField] private string waterTag = "Water";
|
||||
|
||||
[Header("Bite Start Rule")]
|
||||
[Tooltip("입질 대기를 언제 시작할지 결정합니다. 테스트 중에는 AfterCastAlways, 실제 물 판정이 필요하면 WhenBobberInWater를 사용하세요.")]
|
||||
[SerializeField] private BiteStartMode biteStartMode = BiteStartMode.AfterCastAlways;
|
||||
|
||||
[Header("Bite")]
|
||||
[SerializeField] private bool useBiteTimer = true;
|
||||
[SerializeField] private Vector2 biteDelayRange = new Vector2(1.5f, 4.0f);
|
||||
@@ -181,7 +197,7 @@ public enum StartMode
|
||||
[Tooltip("If On, Reel Hold Action must be pressed to reel. If Off and Use Reel Grab Events is also Off, being near the reel is enough.")]
|
||||
[SerializeField] private bool useReelHoldAction = true;
|
||||
|
||||
[Tooltip("Button/Grip action used while reeling. Example binding: <XRController>{LeftHand}/gripPressed or <XRController>{LeftHand}/triggerPressed.")]
|
||||
[Tooltip("Button/Grip action used while reeling. Example binding: <XRController>{RightHand}/gripPressed or <XRController>{RightHand}/triggerPressed when the right hand reels.")]
|
||||
[SerializeField] private InputActionReference reelHoldAction;
|
||||
|
||||
[Tooltip("If On, call MarkReelHandleGrabbed/MarkReelHandleReleased from a reel handle XR Grab Interactable or trigger volume.")]
|
||||
@@ -597,9 +613,53 @@ private IEnumerator CastRoutine(Vector3 target)
|
||||
state = BobberState.WaitingInWater;
|
||||
|
||||
Log("찌 캐스팅 완료");
|
||||
HandleBiteStartAfterCast();
|
||||
}
|
||||
|
||||
if (!useWaterOverlapCheck && useBiteTimer)
|
||||
StartWaitingForBite();
|
||||
private void HandleBiteStartAfterCast()
|
||||
{
|
||||
if (!useBiteTimer)
|
||||
{
|
||||
Log("입질 타이머가 꺼져 있어 입질 대기를 시작하지 않습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (biteStartMode)
|
||||
{
|
||||
case BiteStartMode.AfterCastAlways:
|
||||
Log("캐스팅 완료 후 입질 대기를 시작합니다. 물 감지는 진행을 막지 않습니다.");
|
||||
StartWaitingForBite();
|
||||
break;
|
||||
|
||||
case BiteStartMode.WhenBobberInWater:
|
||||
if (!useWaterOverlapCheck)
|
||||
{
|
||||
Log("물 감지가 꺼져 있어 캐스팅 완료 후 입질 대기를 시작합니다.");
|
||||
StartWaitingForBite();
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsBobberOverlappingWater())
|
||||
{
|
||||
if (!bobberInWater)
|
||||
{
|
||||
bobberInWater = true;
|
||||
Log("찌가 물에 들어감");
|
||||
}
|
||||
|
||||
StartWaitingForBite();
|
||||
}
|
||||
else
|
||||
{
|
||||
bobberInWater = false;
|
||||
Log("캐스팅은 완료됐지만 찌가 물로 감지되지 않았습니다. Water Collider/Tag/Layer와 BobberLineStartPoint 위치를 확인하세요.");
|
||||
}
|
||||
break;
|
||||
|
||||
case BiteStartMode.ManualOnly:
|
||||
Log("수동 입질 모드입니다. ForceBite() 또는 별도 이벤트로 입질을 발생시켜야 합니다.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator MoveBobberRoutine(Vector3 target, float duration, BobberState endState)
|
||||
@@ -625,7 +685,10 @@ private IEnumerator MoveBobberRoutine(Vector3 target, float duration, BobberStat
|
||||
private void StartWaitingForBite()
|
||||
{
|
||||
if (!useBiteTimer)
|
||||
{
|
||||
Log("입질 타이머가 꺼져 있어 입질 대기를 시작하지 않습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (biteWaitRoutine != null || state == BobberState.Bite || state == BobberState.MiniGameActive)
|
||||
return;
|
||||
@@ -644,8 +707,9 @@ private IEnumerator BiteWaitRoutine()
|
||||
{
|
||||
timer += Time.deltaTime;
|
||||
|
||||
if (useWaterOverlapCheck && !bobberInWater)
|
||||
if (biteStartMode == BiteStartMode.WhenBobberInWater && useWaterOverlapCheck && !bobberInWater)
|
||||
{
|
||||
Log("찌가 물에서 벗어나 입질 대기를 취소합니다.");
|
||||
biteWaitRoutine = null;
|
||||
yield break;
|
||||
}
|
||||
@@ -806,14 +870,19 @@ private void UpdateWaterState()
|
||||
if (bobberInWater)
|
||||
{
|
||||
Log("찌가 물에 들어감");
|
||||
if (state == BobberState.Casting || state == BobberState.WaitingInWater || state == BobberState.Idle)
|
||||
|
||||
if (biteStartMode == BiteStartMode.WhenBobberInWater &&
|
||||
(state == BobberState.Casting || state == BobberState.WaitingInWater || state == BobberState.Idle))
|
||||
{
|
||||
StartWaitingForBite();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("찌가 물에서 나감");
|
||||
|
||||
if (state == BobberState.WaitingInWater || state == BobberState.Bite)
|
||||
if (biteStartMode == BiteStartMode.WhenBobberInWater &&
|
||||
(state == BobberState.WaitingInWater || state == BobberState.Bite))
|
||||
{
|
||||
StopBiteWaitOnly();
|
||||
StopBiteShakeOnly();
|
||||
|
||||
Reference in New Issue
Block a user