// Token: 0x06001DF4 RID: 7668 RVA: 0x00080FE0 File Offset: 0x0007F1E0 private void ReconstructPath(Path path, NodeGraph.LinkIndex[] cameFrom, NodeGraph.LinkIndex current, NodeGraph.PathRequest pathRequest) { int num = 1 << (int)pathRequest.hullClassification; path.Clear(); if (current != NodeGraph.LinkIndex.invalid) { path.PushWaypointToFront(this.links[current.linkIndex].nodeIndexB, 0f); } while (current != NodeGraph.LinkIndex.invalid) { NodeGraph.NodeIndex nodeIndexB = this.links[current.linkIndex].nodeIndexB; float minJumpHeight = 0f; if ((num & this.links[current.linkIndex].jumpHullMask) != 0 && this.links[current.linkIndex].minJumpHeight > 0f) { Vector3 position = this.nodes[this.links[current.linkIndex].nodeIndexA.nodeIndex].position; Vector3 position2 = this.nodes[this.links[current.linkIndex].nodeIndexB.nodeIndex].position; minJumpHeight = Trajectory.CalculateApex(Trajectory.CalculateInitialYSpeed(Trajectory.CalculateGroundTravelTime(pathRequest.maxSpeed, NodeGraph.DistanceXZ(position, position2)), position2.y - position.y)); } path.PushWaypointToFront(nodeIndexB, minJumpHeight); if (cameFrom[this.links[current.linkIndex].nodeIndexA.nodeIndex] == NodeGraph.LinkIndex.invalid) { path.PushWaypointToFront(this.links[current.linkIndex].nodeIndexA, 0f); } current = cameFrom[this.links[current.linkIndex].nodeIndexA.nodeIndex]; } path.status = PathStatus.Valid; }
// Token: 0x06001DF2 RID: 7666 RVA: 0x00080B04 File Offset: 0x0007ED04 public PathTask ComputePath(NodeGraph.PathRequest pathRequest) { PathTask pathTask = new PathTask(pathRequest.path); pathTask.status = PathTask.TaskStatus.Running; NodeGraph.NodeIndex nodeIndex = this.FindClosestNode(pathRequest.startPos, pathRequest.hullClassification); NodeGraph.NodeIndex nodeIndex2 = this.FindClosestNode(pathRequest.endPos, pathRequest.hullClassification); if (nodeIndex.nodeIndex == NodeGraph.NodeIndex.invalid.nodeIndex || nodeIndex2.nodeIndex == NodeGraph.NodeIndex.invalid.nodeIndex) { pathRequest.path.Clear(); pathTask.status = PathTask.TaskStatus.Complete; return(pathTask); } int num = 1 << (int)pathRequest.hullClassification; bool[] array = new bool[this.nodes.Length]; bool[] array2 = new bool[this.nodes.Length]; array2[nodeIndex.nodeIndex] = true; int i = 1; NodeGraph.NodeIndex[] array3 = new NodeGraph.NodeIndex[this.nodes.Length]; array3[0] = nodeIndex; NodeGraph.LinkIndex[] array4 = new NodeGraph.LinkIndex[this.nodes.Length]; for (int j = 0; j < array4.Length; j++) { array4[j] = NodeGraph.LinkIndex.invalid; } float[] array5 = new float[this.nodes.Length]; for (int k = 0; k < array5.Length; k++) { array5[k] = float.PositiveInfinity; } array5[nodeIndex.nodeIndex] = 0f; float[] array6 = new float[this.nodes.Length]; for (int l = 0; l < array6.Length; l++) { array6[l] = float.PositiveInfinity; } array6[nodeIndex.nodeIndex] = this.HeuristicCostEstimate(pathRequest.startPos, pathRequest.endPos); while (i > 0) { NodeGraph.NodeIndex invalid = NodeGraph.NodeIndex.invalid; float num2 = float.PositiveInfinity; for (int m = 0; m < i; m++) { int nodeIndex3 = array3[m].nodeIndex; if (array6[nodeIndex3] <= num2) { num2 = array6[nodeIndex3]; invalid = new NodeGraph.NodeIndex(nodeIndex3); } } if (invalid.nodeIndex == nodeIndex2.nodeIndex) { this.ReconstructPath(pathRequest.path, array4, array4[invalid.nodeIndex], pathRequest); pathTask.status = PathTask.TaskStatus.Complete; return(pathTask); } array2[invalid.nodeIndex] = false; NodeGraph.ArrayRemoveNodeIndex(array3, invalid, i); i--; array[invalid.nodeIndex] = true; NodeGraph.LinkListIndex linkListIndex = this.nodes[invalid.nodeIndex].linkListIndex; NodeGraph.LinkIndex linkIndex = new NodeGraph.LinkIndex { linkIndex = linkListIndex.index }; NodeGraph.LinkIndex linkIndex2 = new NodeGraph.LinkIndex { linkIndex = linkListIndex.index + (int)linkListIndex.size }; while (linkIndex.linkIndex < linkIndex2.linkIndex) { NodeGraph.Link link = this.links[linkIndex.linkIndex]; NodeGraph.NodeIndex nodeIndexB = link.nodeIndexB; if (!array[nodeIndexB.nodeIndex]) { if ((num & link.jumpHullMask) != 0 && this.links[linkIndex.linkIndex].minJumpHeight > 0f) { Vector3 position = this.nodes[link.nodeIndexA.nodeIndex].position; Vector3 position2 = this.nodes[link.nodeIndexB.nodeIndex].position; if (Trajectory.CalculateApex(Trajectory.CalculateInitialYSpeed(Trajectory.CalculateGroundTravelTime(pathRequest.maxSpeed, NodeGraph.DistanceXZ(position, position2)), position2.y - position.y)) > pathRequest.maxJumpHeight) { goto IL_41A; } } if ((link.hullMask & num) != 0 && (link.gateIndex == 0 || this.openGates[(int)link.gateIndex])) { float num3 = array5[invalid.nodeIndex] + link.distanceScore; if (!array2[nodeIndexB.nodeIndex]) { array2[nodeIndexB.nodeIndex] = true; array3[i] = nodeIndexB; i++; } else if (num3 >= array5[nodeIndexB.nodeIndex]) { goto IL_41A; } array4[nodeIndexB.nodeIndex] = linkIndex; array5[nodeIndexB.nodeIndex] = num3; array6[nodeIndexB.nodeIndex] = array5[nodeIndexB.nodeIndex] + this.HeuristicCostEstimate(this.nodes[nodeIndexB.nodeIndex].position, this.nodes[nodeIndex2.nodeIndex].position); } } IL_41A: linkIndex.linkIndex++; } } pathRequest.path.Clear(); pathTask.status = PathTask.TaskStatus.Complete; return(pathTask); }