public void addFruit() { if (isResourceAvaible()) { if (fruitsCount < maxFruits) { fruitsCount++; foliage.spendSun(sunCost); roots.spendWater(waterCost); audioSourceAdd.Play(); } } updateDisplay(); }
public void spawnScareCrow(int val) { if (isSpawnPossible(val)) { Scarecrow newSC = prefabBank.poolScarecrow(val); int posIdx = findSCPosition(); newSC.gameObject.transform.position = spawningVectors[posIdx]; slots[posIdx] = false; newSC.setSlot(posIdx); roots.spendWater(prefabBank.waterCosts[val - 1]); foliage.spendSun(prefabBank.sunCosts[val - 1]); newSC.init(); } }