중간 몬스터 양쪽에서 생성되도록 수정

This commit is contained in:
Mingu Kim
2025-03-01 22:25:21 +09:00
parent 82a4ce8359
commit a755d4569a

View File

@@ -107,13 +107,33 @@ namespace TON
private void SpawnBossMonster() private void SpawnBossMonster()
{ {
// 랜덤한 스폰 포인트 선택
int spawnPointIndex = Random.Range(0, spawnPoints.Length);
GameObject bossPrefab = GetBossPrefabForWave(currentWave); GameObject bossPrefab = GetBossPrefabForWave(currentWave);
GameObject boss = Instantiate(bossPrefab, spawnPoints[spawnPointIndex].position, Quaternion.identity); // 스폰 포인트 배열의 처음과 마지막 위치에 보스 몬스터 생성
monsterPool.Add(boss); if (spawnPoints.Length >= 2)
activeMonsters.Add(boss); {
// 왼쪽 스폰 포인트
GameObject leftBoss = Instantiate(bossPrefab, spawnPoints[0].position, Quaternion.identity);
monsterPool.Add(leftBoss);
activeMonsters.Add(leftBoss);
// 오른쪽 스폰 포인트
GameObject rightBoss = Instantiate(bossPrefab, spawnPoints[spawnPoints.Length - 1].position, Quaternion.identity);
monsterPool.Add(rightBoss);
activeMonsters.Add(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에서 체크하여 다음 웨이브로 넘어감 // 보스가 죽으면 Update에서 체크하여 다음 웨이브로 넘어감