Пример #1
0
    public void OnDrawGizmos()
    {
        if (pathData == null)
        {
            return;
        }

        Color color = Gizmos.color;

        foreach (PathData path in pathData)
        {
            if (path == null)
            {
                continue;
            }

            if (DrawMatch)
            {
                Gizmos.color = new Color(1, 1, 1, 0.05f);
                Gizmos.DrawLine(path.drone.transform.position, path.target);
            }


            if (DrawDiscrete)
            {
                for (int i = 1; i < path.nodes.Count; i++)
                {
                    Gizmos.color = new Color(1, 1, 1, 0.25f);
                    Vector3 start = path.nodes[i - 1].position;
                    Vector3 end   = path.nodes[i].position;
                    Gizmos.DrawLine(start, end);

                    Gizmos.color = Color.white;
                    Gizmos.DrawSphere(end, 0.0075f);
                    Handles.Label(end + (0.02f * Vector3.right), path.nodes[i].time.ToString("n2"), CustomGUI.LabelStyle);
                }
            }

            if (DrawContinuous)
            {
                for (int i = 0; i < path.curves.Count; i++)
                {
                    CubicBezier bezier = path.curves[i];
                    Handles.DrawBezier(bezier.anchor1,
                                       bezier.anchor2,
                                       bezier.control1,
                                       bezier.control2,
                                       Color.white,
                                       null,
                                       2.0f);
                }
            }
        }
        Gizmos.color = color;

        if (grid != null && DrawGrid)
        {
            grid.Draw();
        }
    }