Ejemplo n.º 1
0
        /// <summary>
        /// Call this every time the button is pressed
        /// </summary>
        public void IncrementCount()
        {
            _currentScore++;
            UpdateTextBox(currentScoreTextBox, _currentScoreText + _currentScore);

            // Only consider playing a sound if there is not a sound being played and we should play one
            if (!soundEffectController.IsSoundPlaying() && soundEffectController.ShouldRandomSoundPlay())
            {
                soundEffectController.PlayRandomSound();
            }

            // Check if it's a new high score and handle if it is
            if (IsNewHighScore(_currentScore, _highScore))
            {
                SetHighScore(_currentScore);
                UpdateTextBox(highScoreTextBox, _highScoreText + _highScore);
            }
        }