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

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

            StartPreparationTimer(player);
        }
Ejemplo 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());
    }
Ejemplo 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());
        }
Ejemplo n.º 4
0
        private IEnumerator StartCountdown()
        {
            _round++;
            _gameState = GameState.Countdown;

            RoundCountdown?.Invoke();

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

                yield return(null);
            }

            _gameState = GameState.Started;

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