Files
WhaleAdventure_VR/Assets/02_Scripts/Managers/change room manager/RoomClearGateController.cs

53 lines
1.2 KiB
C#

using UnityEngine;
public class RoomClearGateController : MonoBehaviour
{
[Header("방 클리어 후 열릴 게이트")]
[SerializeField] private RoomExitGate exitGate;
private bool isRoomCleared = false;
private bool gateOpened = false;
public bool IsRoomCleared => isRoomCleared;
// 블랙잭 최종 승리 후 호출
// 이 함수는 게이트를 바로 열지 않고, "방 클리어 완료" 상태만 저장함
public void MarkRoomCleared()
{
isRoomCleared = true;
Debug.Log("방 클리어 완료. 이제 오픈존에 들어가면 게이트가 열립니다.");
}
// 오픈존에 들어갔을 때 호출
public void OpenClearGate()
{
if (!isRoomCleared)
{
Debug.Log("아직 방 클리어 전이라 게이트를 열 수 없습니다.");
return;
}
if (gateOpened)
{
return;
}
gateOpened = true;
if (exitGate != null)
{
exitGate.OpenGate();
Debug.Log("방 클리어 게이트 오픈");
}
else
{
Debug.LogWarning("Exit Gate가 연결되지 않았습니다.");
}
}
public void ResetClearState()
{
isRoomCleared = false;
gateOpened = false;
}
}