판매 반환 시스템 작업

This commit is contained in:
김판돌 2023-11-05 19:49:58 +09:00
parent 0f3d7535cb
commit db0d9b651a
2 changed files with 11 additions and 2 deletions

View File

@ -85,6 +85,13 @@ public class BuildingCtrl : MonoBehaviour
Debug.Log("생산건물은 파괴할 수 없습니다.");
return;
}
int sell = 0;
for(int n = 0; n < buildingLevel; n++)
{
sell += unitInfo.unit.buy[n];
}
sell /= 3;
PlayCtrl.Instance.TextUpdate(sell);
unitInfo = null;
img.sprite = null;
img.color = Color.clear;

View File

@ -121,8 +121,10 @@ public class PlayCtrl : SingletonMonoBehaviour<PlayCtrl>
if (money != int.Parse(moneyText.text))
Debug.LogError("버그발견");
money += addMoney;
if(money < 0 || money > 999900)
Debug.LogError("가격버그발견");
if(money < 0)
money = 0;
else if(money > 999999)
money = 999999;
moneyText.text = money.ToString();
}
}