using UnityEngine; using UnityEngine.SceneManagement; // 씬 재시작용 public class GameManager : MonoBehaviour { private bool _isGameOver = false; private void OnEnable() { // Core의 파괴 이벤트를 구독 Core.OnCoreDestroyed += GameOver; } private void OnDisable() { Core.OnCoreDestroyed -= GameOver; } private void GameOver() { if (_isGameOver) return; _isGameOver = true; Debug.Log("Game Over! Core has been destroyed."); // 여기에 패배 UI 표시 로직 등을 넣습니다. // 예: 3초 후 게임 재시작 Invoke(nameof(RestartGame), 3f); } private void RestartGame() { // 현재 활성화된 씬을 다시 로드 SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } }