문달기
This commit is contained in:
@@ -18,12 +18,41 @@ public class RaftRideEndHandler : MonoBehaviour
|
||||
[Tooltip("도착 후 활성화할 조개 미션 오브젝트")]
|
||||
[SerializeField] private GameObject clamMissionObject;
|
||||
|
||||
[Tooltip("처음에는 꺼두었다가 나중에 기억의 조각 획득 후 켤 문")]
|
||||
[Tooltip("기억의 조각 획득 후 켤 다음 문 오브젝트")]
|
||||
[SerializeField] private GameObject nextDoorObject;
|
||||
|
||||
[Header("Clam Bite Mission")]
|
||||
[Tooltip("도착 후 조개 물림 판정을 시작할지 여부")]
|
||||
[SerializeField] private bool startClamBiteMissionOnArrive = true;
|
||||
|
||||
[Tooltip("직접 연결할 조개 물림 판정 스크립트들입니다. 비워두면 Clam Mission Object 아래에서 자동 탐색합니다.")]
|
||||
[SerializeField] private ClamBiteDetector[] clamBiteDetectors;
|
||||
|
||||
[Header("Clear Options")]
|
||||
[Tooltip("조개 미션 성공 시 조개 물림 판정을 정지합니다.")]
|
||||
[SerializeField] private bool stopClamBiteMissionOnClear = true;
|
||||
|
||||
[Tooltip("조개 미션 성공 시 조개 오브젝트를 계속 유지할지 여부입니다.")]
|
||||
[SerializeField] private bool keepClamMissionObjectAfterClear = true;
|
||||
|
||||
[Tooltip("조개 미션 성공 시 Next Door Object를 켭니다.")]
|
||||
[SerializeField] private bool activateNextDoorOnClear = true;
|
||||
|
||||
[Header("Debug")]
|
||||
[SerializeField] private bool showDebugLog = true;
|
||||
|
||||
private bool hasArrived;
|
||||
private bool clamMissionCleared;
|
||||
|
||||
public void OnRaftArrived()
|
||||
{
|
||||
Debug.Log("[RaftRideEndHandler] 뗏목 도착 처리 시작.");
|
||||
if (hasArrived)
|
||||
return;
|
||||
|
||||
hasArrived = true;
|
||||
|
||||
if (showDebugLog)
|
||||
Debug.Log("[RaftRideEndHandler] 뗏목 도착 처리 시작.");
|
||||
|
||||
if (detachPlayerFromRaft && xrOrigin != null)
|
||||
{
|
||||
@@ -32,7 +61,8 @@ public void OnRaftArrived()
|
||||
|
||||
if (exitPoint != null && xrOrigin != null)
|
||||
{
|
||||
// 강제로 이동시키고 싶지 않으면 이 부분은 주석 처리해도 됨.
|
||||
// 현재는 강제 이동하지 않음.
|
||||
// 필요하면 아래 두 줄을 활성화.
|
||||
// xrOrigin.position = exitPoint.position;
|
||||
// xrOrigin.rotation = exitPoint.rotation;
|
||||
}
|
||||
@@ -52,6 +82,126 @@ public void OnRaftArrived()
|
||||
nextDoorObject.SetActive(false);
|
||||
}
|
||||
|
||||
Debug.Log("[RaftRideEndHandler] 이제 플레이어가 육지로 이동해 조개 미션을 진행할 수 있습니다.");
|
||||
if (startClamBiteMissionOnArrive)
|
||||
{
|
||||
StartClamBiteMission();
|
||||
}
|
||||
|
||||
if (showDebugLog)
|
||||
Debug.Log("[RaftRideEndHandler] 도착 처리 완료. 육지/조개 미션 진행 가능.");
|
||||
}
|
||||
|
||||
public void OnClamMissionCleared()
|
||||
{
|
||||
if (clamMissionCleared)
|
||||
return;
|
||||
|
||||
clamMissionCleared = true;
|
||||
|
||||
if (showDebugLog)
|
||||
Debug.Log("[RaftRideEndHandler] 조개 미션 클리어. 다음 문을 엽니다.");
|
||||
|
||||
if (stopClamBiteMissionOnClear)
|
||||
{
|
||||
StopClamBiteMission();
|
||||
}
|
||||
|
||||
if (clamMissionObject != null && !keepClamMissionObjectAfterClear)
|
||||
{
|
||||
clamMissionObject.SetActive(false);
|
||||
}
|
||||
|
||||
if (activateNextDoorOnClear && nextDoorObject != null)
|
||||
{
|
||||
nextDoorObject.SetActive(true);
|
||||
}
|
||||
else if (activateNextDoorOnClear && nextDoorObject == null)
|
||||
{
|
||||
Debug.LogWarning("[RaftRideEndHandler] Next Door Object가 연결되지 않았습니다.", this);
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenNextDoor()
|
||||
{
|
||||
if (nextDoorObject == null)
|
||||
{
|
||||
Debug.LogWarning("[RaftRideEndHandler] Next Door Object가 연결되지 않았습니다.", this);
|
||||
return;
|
||||
}
|
||||
|
||||
nextDoorObject.SetActive(true);
|
||||
|
||||
if (showDebugLog)
|
||||
Debug.Log("[RaftRideEndHandler] Next Door Object 활성화.");
|
||||
}
|
||||
|
||||
public void CloseNextDoor()
|
||||
{
|
||||
if (nextDoorObject == null)
|
||||
return;
|
||||
|
||||
nextDoorObject.SetActive(false);
|
||||
|
||||
if (showDebugLog)
|
||||
Debug.Log("[RaftRideEndHandler] Next Door Object 비활성화.");
|
||||
}
|
||||
|
||||
private void StartClamBiteMission()
|
||||
{
|
||||
ResolveClamBiteDetectors();
|
||||
|
||||
if (clamBiteDetectors == null || clamBiteDetectors.Length == 0)
|
||||
{
|
||||
if (showDebugLog)
|
||||
Debug.LogWarning("[RaftRideEndHandler] ClamBiteDetector를 찾지 못했습니다.", this);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (ClamBiteDetector detector in clamBiteDetectors)
|
||||
{
|
||||
if (detector == null)
|
||||
continue;
|
||||
|
||||
detector.StartBiteMission();
|
||||
}
|
||||
|
||||
if (showDebugLog)
|
||||
Debug.Log("[RaftRideEndHandler] 조개 물림 미션 시작.");
|
||||
}
|
||||
|
||||
private void StopClamBiteMission()
|
||||
{
|
||||
ResolveClamBiteDetectors();
|
||||
|
||||
if (clamBiteDetectors == null || clamBiteDetectors.Length == 0)
|
||||
return;
|
||||
|
||||
foreach (ClamBiteDetector detector in clamBiteDetectors)
|
||||
{
|
||||
if (detector == null)
|
||||
continue;
|
||||
|
||||
detector.StopBiteMission();
|
||||
}
|
||||
|
||||
if (showDebugLog)
|
||||
Debug.Log("[RaftRideEndHandler] 조개 물림 미션 정지.");
|
||||
}
|
||||
|
||||
private void ResolveClamBiteDetectors()
|
||||
{
|
||||
if (clamBiteDetectors != null && clamBiteDetectors.Length > 0)
|
||||
return;
|
||||
|
||||
if (clamMissionObject != null)
|
||||
{
|
||||
clamBiteDetectors = clamMissionObject.GetComponentsInChildren<ClamBiteDetector>(true);
|
||||
}
|
||||
|
||||
if (clamBiteDetectors == null || clamBiteDetectors.Length == 0)
|
||||
{
|
||||
clamBiteDetectors = FindObjectsByType<ClamBiteDetector>(FindObjectsSortMode.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user