타워 선택 건설 및 몹 웨이브 생성

Defence용 Scene 별도 생성
This commit is contained in:
2026-01-13 01:20:44 +09:00
parent 5a9fc719de
commit 022bc48bc5
26 changed files with 2768 additions and 167 deletions

View File

@@ -11,11 +11,16 @@ public class ConstructionSite : MonoBehaviour
private GameObject _finalTurretPrefab;
private float _buildTime;
private float _currentProgress = 0f;
private Vector2Int _size; // 사이즈를 저장할 변수 추가
public void Initialize(GameObject finalPrefab, float time)
public void Initialize(GameObject finalPrefab, float time, Vector2Int size) // 매개변수 추가)
{
_finalTurretPrefab = finalPrefab;
_buildTime = time;
_size = size; // 사이즈 저장
// 토대 자체의 크기 조절 (BuildManager에서 해도 되지만 여기서 하면 더 확실합니다)
transform.localScale = new Vector3(size.x, 5f, size.y);
// UI 생성 및 초기화
if (uiPrefab != null)
@@ -49,7 +54,12 @@ public class ConstructionSite : MonoBehaviour
private void CompleteBuild()
{
Instantiate(_finalTurretPrefab, transform.position, transform.rotation);
// 1. 실제 타워 생성
GameObject turret = Instantiate(_finalTurretPrefab, transform.position, transform.rotation);
// 2. 생성된 타워의 크기를 저장해둔 사이즈로 변경!
turret.transform.localScale = new Vector3(_size.x, 5f, _size.y);
Destroy(gameObject);
}
}