void Start() { save = new Save(); coins = save.TotalCoins(); coinsText.text = "Coins: " + coins; //Shield shieldLevel = save.ShieldLevel(); shieldCost = save.ShieldCost(); shieldLevelText.text = "Shield " + shieldLevel; shieldCostText.text = "Cost: " + shieldCost; //Weapons weaponsLevel = save.WeaponsLevel(); weaponsCost = save.WeaponsCost(); weaponsLevelText.text = "Weapons " + weaponsLevel; weaponsCostText.text = "Cost: " + weaponsCost; //Bolt boltLevel = save.BoltLevel(); boltCost = save.BoltCost(); boltLevelText.text = "Bolt " + boltLevel; boltCostText.text = "Cost: " + boltCost; Debug.Log(shieldLevel); if (shieldLevel > 4) { btnUpgShield.gameObject.SetActive(false); } if (weaponsLevel > 4) { btnUpgWeapon.gameObject.SetActive(false); } if (boltLevel > 4) { btnUpgBolt.gameObject.SetActive(false); } alertText.text = ""; }
public void UpgradeBolt() { if (coins >= boltCost) { if (boltLevel < 4) { int level = save.BoltLevel() + 1; save.SaveBoltLevel(level); alertText.text = "upgrade successful"; alertText.color = new Color(255, 139, 255); coins -= boltCost; save.SaveCoins(coins); boltCost = save.BoltCost(); coinsText.text = "Coins: " + coins; boltLevelText.text = "Weapons " + level; boltCostText.text = "Cost: " + boltCost; } else { alertText.text = "Max Upgraded"; alertText.color = new Color(255, 0, 0); btnUpgBolt.gameObject.SetActive(false); } } else { alertText.text = "insufficient coins"; alertText.color = new Color(255, 0, 0); } }