예제 #1
0
    void DrawCurve()
    {
        for (int j = 0; j < curveCount; j++)
        {
            for (int i = 1; i <= SEGMENT_COUNT; i++)
            {
                float t = i / (float)SEGMENT_COUNT;

                if (linepapa <= 0.9)
                {
                    linepapa = MathS.easeInQuad(Time.time - startTime, 0, 1, duration);

                    if (t > linepapa)
                    {
                        t = linepapa;
                    }
                    fadeOut = 1;
                }
                else
                {
                    fadeOut -= Time.deltaTime * 0.03f;
                    if (fadeOut > 0)
                    {
                        rend.material.SetColor("_Color", new Color(1, 1, 1, fadeOut));
                    }
                    else
                    {
                        drawIt = false;
                    }
                }
                int     nodeIndex = j * 3;
                Vector3 pixel     = CalculateCubicBezierPoint(t, controlPoints[nodeIndex].position, controlPoints[nodeIndex + 1].position, controlPoints[nodeIndex + 2].position, controlPoints[nodeIndex + 3].position);
                lineRenderer.SetVertexCount(((j * SEGMENT_COUNT) + i));
                lineRenderer.SetPosition((j * SEGMENT_COUNT) + (i - 1), pixel);
            }
        }
    }