게이트 완성
This commit is contained in:
@@ -10,8 +10,13 @@ public class RoomClearGateController : MonoBehaviour
|
||||
|
||||
private bool isRoomCleared = false;
|
||||
private bool gateOpened = false;
|
||||
|
||||
private string selectedSceneCode = "";
|
||||
|
||||
// 랜덤 선택지 1, 2에 들어갈 씬 코드
|
||||
private string choiceSceneCode1 = "";
|
||||
private string choiceSceneCode2 = "";
|
||||
|
||||
public bool IsRoomCleared => isRoomCleared;
|
||||
public string SelectedSceneCode => selectedSceneCode;
|
||||
public bool HasSelectedScene => !string.IsNullOrEmpty(selectedSceneCode);
|
||||
@@ -22,7 +27,50 @@ public void MarkRoomCleared()
|
||||
Debug.Log("방 클리어 완료. 이제 선택지에서 다음 방을 고를 수 있습니다.");
|
||||
}
|
||||
|
||||
// 기존 트리거가 이걸 호출해도, 선택 전이면 문 안 열리게 막음
|
||||
// GameClear에서 랜덤으로 뽑은 선택지 코드를 여기에 저장
|
||||
public void SetDoorChoices(string code1, string code2)
|
||||
{
|
||||
choiceSceneCode1 = code1;
|
||||
choiceSceneCode2 = code2;
|
||||
|
||||
Debug.Log("문 선택지 1 코드: " + choiceSceneCode1);
|
||||
Debug.Log("문 선택지 2 코드: " + choiceSceneCode2);
|
||||
}
|
||||
|
||||
// 대화 선택지 1번에서 호출
|
||||
public void OpenDoorChoice1()
|
||||
{
|
||||
OpenDoor(choiceSceneCode1);
|
||||
}
|
||||
|
||||
// 대화 선택지 2번에서 호출
|
||||
public void OpenDoorChoice2()
|
||||
{
|
||||
OpenDoor(choiceSceneCode2);
|
||||
}
|
||||
|
||||
// 실제 문 열기
|
||||
public void OpenDoor(string code)
|
||||
{
|
||||
if (string.IsNullOrEmpty(code))
|
||||
{
|
||||
Debug.LogWarning("선택된 씬 코드가 비어있습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
selectedSceneCode = code;
|
||||
|
||||
Debug.Log("선택된 다음 씬 코드: " + selectedSceneCode);
|
||||
|
||||
if (exitGate != null)
|
||||
{
|
||||
exitGate.SetNextSceneName(selectedSceneCode);
|
||||
}
|
||||
|
||||
OpenClearGate();
|
||||
}
|
||||
|
||||
// 문 열기 실행
|
||||
public void OpenClearGate()
|
||||
{
|
||||
if (requireRoomClearedBeforeOpen && !isRoomCleared)
|
||||
@@ -55,23 +103,12 @@ public void OpenClearGate()
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenDoor(string code)
|
||||
{
|
||||
selectedSceneCode = code;
|
||||
|
||||
Debug.Log("선택된 다음 씬 코드: " + selectedSceneCode);
|
||||
|
||||
if (exitGate != null)
|
||||
{
|
||||
exitGate.SetNextSceneName(selectedSceneCode);
|
||||
}
|
||||
|
||||
OpenClearGate();
|
||||
}
|
||||
public void ResetClearState()
|
||||
{
|
||||
isRoomCleared = false;
|
||||
gateOpened = false;
|
||||
selectedSceneCode = "";
|
||||
choiceSceneCode1 = "";
|
||||
choiceSceneCode2 = "";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user