public int ArrangeShip(Square[] squares) { int result = 0; if (gameprocess != Gameprocess.ArrangeShips) { return(-1); } result = arrangeShipsLogic.ArrangeShip(squares); switch (result) { case -1: ErrorMessage = arrangeShipsLogic.ErrorMessage; break; case 1: userShips[currentShipIndex] = arrangeShipsLogic.Ship; currentShipIndex++; CurrentMessage = arrangeShipsLogic.CurrentMessage; if (currentShipIndex == userShips.Length) { ArrangingShipIsFinished = true; gameprocess = Gameprocess.Fighting; CurrentMessage = "Arranging ships is finished\nYou can start battle!"; } break; } return(result); }
public BattleshipLogic() { numberOfShips = 10; userShips = new Ship[numberOfShips]; computerShips = new Ship[numberOfShips]; gameprocess = Gameprocess.ArrangeShips; ArrangingShipIsFinished = false; arrangeShipsLogic = new ArrangeShipsLogic(); CurrentMessage = arrangeShipsLogic.CurrentMessage; }