Exemple #1
0
 private void MakeRootAgents()
 {
     BoardAgent       = _agents.Get <IBoardAgent>();
     ArbiterAgent     = _agents.Get <IArbiterAgent>();
     WhitePlayerAgent = _agents.Get <IPlayerAgent>(_whitePlayerModel);
     BlackPlayerAgent = _agents.Get <IPlayerAgent>(_blackPlayerModel);
 }
Exemple #2
0
        public Game([Named("playerOne")] IPlayerAgent playerOne, [Named("playerTwo")] IPlayerAgent playerTwo)
        {
            _playerOne = playerOne;
            _playerTwo = playerTwo;
            _gameBoard = new GameBoard();

            _playerOneAdapter = new PlayerBoardAdapter(_gameBoard, BoardField.One);
            _playerTwoAdapter = new PlayerBoardAdapter(_gameBoard, BoardField.Two);
        }
Exemple #3
0
        public ITransient PrepareGame(IPlayerAgent white, IPlayerAgent black)
        {
            Assert.IsNotNull(white);
            Assert.IsNotNull(black);

            Model.PrepareGame(white.Model, black.Model);
            _playerAgents = new List <IPlayerAgent> {
                white, black
            };
            Model.CurrentPlayer.Subscribe(SetPlayerAgent).AddTo(this);

            // TODO: do some animations etc
            return(null);
        }
Exemple #4
0
        public ITransient PrepareGame(IPlayerAgent p0, IPlayerAgent p1)
        {
            Assert.IsNotNull(p0);
            Assert.IsNotNull(p1);

            Model.PrepareGame(p0.Model, p1.Model);

            _playerAgents = new List <IPlayerAgent> {
                p0, p1
            };

            Model.CurrentPlayer.Subscribe(SetPlayerAgent);

            // TODO: do some animations etc
            return(null);
        }
Exemple #5
0
 private void CreateAgents()
 {
     _agents = new AgentRegistry();
     _agents.Bind <IBoardAgent, BoardAgent>(new BoardAgent(_boardModel));
     _agents.Bind <IArbiterAgent, ArbiterAgent>(new ArbiterAgent(_arbiterModel));
     _agents.Bind <IEndTurnButtonAgent, EndTurnButtonAgent>();
     _agents.Bind <ICardAgent, CardAgent>();
     _agents.Bind <IDeckAgent, DeckAgent>();
     _agents.Bind <IHandAgent, HandAgent>();
     _agents.Bind <IPieceAgent, PieceAgent>();
     _agents.Bind <IPlayerAgent, PlayerAgent>();
     _agents.Resolve();
     BoardAgent       = _agents.New <IBoardAgent>();
     ArbiterAgent     = _agents.New <IArbiterAgent>();
     WhitePlayerAgent = _agents.New <IPlayerAgent>(_whitePlayerModel);
     BlackPlayerAgent = _agents.New <IPlayerAgent>(_blackPlayerModel);
 }