private Cell CreateCell(int x, int y) { Cell cell = new Cell(this) { X = x, Y = y }; cell.InstantiateCell(); CellGrid.Children.Add(cell.CellImage); return cell; }
public void ShowEmptyAround(Cell cell) { if (cell.IsBomb) return; for (int x = cell.X - 1; x <= cell.X + 1; x++) { for (int y = cell.Y - 1; y <= cell.Y + 1; y++) { Cell check = GetCell(x, y); if (check != null && check.GetShowState().Clickable && !check.IsBomb) { if (check.GetState() == Cell.State.BOMBS[0]) { check.Show(); ShowEmptyAround(check); } else if (!check.GetState().Clickable) { check.Show(); } } } } }
private void CheckBombsAround(Cell cell) { for (int x = cell.X - 1; x <= cell.X + 1; x++) { for (int y = cell.Y - 1; y <= cell.Y + 1; y++) { Cell check = GetCell(x, y); if (check != null && !check.IsBomb) { check.NextToBomb(); } } } }
public bool GetCellRelativeTo(int x, int y, out Cell producedCell) { Cell cell = GetCell(x, y); if (cell != null && cell.IsClickable()) { producedCell = cell; return true; } producedCell = null; return false; }