Ejemplo n.º 1
0
    private void FinishMatch(PlayerType playerType)
    {
        if (selfPoints > saveController.BestScore)
        {
            saveController.BestScore.Value = selfPoints;
            BestPointsChanged?.Invoke(selfPoints);
        }

        MatchFinished?.Invoke(playerType);
    }
Ejemplo n.º 2
0
        /// <summary>
        /// Stops this match.
        /// </summary>
        public void StopMatch()
        {
            _preparationTimer.Stop();
            _subRoundTimer.Stop();

            IsSubRoundRunning = false;
            IsRunning         = false;
            IsFinished        = true;

            MatchFinished?.Invoke(this, EventArgs.Empty);
        }
Ejemplo n.º 3
0
        private void Match_SubRoundFinished(object sender, EventArgs e)
        {
            WordToDraw    = null;
            RemainingTime = RoundLength;
            ResetHasGuessed();

            var player = GetCurrentlyDrawingPlayer();

            if (player != null)
            {
                player.Status = PlayerStatus.Guessing;

                PlayedPlayers.Add(player);
            }

            if (PlayedPlayers.Count >= Players.Count)
            {
                //Runde Beendet
                PlayedPlayers.Clear();
                RoundFinished?.Invoke(this, EventArgs.Empty);

                if (CurrentRound == Rounds)
                {
                    IsRunning  = false;
                    IsFinished = true;
                    MatchFinished?.Invoke(this, EventArgs.Empty);
                    return;
                }

                CurrentRound++;

                RoundStarted?.Invoke(this, new RoundStartedEventArgs(CurrentRound));
            }

            player = GetPlayerWhoHasNotPlayed();
            StartPreparationTimer(player);
        }
Ejemplo n.º 4
0
 private void OnMatchFinished() => MatchFinished?.Invoke(this, EventArgs.Empty);