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