private void OnRoundEnded(object?sender, GameIdEventArgs e)
 {
     if (string.Equals(e.GameId, GameId, StringComparison.Ordinal))
     {
         RoundEnded?.Invoke(this, EventArgs.Empty);
     }
 }
Пример #2
0
    public void EndRound()
    {
        RoundIsRunning = false;
        PlayerIsDead   = true;

        RoundEnded?.Invoke(this, new EventArgs());
    }
Пример #3
0
 public void EndRound()
 {
     Units.ForEach(u => { u.OnRoundEnd(); });
     if (RoundEnded != null)
     {
         RoundEnded.Invoke(this, new EventArgs());
     }
     StartCoroutine(RoundStart());
 }
Пример #4
0
    public void EndRound()
    {
        Units.ForEach(u => { u.OnRoundEnd(); });
        if (RoundEnded != null)
        {
            RoundEnded.Invoke(this, new EventArgs());
        }
        StartCoroutine(RoundStart());

        //CellGridState = new CellGridStateTurnChanging(this);
    }
Пример #5
0
        public void End()
        {
            if (_gameState == GameState.Ended)
            {
                return;
            }

            _gameState = GameState.Ended;

            RoundEnded?.Invoke();

            Start();
        }
Пример #6
0
        private IEnumerator StartTimer()
        {
            var duration = _roundSettings.Duration;

            while (duration > _timer)
            {
                _timer += Time.deltaTime;

                yield return(null);
            }

            _gameState = GameState.Ended;
            _isStarted = false;

            RoundEnded?.Invoke();
        }
Пример #7
0
        public async Task Connect()
        {
            _hubConnection = new HubConnectionBuilder().WithUrl(_hubUri).Build();
            _hubConnection.On(GameEvents.GameSessionStarted, () => GameSessionStarted?.Invoke());
            _hubConnection.On <bool>(nameof(IsSessionOpen), (isOpen) => IsSessionOpen?.Invoke(isOpen));
            _hubConnection.On(GameEvents.PlayerCreated, () => PlayerCreated?.Invoke());
            _hubConnection.On <ICollection <string> >(nameof(IncomingPlayers), (players) => IncomingPlayers?.Invoke(players));
            _hubConnection.On(GameEvents.GameStarted, () => GameStarted?.Invoke());
            _hubConnection.On <int>(GameEvents.TimeElapsed, countDownSeconds => TimeElapsed?.Invoke(countDownSeconds));
            _hubConnection.On(GameEvents.GameStopped, () => GameStopped?.Invoke());
            _hubConnection.On <int>(GameEvents.RightAnswer, newScore => SentRightAnswer?.Invoke(newScore));
            _hubConnection.On <int>(GameEvents.WrongAnswer, newScore => SentWrongAnswer?.Invoke(newScore));
            _hubConnection.On(GameEvents.RoundEnded, () => RoundEnded?.Invoke());
            _hubConnection.On <string>(GameEvents.Question, question => QuestionSent?.Invoke(question));
            _hubConnection.On <AnswerAndPlayers>(GameEvents.AnswerAndPlayers, answerAndPlayers => GotAnswerAndPlayers?.Invoke(answerAndPlayers));
            _hubConnection.On(GameEvents.NextRoundStarted, () => NextRoundStarted?.Invoke());

            await _hubConnection.StartAsync();
        }
Пример #8
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);
        }
Пример #9
0
 protected virtual void OnRoundEnded(object sender, DndGameEventArgs ea)
 {
     RoundEnded?.Invoke(sender, ea);
 }
Пример #10
0
 protected void InvokeEndRound()
 {
     RoundEnded.Invoke();
 }
Пример #11
0
 protected virtual void OnRoundEnded(object source, EventArgs e)
 {
     RoundEnded?.Invoke(source, e);
 }
Пример #12
0
        public void EndRound(string gameId)
        {
            DeleteGameState(gameId);

            RoundEnded?.Invoke(this, new GameIdEventArgs(gameId));
        }
Пример #13
0
 public void RoundHasEnded(TimeSpan timeout)
 {
     RoundEnded?.Invoke(this, timeout);
 }