public Ship(string name, int hp, int x, int y, bool horizontal, BoardPlacement placement) { Name = name; BattleReady = new BattleReadyState(this); TakingOnWater = new TakingOnWaterState(this); Sunk = new SunkState(this); Current = BattleReady; X = x; Y = y; Horizontal = horizontal; hitpoints = new List <int[]>(); if (horizontal) { for (int i = 0; i < hp; i++) { hitpoints.Add(new int[] { x + i, y }); } } else { for (int i = 0; i < hp; i++) { hitpoints.Add(new int[] { x, y + i }); } } BoardPlacement = placement; }
public Battleship(int x, int y, bool horizontal, BoardPlacement placement) : base("Battleship", 4, x, y, horizontal, placement) { }
public Destroyer(int x, int y, bool horizontal, BoardPlacement placement) : base("Destroyer", 3, x, y, horizontal, placement) { }
public PatrolBoat(int x, int y, bool horizontal, BoardPlacement placement) : base("Patrol Boat", 2, x, y, horizontal, placement) { }
public Submarine(int x, int y, bool horizontal, BoardPlacement placement) : base("Submarine", 3, x, y, horizontal, placement) { }
public AircraftCarrier(int x, int y, bool horizontal, BoardPlacement placement) : base("Aircraft Carrier", 5, x, y, horizontal, placement) { }