public override CellsGroup GetArea(GridCell gCell) { CellsGroup cG = new CellsGroup(); // Debug.Log(gCell); if (!gCell) { return(cG); } switch (OData.bombType) { case BombDir.Vertical: cG.AddRange(gCell.GColumn.cells); //cG.AddRange(gCell.GColumn.GetDynamicArea()); break; case BombDir.Horizontal: cG.AddRange(gCell.GRow.cells); // cG.AddRange(gCell.GRow.GetDynamicArea()); break; case BombDir.Radial: List <GridCell> areaRad = MBoard.grid.GetAroundArea(gCell, 1).Cells; cG.Add(gCell); foreach (var item in areaRad) { cG.Add(item); // if (item.IsMatchable) } break; case BombDir.Color: cG.AddRange(MGrid.GetAllByID(OData.matchID).SortByDistanceTo(gCell)); break; } return(cG); }
public CellsGroup GetWave(GridCell gCell, int radius) { radius = Mathf.Max(0, radius); CellsGroup res = new CellsGroup(); int row1 = gCell.Row - radius; int row2 = gCell.Row + radius; int col1 = gCell.Column - radius; int col2 = gCell.Column + radius; Row <GridCell> topRow = GetRow(row1); Row <GridCell> botRow = GetRow(row2); Column <GridCell> leftCol = GetColumn(col1); Column <GridCell> rightCol = GetColumn(col2); if (topRow != null) { for (int i = col1; i <= col2; i++) { if (ok(row1, i)) { res.Add(topRow[i]); } } } if (rightCol != null) { for (int i = row1; i <= row2; i++) { if (ok(i, col2)) { res.Add(rightCol[i]); } } } if (botRow != null) { for (int i = col2; i >= col1; i--) { if (ok(row2, i)) { res.Add(botRow[i]); } } } if (leftCol != null) { for (int i = row2; i >= row1; i--) { if (ok(i, col1)) { res.Add(leftCol[i]); } } } return(res); }
public override CellsGroup GetArea(GridCell gCell) { CellsGroup cG = new CellsGroup(); List <GridCell> area = MBoard.grid.GetAroundArea(gCell, radius).Cells; cG.Add(gCell); foreach (var item in area) { // if(item.IsMatchable) cG.Add(item); } return(cG); }
public override CellsGroup GetArea(GridCell hitGridCell) { CellsGroup cG = new CellsGroup(); List <GridCell> area = MBoard.grid.GetAllByID(hitGridCell.Match.GetID()); cG.Add(hitGridCell); foreach (var item in area) { if (hitGridCell.IsMatchObjectEquals(item) && item.IsMatchable) { cG.Add(item); } } return(cG); }
public override CellsGroup GetArea(GridCell hitGridCell) { CellsGroup cG = new CellsGroup(); List <GridCell> area = new NeighBors(hitGridCell, true).Cells; cG.Add(hitGridCell); foreach (var item in area) { if (hitGridCell.IsMatchObjectEquals(item) && item.IsMatchable) { cG.Add(item); } } return(cG); }
public override CellsGroup GetArea(GridCell hitGridCell) { CellsGroup cG = new CellsGroup(); GridCell [] area = hitGridCell.GRow.cells; foreach (var item in area) { if (item.IsMatchable) { cG.Add(item); } } area = hitGridCell.GColumn.cells; foreach (var item in area) { if (item.IsMatchable) { cG.Add(item); } } return(cG); }