private void DrawPath(PathFinder.Path path, Vector3 navigator_pos, Color color) { if (path.nodes != null && path.nodes.Count > 1) { GL.PushMatrix(); material.SetPass(0); GL.Begin(1); GL.Color(color); GL.Vertex(navigator_pos); PathFinder.Path.Node node = path.nodes[1]; int cell = node.cell; PathFinder.Path.Node node2 = path.nodes[1]; GL.Vertex(NavTypeHelper.GetNavPos(cell, node2.navType)); for (int i = 1; i < path.nodes.Count - 1; i++) { PathFinder.Path.Node node3 = path.nodes[i]; int cell2 = node3.cell; PathFinder.Path.Node node4 = path.nodes[i]; Vector3 navPos = NavTypeHelper.GetNavPos(cell2, node4.navType); PathFinder.Path.Node node5 = path.nodes[i + 1]; int cell3 = node5.cell; PathFinder.Path.Node node6 = path.nodes[i + 1]; Vector3 navPos2 = NavTypeHelper.GetNavPos(cell3, node6.navType); GL.Vertex(navPos); GL.Vertex(navPos2); } GL.End(); GL.PopMatrix(); } }
private void DebugDrawValidCells() { Color color = Color.white; int cellCount = Grid.CellCount; for (int i = 0; i < cellCount; i++) { for (int j = 0; j < 10; j++) { NavType nav_type = (NavType)j; if (NavTable.IsValid(i, nav_type) && DrawNavTypeCell(nav_type, ref color)) { DebugExtension.DebugPoint(NavTypeHelper.GetNavPos(i, nav_type), color, 1f, 0f, false); } } } }
public void SetCurrentNavType(NavType nav_type) { CurrentNavType = nav_type; AnchorCell = NavTypeHelper.GetAnchorCell(nav_type, Grid.PosToCell(this)); NavGrid.NavTypeData navTypeData = NavGrid.GetNavTypeData(CurrentNavType); KBatchedAnimController component = GetComponent <KBatchedAnimController>(); Vector2 one = Vector2.one; if (navTypeData.flipX) { one.x = -1f; } if (navTypeData.flipY) { one.y = -1f; } component.navMatrix = Matrix2x3.Translate(navTypeData.animControllerOffset * 200f) * Matrix2x3.Rotate(navTypeData.rotation) * Matrix2x3.Scale(one); }
private void DebugDrawLinks() { Color color = Color.white; for (int i = 0; i < Grid.CellCount; i++) { int num = i * maxLinksPerCell; for (int link = Links[num].link; link != InvalidCell; link = Links[num].link) { Vector3 navPos = NavTypeHelper.GetNavPos(i, Links[num].startNavType); if (DrawNavTypeLink(Links[num].startNavType, ref color) || DrawNavTypeLink(Links[num].endNavType, ref color)) { Vector3 navPos2 = NavTypeHelper.GetNavPos(link, Links[num].endNavType); } num++; } } }