public void OnSceneGUI() { Grid grid = BrushUtility.GetRootGrid(false); if (grid == null) { return; } if (brush.activeObject != null) { BrushEditorUtility.DrawMarquee(grid, grid.WorldToCell(brush.activeObject.transform.position), new Color(0.5f, 0.5f, 1f)); } Teleport[] allTeleports = brush.allObjects; BrushEditorUtility.BeginLines(Color.blue); foreach (var teleport in allTeleports) { if (teleport != null && teleport.m_Target != null) { Vector3Int from = grid.WorldToCell(teleport.transform.position); Vector3Int to = grid.WorldToCell(teleport.m_Target.transform.position); BrushEditorUtility.DrawLineBatched(grid, from, to); } } BrushEditorUtility.EndLines(); }
public void OnSceneGUI() { Grid grid = BrushUtility.GetRootGrid(false); if (grid != null) { if (brush.activeObject != null) { Vector3Int worldTurret = grid.WorldToCell(brush.activeObject.transform.position); for (int i = 0; i < brush.activeObject.m_Targets.Count; i++) { Vector3Int localPos = brush.activeObject.m_Targets[i]; Vector3Int worldPos = worldTurret + localPos; int tick = brush.activeObject.m_Ticks[i]; Handles.Label(grid.CellToWorld(worldPos + Vector3Int.up), " " + tick.ToString()); BrushEditorUtility.DrawLine(grid, worldPos, grid.WorldToCell(brush.activeObject.transform.position), new Color(1f, 0f, 1f, 0.6f)); BrushEditorUtility.DrawQuad(grid, worldPos, new Color(1f, 0f, 1f, 0.4f)); } BrushEditorUtility.DrawMarquee(grid, worldTurret, new Color(1f, 0f, 1f, 0.6f)); Vector3 world = grid.CellToWorld(worldTurret); Handles.Label(world, " " + brush.activeObject.m_TickDelay.ToString("F")); } } }