코어, 벽, 적의 생성 및 충돌, 데미지 판정

This commit is contained in:
2026-01-12 13:09:08 +09:00
parent a0cf82e97e
commit 5e2eaee44b
24 changed files with 732 additions and 25 deletions

View File

@@ -0,0 +1,36 @@
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);
}
}