Example #1
0
    public void UpdateSelectImage(UIShopButton thisButton)
    {
        newSkinSeledtedSound.CheckIsAudioEnabledAndPlay();

        foreach (UIShopButton button in virusesButtons)
        {
            if (button != thisButton)
            {
                button.selectIcon.enabled = false;
            }

            else
            {
                shopButtonIcon.sprite = button.snakeSprites[0];

                if (button.isSecretSkin)
                {
                    shopButtonIcon.sprite = button.secretVirusSkin[2];
                }

                button.selectIcon.enabled = true;
            }

            button.LockRefresh();
        }
    }
Example #2
0
    private void PlayFillBarSound(ref int iterCounter, float pitch)
    {
        iterCounter++;

        if (iterCounter == 5)
        {
            iterCounter        = 0;
            fillBarSound.pitch = pitch;
            fillBarSound.CheckIsAudioEnabledAndPlay();
        }
    }
Example #3
0
    public void Splash()
    {
        if (bar.fillAmount == 1)
        {
            soundEffect.pitch = Random.Range(1f, 1.3f);
            soundEffect.CheckIsAudioEnabledAndPlay();

            Instantiate(_splashFab, _playerHead.transform.position, Quaternion.identity).GetComponent <Splash>().ParentHead = _playerHead;
            bar.fillAmount = 0;
        }
    }
Example #4
0
    public void SpeedUp()
    {
        if (bar.fillAmount > 0.15f)
        {
            soundEffect.pitch = 1;
            soundEffect.CheckIsAudioEnabledAndPlay();

            isPressed        = true;
            playerHead.Speed = _boostedSpeed;
            particlesPlay.Invoke();
        }
    }
Example #5
0
 public void SignOnPurse()
 {
     declineSellSkinSound.CheckIsAudioEnabledAndPlay();
     StartCoroutine(Twiner.UISigner(purseGameObject));
 }
Example #6
0
    private IEnumerator FillProgressBar()
    {
        if (_currentLvl == 21)
        {
            StartCoroutine(AddDnaAtMaxLevel());

            StartCoroutine(ProgressBarMaxLevelAnim());

            levelNameText.text      = "LVL: MAX";
            prevLevelTarget.text    = null;
            currentLevelTarget.text = null;
        }

        else
        {
            int diffBtwLevels = _currentLvlTarget - _prevLvlTarget;

            prevLevelTarget.text    = _prevLvlTarget.ToString();
            currentLevelTarget.text = _currentLvlTarget.ToString();

            int iterationsCounter = 0;

            if (_playerScore - diffBtwLevels >= 0)
            {
                float scoreAddStep = diffBtwLevels * 0.01f;
                float smoothScore  = _prevLvlTarget;

                _playerScore -= diffBtwLevels;

                for (float i = 0; i < 1; i += 0.01f)
                {
                    progressBar.fillAmount = i;
                    smoothScore           += scoreAddStep;

                    if (_scoreToText < _currentLvlTarget)
                    {
                        _scoreToText = (int)smoothScore;
                    }

                    barScore.text = _scoreToText.ToString();

                    PlayFillBarSound(ref iterationsCounter, i + 1f);

                    yield return(null);
                }

                particles.Clear();
                particles.Play();

                progressBar.fillAmount = 1;

                ++_currentLvl;
                levelNameText.text = "LVL: " + LevelNames[_currentLvl] + " (" + _currentLvl.ToString() + ")";
                _prevLvlTarget     = TargetsToUpLevel[_currentLvl];
                _currentLvlTarget  = TargetsToUpLevel[_currentLvl + 1];

                newLevelSound.pitch += 0.05f;
                newLevelSound.CheckIsAudioEnabledAndPlay();

                StartCoroutine(AddDna(diffBtwLevels));
                StartCoroutine(FillProgressBar());
            }

            else
            {
                for (float i = 0; i <= ((float)_playerScore / diffBtwLevels); i += 0.01f)
                {
                    progressBar.fillAmount = i;

                    if (_scoreToText < _prevLvlTarget + _playerScore)
                    {
                        _scoreToText += 1;
                    }

                    barScore.text = _scoreToText.ToString();

                    PlayFillBarSound(ref iterationsCounter, i + 1f);

                    yield return(null);
                }

                while (_scoreToText < _prevLvlTarget + _playerScore)
                {
                    _scoreToText += 1;
                    barScore.text = _scoreToText.ToString();
                    yield return(null);
                }
            }
        }
    }
Example #7
0
 private void DeathSoundPlay()
 {
     _deathSound.pitch = Random.Range(1.0f, 1.3f);
     _deathSound.CheckIsAudioEnabledAndPlay();
 }
Example #8
0
 public void PlayDeathSound() => _virusDeathSound.CheckIsAudioEnabledAndPlay();