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(); } }
private void PlayFillBarSound(ref int iterCounter, float pitch) { iterCounter++; if (iterCounter == 5) { iterCounter = 0; fillBarSound.pitch = pitch; fillBarSound.CheckIsAudioEnabledAndPlay(); } }
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; } }
public void SpeedUp() { if (bar.fillAmount > 0.15f) { soundEffect.pitch = 1; soundEffect.CheckIsAudioEnabledAndPlay(); isPressed = true; playerHead.Speed = _boostedSpeed; particlesPlay.Invoke(); } }
public void SignOnPurse() { declineSellSkinSound.CheckIsAudioEnabledAndPlay(); StartCoroutine(Twiner.UISigner(purseGameObject)); }
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); } } } }
private void DeathSoundPlay() { _deathSound.pitch = Random.Range(1.0f, 1.3f); _deathSound.CheckIsAudioEnabledAndPlay(); }
public void PlayDeathSound() => _virusDeathSound.CheckIsAudioEnabledAndPlay();