public void FloodFill(IMapStateProvider mapStateProvider, FightMapMovementContext.Cell[] grid, Vector2Int position, int movementPoints, bool canPassThrough) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) Queue <FloodFillNode> floodFillFrontier = m_floodFillFrontier; Vector2Int sizeMin = mapStateProvider.sizeMin; Vector2Int sizeMax = mapStateProvider.sizeMax; floodFillFrontier.Clear(); FloodFillNode item = new FloodFillNode(position, 0); floodFillFrontier.Enqueue(item); Vector2Int coords2 = default(Vector2Int); Vector2Int coords3 = default(Vector2Int); Vector2Int coords4 = default(Vector2Int); Vector2Int coords5 = default(Vector2Int); do { FloodFillNode floodFillNode = floodFillFrontier.Dequeue(); Vector2Int coords = floodFillNode.coords; int cost = floodFillNode.cost; if (cost >= movementPoints) { continue; } int cost2 = cost + 1; int x = coords.get_x(); int y = coords.get_y(); int x2 = sizeMin.get_x(); int y2 = sizeMin.get_y(); int x3 = sizeMax.get_x(); int y3 = sizeMax.get_y(); coords2._002Ector(x, y + 1); coords3._002Ector(x - 1, y); coords4._002Ector(x + 1, y); coords5._002Ector(x, y - 1); int x4 = coords2.get_x(); int y4 = coords2.get_y(); if (x4 >= x2 && x4 < x3 && y4 >= y2 && y4 < y3) { int cellIndex = mapStateProvider.GetCellIndex(x4, y4); FightMapMovementContext.Cell cell = grid[cellIndex]; FightMapMovementContext.CellState state = cell.state; if ((state & (FightMapMovementContext.CellState.Movement | FightMapMovementContext.CellState.Reachable)) == FightMapMovementContext.CellState.Movement) { grid[cellIndex] = new FightMapMovementContext.Cell(coords2, state | FightMapMovementContext.CellState.Reachable, cell.entity); if (((state & FightMapMovementContext.CellState.Occupied) == FightMapMovementContext.CellState.None) | canPassThrough) { FloodFillNode item2 = new FloodFillNode(coords2, cost2); floodFillFrontier.Enqueue(item2); } } } int x5 = coords3.get_x(); int y5 = coords3.get_y(); if (x5 >= x2 && x5 < x3 && y5 >= y2 && y5 < y3) { int cellIndex2 = mapStateProvider.GetCellIndex(x5, y5); FightMapMovementContext.Cell cell2 = grid[cellIndex2]; FightMapMovementContext.CellState state2 = cell2.state; if ((state2 & (FightMapMovementContext.CellState.Movement | FightMapMovementContext.CellState.Reachable)) == FightMapMovementContext.CellState.Movement) { grid[cellIndex2] = new FightMapMovementContext.Cell(coords3, state2 | FightMapMovementContext.CellState.Reachable, cell2.entity); if (((state2 & FightMapMovementContext.CellState.Occupied) == FightMapMovementContext.CellState.None) | canPassThrough) { FloodFillNode item3 = new FloodFillNode(coords3, cost2); floodFillFrontier.Enqueue(item3); } } } int x6 = coords4.get_x(); int y6 = coords4.get_y(); if (x6 >= x2 && x6 < x3 && y6 >= y2 && y6 < y3) { int cellIndex3 = mapStateProvider.GetCellIndex(x6, y6); FightMapMovementContext.Cell cell3 = grid[cellIndex3]; FightMapMovementContext.CellState state3 = cell3.state; if ((state3 & (FightMapMovementContext.CellState.Movement | FightMapMovementContext.CellState.Reachable)) == FightMapMovementContext.CellState.Movement) { grid[cellIndex3] = new FightMapMovementContext.Cell(coords4, state3 | FightMapMovementContext.CellState.Reachable, cell3.entity); if (((state3 & FightMapMovementContext.CellState.Occupied) == FightMapMovementContext.CellState.None) | canPassThrough) { FloodFillNode item4 = new FloodFillNode(coords4, cost2); floodFillFrontier.Enqueue(item4); } } } int x7 = coords5.get_x(); int y7 = coords5.get_y(); if (x7 < x2 || x7 >= x3 || y7 < y2 || y7 >= y3) { continue; } int cellIndex4 = mapStateProvider.GetCellIndex(x7, y7); FightMapMovementContext.Cell cell4 = grid[cellIndex4]; FightMapMovementContext.CellState state4 = cell4.state; if ((state4 & (FightMapMovementContext.CellState.Movement | FightMapMovementContext.CellState.Reachable)) == FightMapMovementContext.CellState.Movement) { grid[cellIndex4] = new FightMapMovementContext.Cell(coords5, state4 | FightMapMovementContext.CellState.Reachable, cell4.entity); if (((state4 & FightMapMovementContext.CellState.Occupied) == FightMapMovementContext.CellState.None) | canPassThrough) { FloodFillNode item5 = new FloodFillNode(coords5, cost2); floodFillFrontier.Enqueue(item5); } } }while (floodFillFrontier.Count > 0); }
private void ComputeAdjacentCoords(IMapStateProvider mapStateProvider, FightMapMovementContext.Cell[] grid, Vector2Int coords, Vector2Int from) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) Vector2Int sizeMin = mapStateProvider.sizeMin; Vector2Int sizeMax = mapStateProvider.sizeMax; int x = coords.get_x(); int y = coords.get_y(); int x2 = sizeMin.get_x(); int y2 = sizeMin.get_y(); int x3 = sizeMax.get_x(); int y3 = sizeMax.get_y(); bool canPassThrough = m_canPassThrough; Vector2Int val = default(Vector2Int); val._002Ector(x, y + 1); Vector2Int val2 = default(Vector2Int); val2._002Ector(x - 1, y); Vector2Int val3 = default(Vector2Int); val3._002Ector(x + 1, y); Vector2Int val4 = default(Vector2Int); val4._002Ector(x, y - 1); int x4 = val.get_x(); int y4 = val.get_y(); bool isValid; if (val != from && x4 >= x2 && x4 < x3 && y4 >= y2 && y4 < y3) { int cellIndex = mapStateProvider.GetCellIndex(x4, y4); FightMapMovementContext.CellState state = grid[cellIndex].state; isValid = (((state & FightMapMovementContext.CellState.Reachable) != 0 && (((state & FightMapMovementContext.CellState.Occupied) == FightMapMovementContext.CellState.None) | canPassThrough)) || (state & FightMapMovementContext.CellState.Targeted) != FightMapMovementContext.CellState.None); } else { isValid = false; } int x5 = val2.get_x(); int y5 = val2.get_y(); bool isValid2; if (val2 != from && x5 >= x2 && x5 < x3 && y5 >= y2 && y5 < y3) { int cellIndex2 = mapStateProvider.GetCellIndex(x5, y5); FightMapMovementContext.CellState state2 = grid[cellIndex2].state; isValid2 = (((state2 & FightMapMovementContext.CellState.Reachable) != 0 && (((state2 & FightMapMovementContext.CellState.Occupied) == FightMapMovementContext.CellState.None) | canPassThrough)) || (state2 & FightMapMovementContext.CellState.Targeted) != FightMapMovementContext.CellState.None); } else { isValid2 = false; } int x6 = val3.get_x(); int y6 = val3.get_y(); bool isValid3; if (val3 != from && x6 >= x2 && x6 < x3 && y6 >= y2 && y6 < y3) { int cellIndex3 = mapStateProvider.GetCellIndex(x6, y6); FightMapMovementContext.CellState state3 = grid[cellIndex3].state; isValid3 = (((state3 & FightMapMovementContext.CellState.Reachable) != 0 && (((state3 & FightMapMovementContext.CellState.Occupied) == FightMapMovementContext.CellState.None) | canPassThrough)) || (state3 & FightMapMovementContext.CellState.Targeted) != FightMapMovementContext.CellState.None); } else { isValid3 = false; } int x7 = val4.get_x(); int y7 = val4.get_y(); bool isValid4; if (val4 != from && x7 >= x2 && x7 < x3 && y7 >= y2 && y7 < y3) { int cellIndex4 = mapStateProvider.GetCellIndex(x7, y7); FightMapMovementContext.CellState state4 = grid[cellIndex4].state; isValid4 = (((state4 & FightMapMovementContext.CellState.Reachable) != 0 && (((state4 & FightMapMovementContext.CellState.Occupied) == FightMapMovementContext.CellState.None) | canPassThrough)) || (state4 & FightMapMovementContext.CellState.Targeted) != FightMapMovementContext.CellState.None); } else { isValid4 = false; } AdjacentCoord[] adjacentCoordsBuffer = m_adjacentCoordsBuffer; adjacentCoordsBuffer[0] = new AdjacentCoord(val, isValid); adjacentCoordsBuffer[1] = new AdjacentCoord(val2, isValid2); adjacentCoordsBuffer[2] = new AdjacentCoord(val3, isValid3); adjacentCoordsBuffer[3] = new AdjacentCoord(val4, isValid4); }
public static void SetupMovementAreaHighlight([NotNull] FightMapFeedbackResources resources, [NotNull] FightMapMovementContext context, Vector2Int coords, [NotNull] CellHighlight highlight, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) if ((context.GetCell(coords).state & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) != FightMapMovementContext.CellState.Reachable) { highlight.ClearSprite(); return; } IMapStateProvider stateProvider = context.stateProvider; Vector2Int sizeMin = stateProvider.sizeMin; Vector2Int sizeMax = stateProvider.sizeMax; FightMapMovementContext.Cell[] grid = context.grid; Sprite[] areaFeedbackSprites = resources.areaFeedbackSprites; Vector2Int val = default(Vector2Int); val._002Ector(coords.get_x(), coords.get_y() + 1); Vector2Int val2 = default(Vector2Int); val2._002Ector(coords.get_x() - 1, coords.get_y()); Vector2Int val3 = default(Vector2Int); val3._002Ector(coords.get_x() + 1, coords.get_y()); Vector2Int val4 = default(Vector2Int); val4._002Ector(coords.get_x(), coords.get_y() - 1); FightMapMovementContext.CellState cellState = (val.get_x() >= sizeMin.get_x() && val.get_x() < sizeMax.get_x() && val.get_y() >= sizeMin.get_y() && val.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val.get_x(), val.get_y())].state : FightMapMovementContext.CellState.None; FightMapMovementContext.CellState cellState2 = (val2.get_x() >= sizeMin.get_x() && val2.get_x() < sizeMax.get_x() && val2.get_y() >= sizeMin.get_y() && val2.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val2.get_x(), val2.get_y())].state : FightMapMovementContext.CellState.None; FightMapMovementContext.CellState cellState3 = (val3.get_x() >= sizeMin.get_x() && val3.get_x() < sizeMax.get_x() && val3.get_y() >= sizeMin.get_y() && val3.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val3.get_x(), val3.get_y())].state : FightMapMovementContext.CellState.None; FightMapMovementContext.CellState num = (val4.get_x() >= sizeMin.get_x() && val4.get_x() < sizeMax.get_x() && val4.get_y() >= sizeMin.get_y() && val4.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val4.get_x(), val4.get_y())].state : FightMapMovementContext.CellState.None; int num2 = ((cellState & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) == FightMapMovementContext.CellState.Reachable) ? 1 : 0; int num3 = ((cellState2 & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) == FightMapMovementContext.CellState.Reachable) ? 1 : 0; int num4 = ((cellState3 & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) == FightMapMovementContext.CellState.Reachable) ? 1 : 0; int num5 = ((num & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) == FightMapMovementContext.CellState.Reachable) ? 1 : 0; switch (4 - (num2 + num3 + num4 + num5)) { case 0: case 1: case 2: { Vector2Int val5 = default(Vector2Int); val5._002Ector(coords.get_x() - 1, coords.get_y() + 1); Vector2Int val6 = default(Vector2Int); val6._002Ector(coords.get_x() + 1, coords.get_y() + 1); Vector2Int val7 = default(Vector2Int); val7._002Ector(coords.get_x() - 1, coords.get_y() - 1); Vector2Int val8 = default(Vector2Int); val8._002Ector(coords.get_x() + 1, coords.get_y() - 1); FightMapMovementContext.CellState cellState4 = (val5.get_x() >= sizeMin.get_x() && val5.get_x() < sizeMax.get_x() && val5.get_y() >= sizeMin.get_y() && val5.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val5.get_x(), val5.get_y())].state : FightMapMovementContext.CellState.None; FightMapMovementContext.CellState cellState5 = (val6.get_x() >= sizeMin.get_x() && val6.get_x() < sizeMax.get_x() && val6.get_y() >= sizeMin.get_y() && val6.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val6.get_x(), val6.get_y())].state : FightMapMovementContext.CellState.None; FightMapMovementContext.CellState cellState6 = (val7.get_x() >= sizeMin.get_x() && val7.get_x() < sizeMax.get_x() && val7.get_y() >= sizeMin.get_y() && val7.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val7.get_x(), val7.get_y())].state : FightMapMovementContext.CellState.None; FightMapMovementContext.CellState num6 = (val8.get_x() >= sizeMin.get_x() && val8.get_x() < sizeMax.get_x() && val8.get_y() >= sizeMin.get_y() && val8.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val8.get_x(), val8.get_y())].state : FightMapMovementContext.CellState.None; int num7 = ((cellState4 & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) != FightMapMovementContext.CellState.Reachable) ? 1 : 0; int num8 = ((cellState5 & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) != FightMapMovementContext.CellState.Reachable) ? 1 : 0; int num9 = ((cellState6 & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) != FightMapMovementContext.CellState.Reachable) ? 1 : 0; int num10 = ((num6 & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) != FightMapMovementContext.CellState.Reachable) ? 1 : 0; int num11 = 1 - num2; int num12 = 1 - num3; int num13 = 1 - num4; int num14 = 1 - num5; int num15 = num11 | num12 | (num7 * num2 * num3); int num16 = num11 | num13 | (num8 * num2 * num4); int num17 = num14 | num12 | (num9 * num5 * num3); int num18 = num14 | num13 | (num10 * num5 * num4); Compute(num15 | (num16 << 1) | (num17 << 2) | (num18 << 3) | (num11 << 4) | (num12 << 5) | (num13 << 6) | (num14 << 7), areaFeedbackSprites, highlight, color); break; } case 3: { Sprite sprite2 = areaFeedbackSprites[4]; float angle = (float)num2 * -90f + (float)num4 * 180f + (float)num5 * 90f; highlight.SetSprite(sprite2, color, angle); break; } case 4: { Sprite sprite = areaFeedbackSprites[5]; highlight.SetSprite(sprite, color); break; } default: throw new ArgumentException(); } }