건축 및 고용에 비용 소모 기능 추가

This commit is contained in:
2026-02-02 20:26:44 +09:00
parent 9dea9daaa9
commit 958ae1cb75
6 changed files with 159 additions and 11 deletions

View File

@@ -11,6 +11,7 @@ namespace Northbound
public float spawnRadius = 2f;
public int maxWorkers = 5;
public float spawnCooldown = 5f;
public int recruitmentCost = 20;
[Header("Interaction")]
public string interactionAnimationTrigger = "Build";
@@ -59,6 +60,10 @@ namespace Northbound
if (workerPrefab == null)
return false;
var coreResourceManager = CoreResourceManager.Instance;
if (coreResourceManager != null && !coreResourceManager.CanAfford(recruitmentCost))
return false;
return true;
}
@@ -82,6 +87,21 @@ namespace Northbound
return;
}
var coreResourceManager = CoreResourceManager.Instance;
if (coreResourceManager == null)
{
Debug.LogWarning("[WorkerSpawner] CoreResourceManager 인스턴스를 찾을 수 없습니다.");
return;
}
if (!coreResourceManager.CanAfford(recruitmentCost))
{
Debug.LogWarning($"[WorkerSpawner] 코어 자원이 부족합니다. 필요: {recruitmentCost}");
return;
}
coreResourceManager.SpendResources(recruitmentCost);
Vector3 spawnPosition = spawnPoint != null ? spawnPoint.position : transform.position;
float randomAngle = Random.Range(0f, 360f);
@@ -185,7 +205,11 @@ namespace Northbound
if (cooldownRemaining > 0)
return $"워커 생성 대기 중 ({cooldownRemaining:F1}s)";
return $"{interactionPrompt} ({_workerCount.Value}/{maxWorkers})";
var coreResourceManager = CoreResourceManager.Instance;
if (coreResourceManager != null && !coreResourceManager.CanAfford(recruitmentCost))
return $"자원 부족 (필요: {recruitmentCost})";
return $"{interactionPrompt} ({_workerCount.Value}/{maxWorkers}) - 비용: {recruitmentCost}";
}
public string GetInteractionAnimation()