public IGameBuilderSetStartingPlayer SecondPlayerSet(IPlayerType playerType) { var player = playerType.Player; _players = _players.Add(player); _startingPlayerMapper = _startingPlayerMapper.Add(StartingPlayer.As().SecondPlayer(), player); return(this); }
private Brush GetBrushForPlayerType(IPlayerType playerType) { if (playerType.GetType() == typeof(BluePlayer)) { return(new SolidBrush(Color.Blue)); } else if (playerType.GetType() == typeof(GreenPlayer)) { return(new SolidBrush(Color.Green)); } else if (playerType.GetType() == typeof(RedPlayer)) { return(new SolidBrush(Color.Red)); } else if (playerType.GetType() == typeof(YellowPlayer)) { return(new SolidBrush(Color.Yellow)); } return(new SolidBrush(Color.Gray)); }
private static IGameBuilder BuildGameBuilder(IStartingPlayerMapper startingPlayerMapper = null, IPlayers players = null, IBoardService boardService = null, int?size = null, IPlayerType firstPlayerType = null, IPlayerType secondPlayerType = null, IStartingPlayer startingPlayer = null) { startingPlayerMapper = startingPlayerMapper ?? new MockStartingPlayerMapper().AddReturnsItself(); players = players ?? new MockPlayers().AddReturnsItself(); boardService = boardService ?? new MockBoardService(); size = size ?? 3; firstPlayerType = firstPlayerType ?? new MockPlayerType(); secondPlayerType = secondPlayerType ?? new MockPlayerType(); startingPlayer = startingPlayer ?? new MockStartingPlayer(); return(GameBuilder .Initialize(startingPlayerMapper, players, boardService) .WithBoardSize(size.Value) .FirstPlayerSet(firstPlayerType) .SecondPlayerSet(secondPlayerType) .Set(startingPlayer)); }
private bool PlayerOfTypeExists(IPlayerType playerType) { return(Players.Any(x => x.PlayerType.GetType() == playerType.GetType())); }
public Player(IPlayerType playerType) { this.PlayerType = playerType; }
public void AddToGame(Guid gameGUID, IPlayerType playerType) { GameSessionGUID = gameGUID; PlayerType = playerType; State = PlayerState.Playing; }