Esempio 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);
 }
Esempio n. 2
0
 public void ShipBlow(AShip ship)
 {
     list.Delete(ship);
 }
Esempio n. 3
0
 public void Delete(AShip ship)
 {
     activeShips.Remove(ship);
 }
Esempio n. 4
0
 public void Push(AShip ship)
 {
     activeShips.Add(ship);
 }
Esempio n. 5
0
 public Deck(AShip ship)
 {
     this.status = Status.ok;
     this.ship   = ship;
 }
Esempio n. 6
0
 public ShipToStatusManager(AShip ship)
 {
     this.ship = ship;
 }