Esempio n. 1
0
        public void StartMatch()
        {
            IsRunning = true;
            var player = GetPlayerWhoHasNotPlayed();

            MatchStarted?.Invoke(this, EventArgs.Empty);
            RoundStarted?.Invoke(this, new RoundStartedEventArgs(CurrentRound));

            StartPreparationTimer(player);
        }
Esempio n. 2
0
    IEnumerator RoundStart()
    {
        roundNumber++;
        if (RoundStarted != null)
        {
            RoundStarted.Invoke(this, new EventArgs());
        }
        //角色加入忽略层
        Units.ForEach(u => u.gameObject.layer = 2);
        yield return(new WaitForSeconds(roundStartTime));

        Units.ForEach(u => { u.OnRoundStart(); });
        StartCoroutine(TurnStart());
    }
Esempio n. 3
0
        private IEnumerator StartCountdown()
        {
            RoundCountdown?.Invoke();

            while (_countdown > 0)
            {
                _countdown -= Time.deltaTime;

                yield return(null);
            }

            _gameState = GameState.Started;
            _isStarted = true;

            RoundStarted?.Invoke();

            _updateManager.StartCoroutine(StartTimer());
        }
        private IEnumerator StartCountdown()
        {
            _round++;
            _gameState = GameState.Countdown;

            RoundCountdown?.Invoke();

            while (_countdown > 0)
            {
                _countdown -= Time.deltaTime;

                yield return(null);
            }

            _gameState = GameState.Started;

            RoundStarted?.Invoke();
        }
Esempio n. 5
0
        public Result StartGame()
        {
            round = new Round();
            RoundStarted?.Invoke();

            round.WinnerFound += player => {
                if (player == player1)
                {
                    round.result = Result.PlayerOneWon;
                    scores.player1Score++;
                }

                if (player == player2)
                {
                    round.result = Result.PlayerTwoWon;
                    scores.player2Score++;
                }
            };

            DrawBoard?.Invoke();
            do
            {
                round.Move(player1);
                DrawBoard?.Invoke();

                if (round.inPlay)
                {
                    round.Move(player2);
                    DrawBoard?.Invoke();
                }
            } while (round.inPlay);

            if (round.result == Result.Draw)
            {
                scores.draws++;
            }

            RoundEnded?.Invoke();
            return(round.result);
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
 protected virtual void OnRoundStarted(ReportUpdateEventArgs eventArgs)
 {
     RoundStarted?.Invoke(eventArgs);
 }
Esempio n. 8
0
 public void RoundHasStarted(Int32 roundNumber, TimeSpan roundTime)
 {
     RoundStarted?.Invoke(this, (Round: roundNumber, RoundTime: roundTime));
 }