Exemple #1
0
    public void DrawLine(List <Transform> trans)
    {
        List <Vector2> pos = new List <Vector2>();

        for (int i = 0; i < trans.Count; i++)
        {
            pos.Add(trans[i].position);
        }
        for (int i = 0; i < pos.Count; i++)
        {
            Vector2 t = pos[i];

            int j = i;
            while ((j > 0) && (pos[j - 1].x > t.x))
            {
                pos[j] = pos[j - 1];
                --j;
            }

            pos[j] = t;
        }
        if (currentLight.LineIndex == -1)
        {
            currentLight.LineIndex = lineManger.AddLine(pos);
        }
        else
        {
            lineManger.Draw(currentLight.LineIndex, pos);
        }
    }