Пример #1
0
 public Cell(ShipPart shipPart)
 {
     ShipPart = shipPart;
     if (shipPart.Destroyed)
     {
         CellType = CellType.SHIP_PART_DESTROYED;
     }
     else
     {
         CellType = CellType.SHIP_PART_OK;
     }
 }
Пример #2
0
 public static bool SetShip(Cell[,] board, List <Ship> ships, Ship ship) //установка корабля
 {
     if (TryShip(board, ship))
     {
         ships.Add(ship);
         for (int i = 0; i < ship.Length; i++)
         {
             ShipPart sp = ship.ShipParts[i];
             board[sp.X, sp.Y].CellType = CellType.SHIP_PART_OK;
             board[sp.X, sp.Y].ShipPart = sp;
             //++ShipPartsNumber;
         }
         return(true);
     }
     return(false);
 }