コード例 #1
0
 public GameFactory(
     IBoardFactory boardFactory,
     ILinesFactory linesFactory,
     IGameInputProvider gameInputProvider)
 {
     _boardFactory      = boardFactory;
     _linesFactory      = linesFactory;
     _gameInputProvider = gameInputProvider;
 }
コード例 #2
0
        public Game(
            IGameConfig gameConfig,
            IBoardFactory boardFactory,
            ILinesFactory linesFactory,
            IGameInputProvider gameInputProvider)
        {
            _gameInputProvider = gameInputProvider;

            _board = (IBoardInternal)boardFactory.CreateBoard(gameConfig.BoardSize);

            _lines = linesFactory.CreateLines(_board);

            var players = gameConfig.Players.ToList();

            _players            = players;
            _currentPlayerIndex = players.IndexOf(gameConfig.FirstPlayer);
        }
コード例 #3
0
        public TopDownMovementModel(IGameInputProvider gameInputProvider, int playerId)
        {
            _gameInputProvider = gameInputProvider;

            _gameInputProvider.GetAKeyDown().Subscribe(down =>
            {
                Debug.Log("A Button of player " + playerId + " is " + down);
            });
            _gameInputProvider.GetBKeyDown().Subscribe(down =>
            {
                Debug.Log("B Button of player " + playerId + " is " + down);
            });

            _gameInputProvider.GetAKeyHold().Subscribe(hold =>
            {
                Debug.Log("B Button of player " + playerId + " is hold down" + hold);
            });
            _gameInputProvider.GetMovement().Subscribe(dir => { Position.Value += Time.deltaTime * dir; });
        }