public void BuyUpgrade() { if (GameControllerS.I.Money < Cost) { throw new System.InvalidOperationException("This method should only be called when clicking the button in shop (which should be only enabled if user has enough money)."); } GameControllerS.I.SubtractMoney(Cost); Upgrade.Function(TargetTower); TargetTower.UpgradeLevels[UpgradeIndex]++; GameControllerS.I.Shop.LoadTowerInfo(TargetTower); }