示例#1
0
 public void CreateFleet()
 {
     for (int shipSize = 4; shipSize > 0; shipSize--)
     {
         for (int shipQuantity = 1; shipQuantity < 6 - shipSize; shipQuantity++)
         {
             AllShips.Add(new Ship(shipSize, this));
         }
     }
 }
示例#2
0
 public void AskPlayerToPlaceShip(int shipSize)
 {
     if (shipSize > 1)
     {
         var doubleCoord = DoubleCoord.CreateBothCoords(shipSize, this);
         AllShips.Add(new Ship(doubleCoord, this));
     }
     else
     {
         var coord = Coord.CreateNewCoord(this, shipSize, "");
         AllShips.Add(new Ship(coord, this));
     }
 }
示例#3
0
        public Ship Spawn(ShipSpecification spec, Position p)
        {
            var ship = new Ship();

            ship.Initialize(spec);
            ship.Position = p;
            ship.ShipId   = 1;
            if (AllShips.Any())
            {
                ship.ShipId = AllShips.Max(x => x.ShipId) + 1;
            }
            AllShips.Add(ship);
            return(ship);
        }