예제 #1
0
        private void UpgradePowerAbility()
        {
            PlaySound(_upgradeClip);

            Data.SetShootPower(Data.GetShootPower() + _increasePowerValue);
            Data.SetCoinsCount(Data.GetCoinsCount() - _shootPowerPrice);

            UpdatePowerText();
            UpdateCoinsText();
        }
예제 #2
0
        private void UpgradeSpeedAbility()
        {
            PlaySound(_upgradeClip);

            Data.SetShootSpeed(Data.GetShootSpeed() - _increaseSpeedValue);
            Data.SetCoinsCount(Data.GetCoinsCount() - _shootSpeedPrice);

            UpdateSpeedText();
            UpdateCoinsText();
        }
예제 #3
0
 public void UdgradeAbility()
 {
     if (_isSpeedTabActive && Data.GetCoinsCount() >= _shootSpeedPrice)
     {
         UpgradeSpeedAbility();
     }
     else if (_isPowerTabActive && Data.GetCoinsCount() >= _shootPowerPrice)
     {
         UpgradePowerAbility();
     }
 }
예제 #4
0
        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);
        }
예제 #5
0
 public void UpdateCoinsText()
 {
     _coinsCountText.text = NumberFormatter.ToKMB(Data.GetCoinsCount());
 }