示例#1
0
    void Draw()
    {
        graphics.Clear();

        Vector3 old        = Vector3.zero;
        Vector3 currentMid = Vector3.zero;
        Vector3 oldMid     = Vector3.zero;

        for (int i = 0; i < points.Length; i++)
        {
            Vector3 pt = points[i];
            if (i == 0)
            {
                currentMid = pt;
                old        = currentMid;
                oldMid     = pt;
                graphics.MoveTo(currentMid, color, thickness);
            }
            else
            {
                currentMid = getMidInputCoords(old, pt);
            }

            graphics.QuadraticCurveTo(oldMid, old, currentMid, color, thickness);
            old    = pt;
            oldMid = currentMid;
        }
        graphics.LineTo(points[points.Length - 1], color, thickness);
        //
        Color _color = Color.green;

        for (int i = 0; i < points.Length; i++)
        {
            Vector3 pt = points[i];
            if (i == 0)
            {
                graphics.MoveTo(pt, _color, thickness * 0.25f);
            }
            else
            {
                graphics.LineTo(pt, _color, thickness * 0.25f);
            }
        }
        graphics.Render();
    }