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

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

@@ -52,6 +52,20 @@ namespace Northbound
UpdateVisuals();
}
/// <summary>
/// 비용 표시 업데이트 (자원 변화 시 호출)
/// </summary>
public void UpdateCostDisplay()
{
if (nameText != null && buildingData != null)
{
var coreResourceManager = CoreResourceManager.Instance;
bool canAfford = coreResourceManager != null && coreResourceManager.CanAfford(buildingData.mana);
string costText = canAfford ? $"{buildingData.mana}" : $"<color=red>{buildingData.mana}</color>";
nameText.text = $"{buildingData.buildingName}\n비용: {costText}";
}
}
/// <summary>
/// UI 업데이트
/// </summary>
@@ -75,7 +89,10 @@ namespace Northbound
// 이름 설정
if (nameText != null)
{
nameText.text = buildingData.buildingName;
var coreResourceManager = CoreResourceManager.Instance;
bool canAfford = coreResourceManager != null && coreResourceManager.CanAfford(buildingData.mana);
string costText = canAfford ? $"{buildingData.mana}" : $"<color=red>{buildingData.mana}</color>";
nameText.text = $"{buildingData.buildingName}\n비용: {costText}";
}
// 배경 색상