예제 #1
0
        private void NewRound()
        {
            if (IsTimeToShuffleColors())
            {
                _gameColors.ShuffleUIColors();
            }

            if (_numberOfVictories > 0)
            {
                var differential = (_numberOfVictories * 10) + (int)((_choiceTime - _currentWordTimer).TotalMilliseconds / 10);
                _score += differential;

                var popupText              = $"+{differential}";
                var startingPopupPosition  = _scoreTextDrawingInfos.Position + new Vector2(0f, 230f);
                var scoreDifferentialPopup = new PopupText()
                {
                    Text         = popupText,
                    DrawingInfos = new DrawingInfos()
                    {
                        Position = startingPopupPosition,
                        Scale    = 1.0f,
                        Origin   = _writingFont.GetTextCenter(popupText),
                    },
                    PopupObject = new PopupObject(
                        _popupScoreDuration,
                        startingPopupPosition,
                        _gameColors.ScoreColor,
                        110)
                };
                scoreDifferentialPopup.PopupObject.Popup();

                _scoreDifferentialPopups.Add(scoreDifferentialPopup);
            }

            ++_numberOfVictories;

            _currentWordTimer = _choiceTime;
            _gameButtonsManager.NewRound();

            _currentWordDrawingInfos = new DrawingInfos()
            {
                Position = new Vector2(
                    _matrixScaleProvider.VirtualWidth / 2f,
                    14f + _colorTextBackgroundRectangle.Y + _colorTextBackgroundRectangle.Height / 2f),
                Origin       = _writingFont.GetTextCenter(_gameButtonsManager.CurrentWord),
                OverlayColor = _gameButtonsManager.CurrentWordForegroundColor
            };

            if (_gameButtonsManager.CanAddButtons &&
                IsTimeToIncreaseDifficulty())
            {
                _choiceTime -= TimeSpan.FromMilliseconds(200);
                _gameButtonsManager.AddButton();
            }

            _timeProgressBar.MaxValue = (int)_choiceTime.TotalMilliseconds;
            _timeProgressBar.Color    = _gameColors.TimerBarColor;

            UpdateScoreString();
            _timeProgressBar.Reset();
            UpdateTimerProgressBar();
            _currentGameState = GameStates.PlayingWaitingForInput;
        }