/// /// Battleships 0 from 1 /// Cruisers 0 from 1 /// Destroyers 0 from 1 /// Submarines 0 from 1 /// public ArrangeShipsLogic() { shipCreator = new LogicShipCreator(); arrangingShipsRrocess = ArrangingShipsRrocess.ArrangeBattleship; currentCountBattleships = 0; currentCountCruisers = 0; currentCountDestroyers = 0; currentCountSubmarines = 0; maxCountBattleships = 1; maxCountCruisers = 2; maxCountDestroyers = 3; maxCountSubmarines = 4; /// Size Number per player /// battleship 4 1 /// cruiser 3 2 /// destroyer 2 3 /// submarine 1 4 /// /// /// Number per player = maxCount......(maxCountBattleships) /// Size = countElementsFor.......(countElementsForBattleships) countElementsForBattleships = 4; countElementsForCruisers = 3; countElementsForDestroyers = 2; countElementsForSubmarines = 1; CurrentMessage = "You have to arrange Battleship: ■ ■ ■ ■\nNow you have " + currentCountBattleships + " Battleships from " + maxCountBattleships; }
private int ArrangeBattleShip(Square[] squares) { if (shipCreator.IsItPossibleToCreateShip(squares, countElementsForBattleships)) { Ship = shipCreator.GetShip(squares); currentCountBattleships++; if (currentCountBattleships == maxCountBattleships) { arrangingShipsRrocess = ArrangingShipsRrocess.ArrangeCruiser; CurrentMessage = "You have to arrange Cruiser: ■ ■ ■\nNow you have " + currentCountCruisers + " Cruisers from " + maxCountCruisers; } return(1); } ErrorMessage = shipCreator.GetErrorMessage(); return(-1); }
private int ArrangeSubmarine(Square[] squares) { if (shipCreator.IsItPossibleToCreateShip(squares, countElementsForSubmarines)) { Ship = shipCreator.GetShip(squares); currentCountSubmarines++; CurrentMessage = "You have to arrange Submarine: ■\nNow you have " + currentCountSubmarines + " Submarines from " + maxCountSubmarines; if (currentCountSubmarines == maxCountSubmarines) { arrangingShipsRrocess = ArrangingShipsRrocess.Finished; CurrentMessage = "You have finished arranging ships!"; } return(1); } ErrorMessage = shipCreator.GetErrorMessage(); return(-1); }
private int ArrangeDestroyer(Square[] squares) { if (shipCreator.IsItPossibleToCreateShip(squares, countElementsForDestroyers)) { Ship = shipCreator.GetShip(squares); currentCountDestroyers++; CurrentMessage = "You have to arrange Destroyer: ■ ■\nNow you have " + currentCountDestroyers + " Destroyers from " + maxCountDestroyers; if (currentCountDestroyers == maxCountDestroyers) { arrangingShipsRrocess = ArrangingShipsRrocess.ArrangeSubmarine; CurrentMessage = "You have to arrange Submarine: ■\nNow you have " + currentCountSubmarines + " Submarines from " + maxCountSubmarines; } return(1); } ErrorMessage = shipCreator.GetErrorMessage(); return(-1); }