コード例 #1
0
 /// <summary>
 /// Constructor for King Survival Engine
 /// </summary>
 /// <param name="renderer">The output renderer</param>
 /// <param name="inputProvider">The input provider</param>
 /// <param name="board">The board for the game</param>
 /// <param name="winningConditions">Winning conditions for the game</param>
 /// <param name="players">Players that are playing the game</param>
 /// <param name="memory">The memory for the board</param>
 /// <param name="context">Context for command execute</param>
 /// <param name="commandFactory">Command Factory</param>
 public KingSurvivalEngine(
     IRenderer renderer,
     IInputProvider inputProvider,
     IBoard board,
     IWinningConditions winningConditions,
     IList<IPlayer> players,
     BoardMemory memory,
     ICommandContext context,
     ICommandFactory commandFactory)
 {
     this.context = new KingSurvivalEngineContext(renderer, inputProvider, board, winningConditions, players, memory, context, commandFactory);
 }
コード例 #2
0
 public KingSurvivalEngineContext(IRenderer renderer, IInputProvider inputProvider, IBoard board, IWinningConditions winningConditions, IList<IPlayer> players)
 {
     this.renderer = renderer;
     this.provider = inputProvider;
     this.winningConditions = winningConditions;
     this.players = players;
     this.memory = new BoardMemory();
     this.currentPlayerIndex = 0;
     this.board = board;
     this.kingPlayer = this.players[0];
     this.pawnPlayer = this.players[1];
 }
コード例 #3
0
ファイル: Game.cs プロジェクト: kskondov/King-Survival-4
 /// <summary>
 /// Method for starting a game
 /// </summary>
 /// <param name="renderer">The renderer on which the info is going to be rendered</param>
 /// <param name="provider">The input provider that provides information</param>
 public void Start(IRenderer renderer, IInputProvider provider)
 {
     renderer.RenderMainMenu();
     IWinningConditions winningConditions = new WinningConditions();
     var players = new List<IPlayer>();
     var kingPlayer = new Player(provider.GetPlayerName());
     var pawnPlayer = new Player(provider.GetPlayerName());
     players.Add(kingPlayer);
     players.Add(pawnPlayer);
     var board = new Board.Board();
     var memory = new BoardMemory();
     var context = new CommandContext(memory, board, players[0]);
     var commandFactory = new CommandFactory();
     var engine = new KingSurvivalEngine(renderer, provider, board, winningConditions, players, memory, context, commandFactory);
     engine.InitializeGame().StartGame();
 }
コード例 #4
0
 /// <summary>
 /// Constructor for creating King Survival Engine
 /// </summary>
 /// <param name="renderer">The output renderer</param>
 /// <param name="inputProvider">The input provider</param>
 /// <param name="board">The board for the game</param>
 /// <param name="winningConditions">Winning conditions for the game</param>
 /// <param name="players">Players that are playing the game</param>
 /// <param name="memory">The memory for the board</param>
 /// <param name="context">Context for command execute</param>
 /// <param name="commandFactory">Command Factory</param>
 public KingSurvivalEngineContext(
     IRenderer renderer,
     IInputProvider inputProvider,
     IBoard board,
     IWinningConditions winningConditions,
     IList<IPlayer> players,
     BoardMemory memory,
     ICommandContext context,
     ICommandFactory commandFactory)
 {
     this.renderer = renderer;
     this.provider = inputProvider;
     this.winningConditions = winningConditions;
     this.players = players;
     this.memory = memory;
     this.currentPlayerIndex = 0;
     this.board = board;
     this.kingPlayer = this.players[0];
     this.pawnPlayer = this.players[1];
     this.context = context;
     this.commandFactory = commandFactory;
 }
コード例 #5
0
 public CommandContext(BoardMemory memento, IBoard board, IPlayer player)
 {
     this.Memory = memento;
     this.Board = board;
     this.Player = player;
 }