From 5b3b173bc1573a67b36fcefd84d824fb4c44c520 Mon Sep 17 00:00:00 2001 From: Mingu Kim Date: Tue, 11 Mar 2025 15:40:54 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Gameton/Scripts/Monster/MonsterSpawner.cs | 89 ++++++++----------- 1 file changed, 38 insertions(+), 51 deletions(-) diff --git a/Gameton-06/Assets/Gameton/Scripts/Monster/MonsterSpawner.cs b/Gameton-06/Assets/Gameton/Scripts/Monster/MonsterSpawner.cs index 3456b3bf..8ecc5d9d 100644 --- a/Gameton-06/Assets/Gameton/Scripts/Monster/MonsterSpawner.cs +++ b/Gameton-06/Assets/Gameton/Scripts/Monster/MonsterSpawner.cs @@ -101,57 +101,9 @@ namespace TON { // 플레이어가 죽었을 때 SoundManager.instance.BgSoundPlay(null); - // 필요하다면 gameStarted = false; 등을 설정하여 한 번만 실행되게 함 } } - - private void SpawnBossMonster() - { - GameObject bossPrefab = GetBossPrefabForWave(currentWave); - - if (spawnPoints.Length >= 2) - { - // 왼쪽 스폰 포인트 - GameObject leftBoss = Instantiate(bossPrefab, spawnPoints[0].position, Quaternion.identity); - SetupBossComponents(leftBoss); - - // 오른쪽 스폰 포인트 - GameObject rightBoss = Instantiate(bossPrefab, spawnPoints[spawnPoints.Length - 1].position, Quaternion.identity); - SetupBossComponents(rightBoss); - } - else - { - Debug.LogError("스폰 포인트가 2개 이상 필요합니다."); - } - - // // 랜덤한 스폰 포인트 선택 - // int spawnPointIndex = Random.Range(0, spawnPoints.Length); - // GameObject bossPrefab = GetBossPrefabForWave(currentWave); - // - // GameObject boss = Instantiate(bossPrefab, spawnPoints[spawnPointIndex].position, Quaternion.identity); - // monsterPool.Add(boss); - // activeMonsters.Add(boss); - - // 보스 웨이브에서는 자동으로 다음 웨이브로 넘어가지 않음 - // 보스가 죽으면 Update에서 체크하여 다음 웨이브로 넘어감 - } - - private void SetupBossComponents(GameObject boss) - { - MonsterBase monsterBase = boss.GetComponent(); - - Attack attackComponent = boss.GetComponentInChildren(); - Eyesight eyesightComponent = boss.GetComponentInChildren(); - - if (attackComponent != null) - attackComponent.SetMonsterBase(monsterBase); - if (eyesightComponent != null) - eyesightComponent.SetMonsterBase(monsterBase); - - monsterPool.Add(boss); - activeMonsters.Add(boss); - } - + private void StartNextWave() { StageManager.Singleton.SetWaveData(currentWave); // 웨이브 정보 전달. @@ -177,7 +129,6 @@ namespace TON if (currentWave > TOTAL_WAVES) { - // Debug.Log("모든 웨이브 완료!"); return; } @@ -199,6 +150,43 @@ namespace TON } } + private void SpawnBossMonster() + { + GameObject bossPrefab = GetBossPrefabForWave(currentWave); + + if (spawnPoints.Length >= 2) + { + // 왼쪽 스폰 포인트 + GameObject leftBoss = Instantiate(bossPrefab, spawnPoints[0].position, Quaternion.identity); + SetupBossComponents(leftBoss); + + // 오른쪽 스폰 포인트 + GameObject rightBoss = Instantiate(bossPrefab, spawnPoints[spawnPoints.Length - 1].position, Quaternion.identity); + SetupBossComponents(rightBoss); + } + else + { + Debug.LogError("스폰 포인트가 2개 이상 필요합니다."); + } + } + + private void SetupBossComponents(GameObject boss) + { + MonsterBase monsterBase = boss.GetComponent(); + + Attack attackComponent = boss.GetComponentInChildren(); + Eyesight eyesightComponent = boss.GetComponentInChildren(); + + if (attackComponent != null) + attackComponent.SetMonsterBase(monsterBase); + if (eyesightComponent != null) + eyesightComponent.SetMonsterBase(monsterBase); + + monsterPool.Add(boss); + activeMonsters.Add(boss); + } + + private bool IsBossWave(int wave) { return wave == 3 || wave == 6 || wave == 9 || wave == 10; @@ -277,7 +265,6 @@ namespace TON } } } - // 일반 웨이브에서는 자동으로 다음 웨이브로 넘어가지 않음 // 몬스터가 모두 죽으면 Update에서 체크하여 다음 웨이브로 넘어감 }