private void UpgradePowerAbility() { PlaySound(_upgradeClip); Data.SetShootPower(Data.GetShootPower() + _increasePowerValue); Data.SetCoinsCount(Data.GetCoinsCount() - _shootPowerPrice); UpdatePowerText(); UpdateCoinsText(); }
private void UpgradeSpeedAbility() { PlaySound(_upgradeClip); Data.SetShootSpeed(Data.GetShootSpeed() - _increaseSpeedValue); Data.SetCoinsCount(Data.GetCoinsCount() - _shootSpeedPrice); UpdateSpeedText(); UpdateCoinsText(); }
public void UdgradeAbility() { if (_isSpeedTabActive && Data.GetCoinsCount() >= _shootSpeedPrice) { UpgradeSpeedAbility(); } else if (_isPowerTabActive && Data.GetCoinsCount() >= _shootPowerPrice) { UpgradePowerAbility(); } }
private void OnCoinPickedUp(Coin coin) { // Updates coin data Data.SetCoinsCount(Data.GetCoinsCount() + coin.Value); UpdateCoinCountText(); // Spawn textObject GameObject textObject = Instantiate(_pickedUpCoinTextPrefab, coin.transform.position + _pickedCoinTextOffset, _pickedUpCoinTextPrefab.transform.rotation, _parentCanvas); textObject.GetComponentInChildren <Text>().text = coin.Value.ToString(); Destroy(textObject, 2f); }
public void UpdateCoinsText() { _coinsCountText.text = NumberFormatter.ToKMB(Data.GetCoinsCount()); }