コード例 #1
0
        private void UpgradeSpeedAbility()
        {
            PlaySound(_upgradeClip);

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

            UpdateSpeedText();
            UpdateCoinsText();
        }
コード例 #2
0
        private void UpgradePowerAbility()
        {
            PlaySound(_upgradeClip);

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

            UpdatePowerText();
            UpdateCoinsText();
        }
コード例 #3
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);
        }