Exemplo n.º 1
0
        public void StartGame()
        {
            _messagingHandler.StartListeningToRequests(_playerGuidToId.Keys);
            KnowledgeExchangeManager = new KnowledgeExchangeManager(_messagingHandler.KnowledgeExchangeDelay);
            _actionHandler           = new ActionHandlerDispatcher(Board, KnowledgeExchangeManager);

            _messagingHandler.SendGameStartedMessage(_gameHost.GameId);

            var boardInfo     = new BoardInfo(Board.Width, Board.TaskAreaSize, Board.GoalAreaSize);
            var playersInGame = Board.Players.Values;

            foreach (var(_, id) in _playerGuidToId)
            {
                var playerLocation = Board.Players.Values.Single(x => x.Id == id).Location;
                _messagingHandler.SendGameStartedToPlayerMessage(id, playersInGame, playerLocation, boardInfo);
            }
        }
Exemplo n.º 2
0
 public AuthorizeKnowledgeExchangeHandler(int playerId, GameMasterBoard board, int withPlayerId, IKnowledgeExchangeManager knowledgeExchangeManager) : base(playerId, board)
 {
     //Console.WriteLine($"Authorize forward from {playerId}({Board.Players[playerId].Team}) to {withPlayerId}({Board.Players[withPlayerId].Team})");
     knowledgeExchangeManager.AssignSubjectToInitiator(playerId, withPlayerId);
 }
 public ActionHandlerDispatcher(GameMasterBoard board, IKnowledgeExchangeManager knowledgeExchangeManager)
 {
     _board = board;
     _knowledgeExchangeManager = knowledgeExchangeManager;
 }