디버그 기능 제거
This commit is contained in:
@@ -217,56 +217,7 @@ public class Player : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// 인스펙터 우클릭 메뉴에서 데미지를 테스트할 수 있는 기능 추가
|
||||
[ContextMenu("Debug/Take 5 Damage")]
|
||||
public void DebugTake5Damage()
|
||||
{
|
||||
TakeDamage(5, "인스펙터 디버그 공격");
|
||||
}
|
||||
|
||||
[ContextMenu("Debug/Restore HP")]
|
||||
public void DebugRestoreHP()
|
||||
{
|
||||
hp = maxHp;
|
||||
if (animator != null)
|
||||
{
|
||||
animator.Rebind();
|
||||
animator.Update(0f);
|
||||
}
|
||||
Debug.Log($"플레이어 체력이 {hp}로 회복되었습니다.");
|
||||
|
||||
// 체력 복구 시 다음 캐릭터 이름 및 세대 정보 갱신
|
||||
StartCoroutine(GetNextGenerationFromServer());
|
||||
}
|
||||
|
||||
// 임시 디버그용 화면 버튼 (게임 실행 시 화면 좌측 상단에 뜸)
|
||||
private void OnGUI()
|
||||
{
|
||||
GUI.backgroundColor = Color.red;
|
||||
if (GUI.Button(new Rect(10, 10, 180, 50), "Debug: Take 5 Damage (Trap)"))
|
||||
{
|
||||
TakeDamage(5, "테스트 함정");
|
||||
}
|
||||
|
||||
GUI.backgroundColor = Color.blue;
|
||||
// 기존 겹쳐있던 위치(10, 10)를 피해 y 좌표를 130으로 내렸습니다.
|
||||
if (GUI.Button(new Rect(10, 130, 180, 50), "Debug: Take 3 Damage (Monster)"))
|
||||
{
|
||||
TakeDamage(3, "테스트 몬스터");
|
||||
}
|
||||
|
||||
GUI.backgroundColor = Color.green;
|
||||
if (GUI.Button(new Rect(10, 70, 180, 50), "Debug: Restore HP"))
|
||||
{
|
||||
DebugRestoreHP();
|
||||
}
|
||||
|
||||
// 캐릭터 정보 UI 노출
|
||||
GUI.color = Color.white;
|
||||
GUI.skin.label.fontSize = 16;
|
||||
GUI.Label(new Rect(10, 200, 400, 30), $"이름: {characterName}");
|
||||
GUI.Label(new Rect(10, 230, 400, 30), $"세대: {generation}대손");
|
||||
}
|
||||
|
||||
// 백엔드로부터 다음 세대 번호를 받아와 랜덤 이름과 매핑하는 코루틴
|
||||
private System.Collections.IEnumerator GetNextGenerationFromServer()
|
||||
@@ -343,9 +294,22 @@ public class Player : MonoBehaviour
|
||||
else
|
||||
{
|
||||
Debug.Log("사망 기록 전송 성공: " + request.downloadHandler.text);
|
||||
// 사망 전송 성공 즉시 다음 세대 정보 받아와 자동 갱신
|
||||
StartCoroutine(GetNextGenerationFromServer());
|
||||
}
|
||||
|
||||
// 1. 싱글톤 GameManager의 이전 캐릭터 정보 데이터 초기화 (신규 세대 생성 유도)
|
||||
if (GameManager.Instance != null)
|
||||
{
|
||||
GameManager.Instance.ClearPlayerData();
|
||||
}
|
||||
|
||||
// 2. 플레이어 사망 연출(2초 누워있기) 대기 후 로비 씬으로 씬 전환 실행
|
||||
yield return new WaitForSeconds(2.0f);
|
||||
Debug.Log("[Death Report] 로비 씬(Lobby)으로 되돌아갑니다.");
|
||||
|
||||
// 사망 연출이 종료되었으므로 플레이어 게임 오브젝트를 씬에서 완전히 파괴합니다.
|
||||
Destroy(gameObject);
|
||||
|
||||
UnityEngine.SceneManagement.SceneManager.LoadScene("Lobby");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user