void Clear() { if (Grids != null) { for (var i = 0; i < Grids.GetLength(0); i++) { for (var j = 0; j < Grids.GetLength(1); j++) { DestroyImmediate(Grids[i, j].gameObject); } } Grids = null; } if (Tiles != null) { for (var i = 0; i < Tiles.GetLength(0); i++) { for (var j = 0; j < Tiles.GetLength(1); j++) { DestroyImmediate(Tiles[i, j].gameObject); } } Tiles = null; } }
public IEnumerable <Cell> BoardCellsWithValues() { for (int i = 0; i < Grids.GetLength(0); i++) { for (int j = 0; j < Grids.GetLength(1); j++) { if (CellBoard[i, j] != null) { yield return(CellBoard[i, j]); } } } }
private bool IsGridsOutOfRenge(int x, int y) { if (x < 0 || y < 0) { return(true); } if (Grids.GetLength(0) <= x) { return(true); } if (Grids.GetLength(1) <= y) { return(true); } return(false); }
public IEnumerable <Cell> GetLoadedCells2() { var result = new List <Cell>(); for (int i = 0; i < Grids.GetLength(0); i++) { for (int j = 0; j < Grids.GetLength(1); j++) { if (!string.IsNullOrEmpty(Grids[i, j])) { result.Add(new Cell { Character = Grids[i, j], Col = j, Row = i }); } } } return(result); }