타워 선택 건설 및 몹 웨이브 생성
Defence용 Scene 별도 생성
This commit is contained in:
@@ -32,30 +32,25 @@ public class WaveManager : MonoBehaviour
|
||||
|
||||
IEnumerator StartWaveRoutine()
|
||||
{
|
||||
// 모든 웨이브를 순회
|
||||
// 실행하는 오브젝트의 이름과 고유 ID를 출력
|
||||
Debug.Log($"[{gameObject.name} : {gameObject.GetInstanceID()}] 코루틴 가동 시작. 총 웨이브: {waves.Count}");
|
||||
|
||||
while (_currentWaveIndex < waves.Count)
|
||||
{
|
||||
Wave currentWave = waves[_currentWaveIndex];
|
||||
Debug.Log($"현재 인덱스: {_currentWaveIndex}, 웨이브명: {currentWave.waveName}");
|
||||
|
||||
Debug.Log($"Wave {_currentWaveIndex + 1}: {currentWave.waveName} 시작!");
|
||||
|
||||
// 1. 적 소환 로직
|
||||
for (int i = 0; i < currentWave.count; i++)
|
||||
{
|
||||
SpawnEnemy(currentWave.enemyPrefab);
|
||||
|
||||
// 지정된 간격만큼 대기 (이게 코루틴의 핵심입니다)
|
||||
yield return new WaitForSeconds(currentWave.spawnRate);
|
||||
}
|
||||
|
||||
// 2. 다음 웨이브 전까지 대기
|
||||
Debug.Log("웨이브 종료. 다음 웨이브 대기 중...");
|
||||
_currentWaveIndex++; // 여기서 인덱스를 올림
|
||||
yield return new WaitForSeconds(timeBetweenWaves);
|
||||
|
||||
_currentWaveIndex++;
|
||||
}
|
||||
|
||||
Debug.Log("모든 웨이브가 종료되었습니다!");
|
||||
Debug.Log($"[{gameObject.name}] 모든 웨이브 종료");
|
||||
}
|
||||
|
||||
void SpawnEnemy(GameObject enemyPrefab)
|
||||
|
||||
Reference in New Issue
Block a user