public void HandSanitiserUpgrade() { if (totalMoney >= handSanitiserUpgradeCosts[handSanitiserTier]) // If you have money for upgrade { // Play Success Audio totalMoney -= handSanitiserUpgradeCosts[handSanitiserTier]; // Then subtract upgrade cost from total money totaMoneyTxt.text = "$" + totalMoney; // Display new total handSanitiserLevel.current++; // Increase handsanitisers level by 1 if (handSanitiserLevel.current == handSanitiserLevelCap[handSanitiserTier]) // If you hit the level cap { handSanitiserLevel.min = handSanitiserLevelCap[handSanitiserTier]; // reset the bar handSanitiserLevel.max = handSanitiserLevelCap[handSanitiserTier + 1]; // upgrade the items tier handSanitiserTier++; if (handSanitiserTier == 3) // if at max tier { audioManagerObj.Play("Max_Tier"); handSanitiserMaxTier = true; handSanitiserTierTxt.text = "Max"; StartCoroutine(AutomatedHandSanitiser()); // generate constant income handSanitiserUpgradeBtn.gameObject.SetActive(false); handSanitiserLevelCont.gameObject.SetActive(false); } else { handSanitiserUpgradeBtnTxt.text = "Upgrade $" + handSanitiserUpgradeCosts[handSanitiserTier]; handSanitiserTierTxt.text = (handSanitiserTier + 1).ToString(); handSanitiserProfit += 0.05m; // tier up, so give more money for making this item } } } else { notificationsObj.DisplayDialogue("Insufficient Funds", "That upgrade costs S" + handSanitiserUpgradeCosts[handSanitiserTier] + ". You'll need $" + (handSanitiserUpgradeCosts[handSanitiserTier] - totalMoney) + " more before you can afford it"); } }