public MainWindow() { InitializeComponent(); Board boardOne = new Board(firstPlayerBoard, true); Board boardTwo = new Board(secondPlayerBoard, false); Shipyard shipyardPlayer = new Shipyard(boardOne); Shipyard shipyardCpu = new Shipyard(boardTwo); //for sake of debug, need to change it! int shipSize = 5; shipyardPlayer.CreateShip(shipSize, RandomID(), RandomAlligment()); int shipSize2 = 4; shipyardPlayer.CreateShip(shipSize2, RandomID(), RandomAlligment()); int shipSize3 = 3; shipyardPlayer.CreateShip(shipSize3, RandomID(), RandomAlligment()); int shipSize4 = 2; shipyardPlayer.CreateShip(shipSize4, RandomID(), RandomAlligment()); shipyardCpu.CreateShip(shipSize, RandomID(), RandomAlligment()); shipyardCpu.CreateShip(shipSize2, RandomID(), RandomAlligment()); shipyardCpu.CreateShip(shipSize3, RandomID(), RandomAlligment()); shipyardCpu.CreateShip(shipSize4, RandomID(), RandomAlligment()); HumanPlayer player = new HumanPlayer(boardOne, "Player", false); CPUPlayerEasy cpu = new CPUPlayerEasy(boardTwo, "Computer", false); TurnTextBlock = turnTextBlock; gameManager = new GameManager(gameCanvas, boardOne, boardTwo, player, cpu); }
public GameManager(Canvas canvas, Board boardOne, Board boardTwo, HumanPlayer player, CPUPlayerEasy cpu) { this._canvas = canvas; this._boardOne = boardOne; this._boardTwo = boardTwo; this._player = player; this._cpu = cpu; if (CoinRoll().Equals(0)) { playerTurn = true; MainWindow.TurnTextBlock.Text = "<== Turn"; } else { playerTurn = false; MainWindow.TurnTextBlock.Text = "Turn ==>"; } HandleTurns(); }