유닛 최대레벨 도달시 에러 반환 버그 수정

This commit is contained in:
김판돌 2024-03-03 20:10:15 +09:00
parent 516c777c23
commit 167fcfa910
3 changed files with 37 additions and 6 deletions

View File

@ -991,7 +991,9 @@ MonoBehaviour:
newBuildingUI: {fileID: 1842952264} newBuildingUI: {fileID: 1842952264}
buildingLevelupUI: {fileID: 1785205477} buildingLevelupUI: {fileID: 1785205477}
backButton: {fileID: 1396764732} backButton: {fileID: 1396764732}
buyButton: {fileID: 401326400}
buyText: {fileID: 663203141} buyText: {fileID: 663203141}
sellButton: {fileID: 914591067}
sellText: {fileID: 1782769547} sellText: {fileID: 1782769547}
moneyText: {fileID: 13568456} moneyText: {fileID: 13568456}
unitSpriteButton: unitSpriteButton:

View File

@ -43,11 +43,17 @@ public class BuildingCtrl : MonoBehaviour
sell += unitInfo.unit.buy[n]; sell += unitInfo.unit.buy[n];
} }
sell /= 3; sell /= 3;
PlayCtrl.Instance.LevelupBuyAndSellText(unitInfo.unit.buy[buildingLevel], sell); if(buildingLevel != 5)
PlayCtrl.Instance.LevelupBuyAndSellText(unitInfo.unit.buy[buildingLevel], sell);
else
PlayCtrl.Instance.LevelupBuyAndSellText(-1, sell);
} }
else else
{ {
PlayCtrl.Instance.LevelupBuyAndSellText(500 * buildingLevel, 0); if (buildingLevel != 5)
PlayCtrl.Instance.LevelupBuyAndSellText(150 * buildingLevel, -1);
else
PlayCtrl.Instance.LevelupBuyAndSellText(-1, -1);
} }
@ -85,12 +91,12 @@ public class BuildingCtrl : MonoBehaviour
PlayCtrl.Instance.player.buildings[wave].level[position - 1] = buildingLevel + 1; PlayCtrl.Instance.player.buildings[wave].level[position - 1] = buildingLevel + 1;
} else } else
{ {
if(500 * buildingLevel > PlayCtrl.Instance.money) if(150 * buildingLevel > PlayCtrl.Instance.money)
{ {
Debug.Log("구매비용이 부족합니다"); Debug.Log("구매비용이 부족합니다");
return; return;
} }
PlayCtrl.Instance.TextUpdate(-500 * buildingLevel); PlayCtrl.Instance.TextUpdate(-150 * buildingLevel);
PlayCtrl.Instance.player.addMoney[wave] += 100; PlayCtrl.Instance.player.addMoney[wave] += 100;
} }
buildingLevel++; buildingLevel++;

View File

@ -20,7 +20,9 @@ public class PlayCtrl : SingletonMonoBehaviour<PlayCtrl>
public GameObject buildingLevelupUI; public GameObject buildingLevelupUI;
public GameObject backButton; public GameObject backButton;
UnitCtrl[] units; UnitCtrl[] units;
[SerializeField] Button buyButton;
public TMP_Text buyText; public TMP_Text buyText;
[SerializeField] Button sellButton;
public TMP_Text sellText; public TMP_Text sellText;
public TMP_Text moneyText; public TMP_Text moneyText;
public Image[] unitSpriteButton; public Image[] unitSpriteButton;
@ -143,8 +145,29 @@ public class PlayCtrl : SingletonMonoBehaviour<PlayCtrl>
public void LevelupBuyAndSellText(int buy, int sell) public void LevelupBuyAndSellText(int buy, int sell)
{ {
buyText.text = $"강화({buy})"; if (buy == -1)
sellText.text = $"건물 제거({sell})"; {
buyButton.interactable = false;
buyText.text = $"강화(0)";
}
else
{
buyButton.interactable = true;
buyText.text = $"강화({buy})";
}
if (sell == -1)
{
sellButton.interactable = false;
sellText.text = $"건물 제거(0)";
}
else
{
sellButton.interactable = true;
sellText.text = $"건물 제거({sell})";
}
} }
public void TextUpdate(int addMoney) public void TextUpdate(int addMoney)