Пример #1
0
        public async Task <bool> AutoPlayTurn(Guid gameSessionId)
        {
            var gameSessions = await gameSessionAccess.FindGameSessions(i => i.Id == gameSessionId);

            var gameSession = gameSessions.FirstOrDefault();

            gameSession.NotNull();

            var currentPlayers = await playerAccess.FindPlayers(i => i.Id == gameSession.CurrentPlayerId);

            var currentPlayer = currentPlayers.FirstOrDefault();

            currentPlayer.NotNull();

            var tiles = await tileAccess.FindTiles(i => i.Id == gameSessionId);

            var tile = autoPlayer.PlayTurn(tiles);

            tile.PlayerId = currentPlayer.Id;
            var result = await tileAccess.UpdateTile(tile);

            result = result && await IncrementPlayer(gameSessionId);

            return(result);
        }
Пример #2
0
        public async Task AutoPlayTurn(Guid gameSessionId)
        {
            var gameSession = await gameSessionAccess.GetGameSession(gameSessionId);

            var currentPlayer = await playerAccess.GetPlayer(gameSession.CurrentPlayerId);

            var tiles = await tileAccess.FindTiles(gameSessionId);

            var tile = autoPlayer.PlayTurn(tiles);

            tile.PlayerId = currentPlayer.Id;
            await tileAccess.UpdateTile(tile);

            await IncrementPlayer(gameSessionId);
        }