// Method called from UI button to buy units of a Ship. public void Buy() { if (currencyManager.currency >= cost * quantityMultiplier) { currencyManager.currency -= cost; quantity += quantityMultiplier; currencyManager.ChangeCurrencyIdleGain(currencyGain * quantityMultiplier); UpdateValues(); if (quantity >= shipData.qtToUnlockNextShip) { UnlockNextShip(); } // Play sound. } else { // Play different sound. } }