public virtual Color NodeColor(GraphNode node, PathHandler data) { Color result = AstarColor.NodeConnection; bool flag = false; if (node == null) { return(AstarColor.NodeConnection); } GraphDebugMode debugMode = AstarPath.active.debugMode; switch (debugMode) { case GraphDebugMode.Penalty: result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (node.Penalty - AstarPath.active.debugFloor) / (AstarPath.active.debugRoof - AstarPath.active.debugFloor)); flag = true; goto IL_A9; case GraphDebugMode.Connections: IL_33: if (debugMode != GraphDebugMode.Areas) { goto IL_A9; } result = AstarColor.GetAreaColor(node.Area); flag = true; goto IL_A9; case GraphDebugMode.Tags: result = AstarMath.IntToColor((int)node.Tag, 0.5f); flag = true; goto IL_A9; } goto IL_33; IL_A9: if (!flag) { if (data == null) { return(AstarColor.NodeConnection); } PathNode pathNode = data.GetPathNode(node); switch (AstarPath.active.debugMode) { case GraphDebugMode.G: result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (pathNode.G - AstarPath.active.debugFloor) / (AstarPath.active.debugRoof - AstarPath.active.debugFloor)); break; case GraphDebugMode.H: result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (pathNode.H - AstarPath.active.debugFloor) / (AstarPath.active.debugRoof - AstarPath.active.debugFloor)); break; case GraphDebugMode.F: result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (pathNode.F - AstarPath.active.debugFloor) / (AstarPath.active.debugRoof - AstarPath.active.debugFloor)); break; } } result.a *= 0.5f; return(result); }
private void RecalculateDebugLimits() { this.debugFloor = float.PositiveInfinity; this.debugRoof = float.NegativeInfinity; bool ignoreSearchTree = !this.showSearchTree || this.debugPathData == null; for (int i = 0; i < this.graphs.Length; i++) { if (this.graphs[i] != null && this.graphs[i].drawGizmos) { this.graphs[i].GetNodes(delegate(GraphNode node) { if (ignoreSearchTree || GraphGizmoHelper.InSearchTree(node, this.debugPathData, this.debugPathID)) { if (this.debugMode == GraphDebugMode.Penalty) { this.debugFloor = Mathf.Min(this.debugFloor, node.Penalty); this.debugRoof = Mathf.Max(this.debugRoof, node.Penalty); } else if (this.debugPathData != null) { PathNode pathNode = this.debugPathData.GetPathNode(node); GraphDebugMode graphDebugMode = this.debugMode; if (graphDebugMode != GraphDebugMode.F) { if (graphDebugMode != GraphDebugMode.G) { if (graphDebugMode == GraphDebugMode.H) { this.debugFloor = Mathf.Min(this.debugFloor, pathNode.H); this.debugRoof = Mathf.Max(this.debugRoof, pathNode.H); } } else { this.debugFloor = Mathf.Min(this.debugFloor, pathNode.G); this.debugRoof = Mathf.Max(this.debugRoof, pathNode.G); } } else { this.debugFloor = Mathf.Min(this.debugFloor, pathNode.F); this.debugRoof = Mathf.Max(this.debugRoof, pathNode.F); } } } }); } } if (float.IsInfinity(this.debugFloor)) { this.debugFloor = 0f; this.debugRoof = 1f; } if (this.debugRoof - this.debugFloor < 1f) { this.debugRoof += 1f; } }
public void Init(RetainedGizmos.Hasher hasher, RetainedGizmos gizmos) { debugData = PathFindHelper.debugPathData; debugPathID = PathFindHelper.debugPathID; debugMode = AstarPath.active.debugMode; debugFloor = AstarPath.active.debugFloor; debugRoof = AstarPath.active.debugRoof; showSearchTree = AstarPath.active.showSearchTree && debugData != null; this.gizmos = gizmos; this.hasher = hasher; builder = ObjectPool <RetainedGizmos.Builder> .Claim(); }
public virtual Color NodeColor(GraphNode node, PathHandler data) { GraphDebugMode debugMode = AstarPath.active.debugMode; Color result; switch (debugMode) { case GraphDebugMode.Penalty: result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (node.Penalty - AstarPath.active.debugFloor) / (AstarPath.active.debugRoof - AstarPath.active.debugFloor)); break; case GraphDebugMode.Connections: result = AstarColor.NodeConnection; break; case GraphDebugMode.Tags: result = AstarColor.GetAreaColor(node.Tag); break; default: if (debugMode != GraphDebugMode.Areas) { if (data == null) { return(AstarColor.NodeConnection); } PathNode pathNode = data.GetPathNode(node); float num; if (debugMode == GraphDebugMode.G) { num = pathNode.G; } else if (debugMode == GraphDebugMode.H) { num = pathNode.H; } else { num = pathNode.F; } result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (num - AstarPath.active.debugFloor) / (AstarPath.active.debugRoof - AstarPath.active.debugFloor)); } else { result = AstarColor.GetAreaColor(node.Area); } break; } result.a *= 0.5f; return(result); }
public void Init(AstarPath active, DrawingData.Hasher hasher, DrawingData gizmos, RedrawScope redrawScope) { if (active != null) { debugData = active.debugPathData; debugPathID = active.debugPathID; debugMode = active.debugMode; debugFloor = active.debugFloor; debugRoof = active.debugRoof; showSearchTree = active.showSearchTree && debugData != null; } this.hasher = hasher; builder = gizmos.GetBuilder(hasher, redrawScope); }
public virtual Color NodeColor(GraphNode node, PathHandler data) { Color result = AstarColor.NodeConnection; GraphDebugMode debugMode = AstarPath.active.debugMode; switch (debugMode) { case GraphDebugMode.Penalty: result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (node.Penalty - AstarPath.active.debugFloor) / (AstarPath.active.debugRoof - AstarPath.active.debugFloor)); goto IL_187; case GraphDebugMode.Connections: { IL_25: if (debugMode == GraphDebugMode.Areas) { result = AstarColor.GetAreaColor(node.Area); goto IL_187; } if (data == null) { return(AstarColor.NodeConnection); } PathNode pathNode = data.GetPathNode(node); switch (AstarPath.active.debugMode) { case GraphDebugMode.G: result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (pathNode.G - AstarPath.active.debugFloor) / (AstarPath.active.debugRoof - AstarPath.active.debugFloor)); break; case GraphDebugMode.H: result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (pathNode.H - AstarPath.active.debugFloor) / (AstarPath.active.debugRoof - AstarPath.active.debugFloor)); break; case GraphDebugMode.F: result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (pathNode.F - AstarPath.active.debugFloor) / (AstarPath.active.debugRoof - AstarPath.active.debugFloor)); break; } goto IL_187; } case GraphDebugMode.Tags: result = AstarColor.GetAreaColor(node.Tag); goto IL_187; } goto IL_25; IL_187: result.a *= 0.5f; return(result); }
public void Init(AstarPath active, RetainedGizmos.Hasher hasher, RetainedGizmos gizmos) { if (active != null) { debugData = active.debugPathData; debugPathID = active.debugPathID; debugMode = active.debugMode; debugFloor = active.debugFloor; debugRoof = active.debugRoof; showSearchTree = active.showSearchTree && debugData != null; } this.gizmos = gizmos; this.hasher = hasher; builder = ObjectPool <RetainedGizmos.Builder> .Claim(); }
// Token: 0x06000429 RID: 1065 RVA: 0x00021630 File Offset: 0x0001FA30 public virtual Color NodeColor(GraphNode node, PathHandler data) { Color result = AstarColor.NodeConnection; bool flag = false; if (node == null) { return(AstarColor.NodeConnection); } GraphDebugMode debugMode = AstarPath.active.debugMode; if (debugMode != GraphDebugMode.Areas) { if (debugMode != GraphDebugMode.Penalty) { if (debugMode == GraphDebugMode.Tags) { result = AstarMath.IntToColor((int)node.Tag, 0.5f); flag = true; } } else { result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, node.Penalty / AstarPath.active.debugRoof); flag = true; } } else { result = AstarColor.GetAreaColor(node.Area); flag = true; } if (!flag) { if (data == null) { return(AstarColor.NodeConnection); } PathNode pathNode = data.GetPathNode(node); GraphDebugMode debugMode2 = AstarPath.active.debugMode; if (debugMode2 != GraphDebugMode.G) { if (debugMode2 != GraphDebugMode.H) { if (debugMode2 == GraphDebugMode.F) { result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, pathNode.F / AstarPath.active.debugRoof); } } else { result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, pathNode.H / AstarPath.active.debugRoof); } } else { result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, pathNode.G / AstarPath.active.debugRoof); } } result.a *= 0.5f; return(result); }
public Color NodeColor(GraphNode node) { if (this.showSearchTree && !GraphGizmoHelper.InSearchTree(node, this.debugData, this.debugPathID)) { return(Color.clear); } Color result; if (node.Walkable) { GraphDebugMode graphDebugMode = this.debugMode; switch (graphDebugMode) { case GraphDebugMode.Penalty: result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (node.Penalty - this.debugFloor) / (this.debugRoof - this.debugFloor)); break; case GraphDebugMode.Connections: result = AstarColor.NodeConnection; break; case GraphDebugMode.Tags: result = AstarColor.GetAreaColor(node.Tag); break; default: if (graphDebugMode != GraphDebugMode.Areas) { if (this.debugData == null) { result = AstarColor.NodeConnection; } else { PathNode pathNode = this.debugData.GetPathNode(node); float num; if (this.debugMode == GraphDebugMode.G) { num = pathNode.G; } else if (this.debugMode == GraphDebugMode.H) { num = pathNode.H; } else { num = pathNode.F; } result = Color.Lerp(AstarColor.ConnectionLowLerp, AstarColor.ConnectionHighLerp, (num - this.debugFloor) / (this.debugRoof - this.debugFloor)); } } else { result = AstarColor.GetAreaColor(node.Area); } break; } } else { result = AstarColor.UnwalkableNode; } return(result); }