// Token: 0x06001D83 RID: 7555 RVA: 0x000899C4 File Offset: 0x00087BC4 private void BuildAirLinks(ReadOnlyCollection <MapNode> nodes, MapNode.MoveProbe moveProbe) { Vector3 position = base.transform.position; for (int i = 0; i < nodes.Count; i++) { MapNode mapNode = nodes[i]; if (!(mapNode == this)) { Vector3 position2 = mapNode.transform.position; float num = MapNode.maxConnectionDistance * 2f; float num2 = num * num; float sqrMagnitude = (position2 - position).sqrMagnitude; if (sqrMagnitude < num2) { float distanceScore = Mathf.Sqrt(sqrMagnitude); for (int j = 0; j < 3; j++) { if ((this.forbiddenHulls & (HullMask)(1 << j)) == HullMask.None && (mapNode.forbiddenHulls & (HullMask)(1 << j)) == HullMask.None) { moveProbe.SetHull((HullClassification)j); Vector3 vector = position; Vector3 vector2 = position2; if (moveProbe.CapsuleOverlapTest(vector) && moveProbe.CapsuleOverlapTest(vector2) && moveProbe.FlyTest(vector, vector2, 6f)) { this.AddLink(mapNode, distanceScore, 0f, (HullClassification)j); } } } } } } }
// Token: 0x06001D85 RID: 7557 RVA: 0x00089C04 File Offset: 0x00087E04 public void BuildLinks(ReadOnlyCollection <MapNode> nodes, MapNodeGroup.GraphType graphType) { this.links.Clear(); Vector3 position = base.transform.position; MapNode.MoveProbe moveProbe = new MapNode.MoveProbe(); moveProbe.Init(); switch (graphType) { case MapNodeGroup.GraphType.Ground: this.BuildGroundLinks(nodes, moveProbe); break; case MapNodeGroup.GraphType.Air: this.BuildAirLinks(nodes, moveProbe); break; case MapNodeGroup.GraphType.Rail: this.BuildRailLinks(nodes, moveProbe); break; } foreach (MapNodeLink mapNodeLink in base.GetComponents <MapNodeLink>()) { if (mapNodeLink.other) { MapNode.Link link = new MapNode.Link { nodeB = mapNodeLink.other, distanceScore = Vector3.Distance(position, mapNodeLink.other.transform.position), minJumpHeight = mapNodeLink.minJumpHeight, gateName = mapNodeLink.gateName, hullMask = -1 }; bool flag = false; for (int j = 0; j < this.links.Count; j++) { if (this.links[j].nodeB == mapNodeLink.other) { this.links[j] = link; flag = true; break; } } if (!flag) { this.links.Add(link); } } } moveProbe.Destroy(); }
// Token: 0x06001D82 RID: 7554 RVA: 0x00089844 File Offset: 0x00087A44 private void BuildGroundLinks(ReadOnlyCollection <MapNode> nodes, MapNode.MoveProbe moveProbe) { Vector3 position = base.transform.position; for (int i = 0; i < nodes.Count; i++) { MapNode mapNode = nodes[i]; if (!(mapNode == this)) { Vector3 position2 = mapNode.transform.position; float num = MapNode.maxConnectionDistance; float num2 = num * num; float sqrMagnitude = (position2 - position).sqrMagnitude; if (sqrMagnitude < num2) { float distanceScore = Mathf.Sqrt(sqrMagnitude); for (int j = 0; j < 3; j++) { moveProbe.SetHull((HullClassification)j); if ((this.forbiddenHulls & (HullMask)(1 << j)) == HullMask.None && (mapNode.forbiddenHulls & (HullMask)(1 << j)) == HullMask.None) { Vector3 b = Vector3.up * (moveProbe.testCharacterController.height * 0.5f); Vector3 b2 = Vector3.up * 0.01f; Vector3 a = moveProbe.GetGroundPosition(position) + b2; Vector3 a2 = moveProbe.GetGroundPosition(position2) + b2; Vector3 vector = a + b; Vector3 vector2 = a2 + b; if (moveProbe.CapsuleOverlapTest(vector) && moveProbe.CapsuleOverlapTest(vector2)) { bool flag = moveProbe.GroundTest(vector, vector2, 6f); float num3 = (!flag) ? moveProbe.JumpTest(vector, vector2, 7.5f) : 0f; if (flag || (num3 > 0f && num3 < 10f)) { this.AddLink(mapNode, distanceScore, num3, (HullClassification)j); } } } } } } } }