Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
 public Battleship(int x, int y, bool horizontal, BoardPlacement placement) : base("Battleship", 4, x, y, horizontal, placement)
 {
 }
Ejemplo n.º 3
0
 public Destroyer(int x, int y, bool horizontal, BoardPlacement placement) : base("Destroyer", 3, x, y, horizontal, placement)
 {
 }
Ejemplo n.º 4
0
 public PatrolBoat(int x, int y, bool horizontal, BoardPlacement placement) : base("Patrol Boat", 2, x, y, horizontal, placement)
 {
 }
Ejemplo n.º 5
0
 public Submarine(int x, int y, bool horizontal, BoardPlacement placement) : base("Submarine", 3, x, y, horizontal, placement)
 {
 }
Ejemplo n.º 6
0
 public AircraftCarrier(int x, int y, bool horizontal, BoardPlacement placement) : base("Aircraft Carrier", 5, x, y, horizontal, placement)
 {
 }