public void CreateFleet() { for (int shipSize = 4; shipSize > 0; shipSize--) { for (int shipQuantity = 1; shipQuantity < 6 - shipSize; shipQuantity++) { AllShips.Add(new Ship(shipSize, this)); } } }
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)); } }
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); }