private void ComputeAdjacentCoords(MapData data, Vector2Int coords, Vector2Int from) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) int x = coords.get_x(); int y = coords.get_y(); 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 x2 = val.get_x(); int y2 = val.get_y(); bool isValid; if (val != from && data.IsInsideLocal(x2, y2)) { int cellIndexLocal = data.GetCellIndexLocal(x2, y2); isValid = (data.cells[cellIndexLocal].state == MapData.CellState.Walkable); } else { isValid = false; } int x3 = val2.get_x(); int y3 = val2.get_y(); bool isValid2; if (val2 != from && data.IsInsideLocal(x3, y3)) { int cellIndexLocal2 = data.GetCellIndexLocal(x3, y3); isValid2 = (data.cells[cellIndexLocal2].state == MapData.CellState.Walkable); } else { isValid2 = false; } int x4 = val3.get_x(); int y4 = val3.get_y(); bool isValid3; if (val3 != from && data.IsInsideLocal(x4, y4)) { int cellIndexLocal3 = data.GetCellIndexLocal(x4, y4); isValid3 = (data.cells[cellIndexLocal3].state == MapData.CellState.Walkable); } else { isValid3 = false; } int x5 = val4.get_x(); int y5 = val4.get_y(); bool isValid4; if (val4 != from && data.IsInsideLocal(x5, y5)) { int cellIndexLocal4 = data.GetCellIndexLocal(x5, y5); isValid4 = (data.cells[cellIndexLocal4].state == MapData.CellState.Walkable); } 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); }
private bool ComputeFullPath(MapData data, Vector2Int start, Vector2Int end, List <Vector3> path) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) NodePriorityQueue frontier = m_frontier; Dictionary <int, Node> steps = m_steps; AdjacentCoord[] adjacentCoordsBuffer = m_adjacentCoordsBuffer; frontier.Clear(); steps.Clear(); Node item = new Node(start, start, 0, 0); frontier.Enqueue(item); while (frontier.Count() != 0) { Node node = frontier.Dequeue(); Vector2Int coords = node.coords; Vector2Int fromCoords = node.fromCoords; int cost = node.cost; if (coords == end) { ReconstructPath(data, start, end, node, path); return(true); } ComputeAdjacentCoords(data, coords, fromCoords); for (int i = 0; i < 4; i++) { AdjacentCoord adjacentCoord = adjacentCoordsBuffer[i]; if (adjacentCoord.isValid) { Vector2Int coords2 = adjacentCoord.coords; int num = cost + 1; int num2 = coords2.DistanceTo(end); int cellIndexLocal = data.GetCellIndexLocal(coords2.get_x(), coords2.get_y()); if (!steps.TryGetValue(cellIndexLocal, out Node value) || value.cost >= num) { value = new Node(coords2, coords, num, num + num2); frontier.Enqueue(value); steps[cellIndexLocal] = value; } } } } return(false); }
private void ComputeFullPath(IMapStateProvider mapStateProvider, FightMapMovementContext.Cell[] grid, Vector2Int start, Vector2Int end, int movementPoints, bool isTargeting) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) List <Vector2Int> currentPath = this.currentPath; AdjacentCoord[] adjacentCoordsBuffer = m_adjacentCoordsBuffer; NodePriorityQueue frontier = m_frontier; Dictionary <int, Node> steps = m_steps; int count = currentPath.Count; Vector2Int val = mapStateProvider.sizeMax; int x = val.get_x(); val = mapStateProvider.sizeMin; int num = x - val.get_x(); frontier.Clear(); steps.Clear(); if (start.DistanceTo(end) <= movementPoints) { Direction directionTo = start.GetDirectionTo(end); Node item = new Node(start, start, 0, 0, directionTo); frontier.Enqueue(item); do { Node node = frontier.Dequeue(); Vector2Int coords = node.coords; Vector2Int fromCoords = node.fromCoords; int cost = node.cost; Direction direction = node.direction; if (coords == end) { if (isTargeting && m_canPassThrough && !CanStopAt(mapStateProvider, grid, fromCoords)) { int key = coords.get_y() * num + coords.get_x(); steps[key] = new Node(coords, fromCoords, int.MaxValue, node.priority, direction); continue; } int num2 = cost + 1; if (currentPath.Capacity < num2) { currentPath.Capacity = num2; } if (count > num2) { currentPath.RemoveRange(num2, count - num2); } else if (count < num2) { for (int i = count; i < num2; i++) { currentPath.Add(end); } } currentPath[cost] = end; for (int num3 = cost - 1; num3 > 0; num3--) { Vector2Int fromCoords2 = node.fromCoords; int key2 = fromCoords2.get_y() * num + fromCoords2.get_x(); node = steps[key2]; currentPath[num3] = node.coords; } currentPath[0] = start; return; } ComputeAdjacentCoords(mapStateProvider, grid, coords, fromCoords); for (int j = 0; j < 4; j++) { AdjacentCoord adjacentCoord = adjacentCoordsBuffer[j]; if (!adjacentCoord.isValid) { continue; } Vector2Int coords2 = adjacentCoord.coords; int num4 = cost + 1; int num5 = coords2.DistanceTo(end); if (num4 + num5 <= movementPoints) { int key3 = coords2.get_y() * num + coords2.get_x(); if (!steps.TryGetValue(key3, out Node value) || value.cost >= num4) { Direction directionTo2 = coords.GetDirectionTo(coords2); int num6 = (directionTo2 != direction) ? 1 : 0; int num7 = (num5 << 1) + num6; value = new Node(coords2, coords, num4, num4 + num7, directionTo2); frontier.Enqueue(value); steps[key3] = value; } } } }while (frontier.Count() > 0); } if (count == 0) { currentPath.Add(start); return; } currentPath[0] = start; currentPath.RemoveRange(1, count - 1); }
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); }
private bool AppendPartialPath(IMapStateProvider mapStateProvider, FightMapMovementContext.Cell[] grid, Vector2Int end, int movementPoints, bool isTargeting) { //IL_002d: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: 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_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) List <Vector2Int> currentPath = this.currentPath; List <Node> previousStepsBuffer = m_previousStepsBuffer; NodePriorityQueue frontier = m_frontier; Dictionary <int, Node> steps = m_steps; AdjacentCoord[] adjacentCoordsBuffer = m_adjacentCoordsBuffer; int num = currentPath.Count; Vector2Int val = mapStateProvider.sizeMax; int x = val.get_x(); val = mapStateProvider.sizeMin; int num2 = x - val.get_x(); if (previousStepsBuffer.Capacity < num) { previousStepsBuffer.Capacity = num; } previousStepsBuffer.Clear(); Vector2Int val2 = currentPath[0]; previousStepsBuffer.Add(new Node(val2, val2, 0, 0, val2.GetDirectionTo(end))); for (int i = 1; i < num; i++) { Vector2Int val3 = currentPath[i]; previousStepsBuffer.Add(new Node(val3, val2, i, 0, val2.GetDirectionTo(val3))); val2 = val3; } for (int num3 = num - 1; num3 > 0; num3--) { Node node = previousStepsBuffer[num3]; int num4 = node.coords.DistanceTo(end); if (num3 + num4 <= movementPoints) { frontier.Clear(); frontier.Enqueue(node); steps.Clear(); for (int j = 0; j < num3; j++) { Node node2 = previousStepsBuffer[j]; Vector2Int coords = node2.coords; int key = coords.get_y() * num2 + coords.get_x(); steps.Add(key, node2); } do { Node node3 = frontier.Dequeue(); Vector2Int coords2 = node3.coords; Vector2Int fromCoords = node3.fromCoords; int cost = node3.cost; Direction direction = node3.direction; if (node3.coords == end) { if (isTargeting && m_canPassThrough && !CanStopAt(mapStateProvider, grid, fromCoords)) { int key2 = coords2.get_y() * num2 + coords2.get_x(); steps[key2] = new Node(coords2, fromCoords, int.MaxValue, node3.priority, direction); continue; } int num5 = cost + 1; if (currentPath.Capacity < num5) { currentPath.Capacity = num5; } if (num > num5) { currentPath.RemoveRange(num5, num - num5); } else if (num < num5) { for (int k = num; k < num5; k++) { currentPath.Add(end); } } currentPath[cost] = end; for (int num6 = cost - 1; num6 >= num; num6--) { Vector2Int fromCoords2 = node3.fromCoords; int key3 = fromCoords2.get_y() * num2 + fromCoords2.get_x(); node3 = steps[key3]; currentPath[num6] = node3.coords; } return(true); } ComputeAdjacentCoords(mapStateProvider, grid, coords2, fromCoords); for (int l = 0; l < 4; l++) { AdjacentCoord adjacentCoord = adjacentCoordsBuffer[l]; if (!adjacentCoord.isValid) { continue; } Vector2Int coords3 = adjacentCoord.coords; int num7 = cost + 1; int num8 = coords3.DistanceTo(end); if (num7 + num8 <= movementPoints) { int key4 = coords3.get_y() * num2 + coords3.get_x(); if (!steps.TryGetValue(key4, out Node value) || value.cost >= num7) { Direction directionTo = coords2.GetDirectionTo(coords3); int num9 = (directionTo != direction) ? 1 : 0; int num10 = (num8 << 1) + num9; value = new Node(coords3, coords2, num7, num7 + num10, directionTo); frontier.Enqueue(value); steps[key4] = value; } } } }while (frontier.Count() > 0); } currentPath.RemoveAt(num3); num--; } return(false); }