Exemple #1
0
    public void Apply()
    {
        float slittedHeight = slitSize * numSlits + gapSize * (numSlits - 1);

        if (length < slittedHeight)
        {
            length = slittedHeight;
        }

        List <Vector2[]> positions = new List <Vector2[]>();

        positions.Add(new Vector2[2] {
            new Vector2(length / 2, 0), new Vector2(slittedHeight / 2, 0)
        });
        for (int i = 1; i < numSlits; i++)
        {
            float currentDisplacement = 1.0f * i * (gapSize + slitSize);
            positions.Add(new Vector2[2] {
                new Vector2(slittedHeight / 2 - currentDisplacement + gapSize, 0),
                new Vector2(slittedHeight / 2 - currentDisplacement, 0)
            });
        }
        positions.Add(new Vector2[2] {
            new Vector2(-length / 2, 0), new Vector2(-slittedHeight / 2, 0)
        });

        foreach (LineRenderer lr in lines)
        {
            LineSegmenter.DrawTo(lr, positions);
            lr.widthMultiplier = thickness;
        }
    }
Exemple #2
0
 // Update is called once per frame
 void Update()
 {
     if (apply)
     {
         apply = false;
         LineSegmenter.DrawTo(lr, segments.ConvertAll((segment) => segment.points));
     }
 }