92 lines
2.8 KiB
C#
92 lines
2.8 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
|
|
public class RoomRouteDebugTester : MonoBehaviour
|
|
{
|
|
private List<RoomRouteManager.RoomData> currentChoices =
|
|
new List<RoomRouteManager.RoomData>();
|
|
|
|
private void Update()
|
|
{
|
|
if (RoomRouteManager.Instance == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (Keyboard.current == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
// C키: 방문 안 한 방 중 랜덤 후보 뽑기
|
|
if (Keyboard.current.cKey.wasPressedThisFrame)
|
|
{
|
|
currentChoices = RoomRouteManager.Instance.GetRandomNextRooms();
|
|
|
|
Debug.Log($"현재 선택 가능한 후보 개수: {currentChoices.Count}");
|
|
|
|
for (int i = 0; i < currentChoices.Count; i++)
|
|
{
|
|
Debug.Log($"{i + 1}번 선택지 → 방 번호: {currentChoices[i].roomNumber}, 씬 이름: {currentChoices[i].sceneName}");
|
|
}
|
|
}
|
|
|
|
// 1키: 첫 번째 후보 선택
|
|
if (Keyboard.current.digit1Key.wasPressedThisFrame)
|
|
{
|
|
MoveToChoice(0);
|
|
}
|
|
|
|
// 2키: 두 번째 후보 선택
|
|
if (Keyboard.current.digit2Key.wasPressedThisFrame)
|
|
{
|
|
MoveToChoice(1);
|
|
}
|
|
|
|
// T키: 방문 상태 확인
|
|
if (Keyboard.current.tKey.wasPressedThisFrame)
|
|
{
|
|
Debug.Log($"방문한 방 개수: {RoomRouteManager.Instance.VisitedRoomCount} / {RoomRouteManager.Instance.TotalRoomCount}");
|
|
Debug.Log($"현재 방 번호: {RoomRouteManager.Instance.CurrentRoomNumber}");
|
|
}
|
|
|
|
// X키: 테스트용 방문 기록 초기화
|
|
if (Keyboard.current.xKey.wasPressedThisFrame)
|
|
{
|
|
Debug.Log("방문 기록 초기화");
|
|
currentChoices.Clear();
|
|
RoomRouteManager.Instance.ResetVisitedRooms();
|
|
}
|
|
|
|
// F키: 모든 방 방문 후 마지막 씬 이동 테스트
|
|
if (Keyboard.current.fKey.wasPressedThisFrame)
|
|
{
|
|
Debug.Log("마지막 씬 이동 테스트");
|
|
RoomRouteManager.Instance.MoveToFinalScene();
|
|
}
|
|
}
|
|
|
|
private void MoveToChoice(int index)
|
|
{
|
|
if (currentChoices == null || currentChoices.Count == 0)
|
|
{
|
|
Debug.LogWarning("먼저 C키를 눌러 랜덤 후보를 뽑아야 합니다.");
|
|
return;
|
|
}
|
|
|
|
if (index < 0 || index >= currentChoices.Count)
|
|
{
|
|
Debug.LogWarning("해당 번호의 선택지가 없습니다.");
|
|
return;
|
|
}
|
|
|
|
int targetRoomNumber = currentChoices[index].roomNumber;
|
|
|
|
Debug.Log($"{index + 1}번 선택지 선택 → 방 {targetRoomNumber} 이동");
|
|
|
|
currentChoices.Clear();
|
|
|
|
RoomRouteManager.Instance.MoveToRoom(targetRoomNumber);
|
|
}
|
|
} |