public void PurchaseUpgrade(PersistentUpgrade upgrade) { // Update player currency. persistentCurrencyManager.SubstractPersistentCurrency(upgrade.GetCurrentCost()); // Update upgrade level. upgrade.info.level += 1; // Save new state. UpdatePurchasedPersistentUpgrades(upgrade.info.type, upgrade.info.level); SaveLoad.Save(); }
void UpdateTexts() { Text upgradeNameText = upgradeNameObject.GetComponent <Text> (); upgradeNameText.text = upgrade.name; Text costText = costObject.GetComponent <Text> (); costText.text = upgrade.GetCurrentCost() + " " + PersistentCurrencyManager.persistentCurrencyName; Text currentLevelText = currentLevelObject.GetComponent <Text> (); currentLevelText.text = "Level: " + upgrade.info.level; Text currentEffectText = currentEffectObject.GetComponent <Text> (); currentEffectText.text = "Effect: +" + (upgrade.GetCurrentEffect() * 100) + "% " + upgrade.effectName; }
public bool CanAfford(PersistentUpgrade upgrade) { return(persistentCurrencyManager.GetPersistentCurrency() > upgrade.GetCurrentCost()); }