private void UpdateUpgrade( string upgrade, Upgrade upgradeData, TextMeshProUGUI currentUpgradeText, TextMeshProUGUI nextUpgradeText, TextMeshProUGUI upgradeCost, Button upgradeButton ) { int currentUpgradeLevel = PlayerUpgrades.GetUpgradeLevel(upgrade); float[] upgradeLevels = upgradeData.levelValues; currentUpgradeText.text = upgradeLevels[currentUpgradeLevel].ToString(); if (currentUpgradeLevel < upgradeLevels.Length - 1) { nextUpgradeText.text = upgradeLevels[currentUpgradeLevel + 1].ToString(); upgradeCost.text = upgradeData.levelUpgradeCosts[currentUpgradeLevel].ToString(); } else { nextUpgradeText.text = "Max"; upgradeCost.gameObject.SetActive(false); upgradeButton.interactable = false; } }
private bool CanUpgrade(string upgrade, Upgrade upgradeData) { int currentUpgradeLevel = PlayerUpgrades.GetUpgradeLevel(upgrade); if (currentUpgradeLevel == upgradeData.levelUpgradeCosts.Length) { return(false); } int upgradeCost = upgradeData.levelUpgradeCosts[currentUpgradeLevel]; return(Diamond.GetCurrentDiamondAmount() >= upgradeCost); }