Ejemplo n.º 1
0
 public bool SetShipOnMap(AShip ship, Direction dir, int x, int y)
 {
     if (!CheckPlaceForShip(ship.size, dir, x, y))
     {
         return(false);
     }
     if (dir == Direction.right)
     {
         foreach (Deck deck in ship.decks)
         {
             cells[x, y].deck = deck;
             x++;
         }
     }
     else if (dir == Direction.left)
     {
         foreach (Deck deck in ship.decks)
         {
             cells[x, y].deck = deck;
             x--;
         }
     }
     else if (dir == Direction.down)
     {
         foreach (Deck deck in ship.decks)
         {
             cells[x, y].deck = deck;
             y++;
         }
     }
     else if (dir == Direction.up)
     {
         foreach (Deck deck in ship.decks)
         {
             cells[x, y].deck = deck;
             y--;
         }
     }
     return(true);
 }
Ejemplo n.º 2
0
 public void ShipBlow(AShip ship)
 {
     list.Delete(ship);
 }
Ejemplo n.º 3
0
 public void Delete(AShip ship)
 {
     activeShips.Remove(ship);
 }
Ejemplo n.º 4
0
 public void Push(AShip ship)
 {
     activeShips.Add(ship);
 }
Ejemplo n.º 5
0
 public Deck(AShip ship)
 {
     this.status = Status.ok;
     this.ship   = ship;
 }
Ejemplo n.º 6
0
 public ShipToStatusManager(AShip ship)
 {
     this.ship = ship;
 }