Ejemplo n.º 1
0
 public override void FixedUpdate()
 {
     constraint.ForEachGameObject((egoComponent, transform, lineRenderer, lineRendererComponent) => {
         lineRendererComponent.timeElapsed += Time.deltaTime;
         if (lineRendererComponent.lineRendererTimeThreshold <= lineRendererComponent.timeElapsed)
         {
             var e = new LineRendererDrawEvent();
             EgoEvents <LineRendererDrawEvent> .AddEvent(e);
             lineRendererComponent.timeElapsed -= lineRendererComponent.lineRendererTimeThreshold;
         }
     });
 }
Ejemplo n.º 2
0
    void Handle(LineRendererDrawEvent e)
    {
        constraint.ForEachGameObject((egoComponent, transform, lineRenderer, lineRendererComponent) => {
            //If lineRenderer reached lineLength, shift positions to delete first point in line
            if (lineRendererComponent.lineRendererPointCount >= lineRendererComponent.lineLength)
            {
                for (int i = 0; i < lineRendererComponent.lineLength - 1; i++)
                {
                    lineRenderer.SetPosition(i, lineRenderer.GetPosition(i + 1));
                }
            }
            else
            {
                lineRendererComponent.lineRendererPointCount++;
                lineRenderer.numPositions++;
            }

            //Add new point to LineRenderer
            lineRenderer.SetPosition(lineRendererComponent.lineRendererPointCount - 1, transform.position - (transform.up * 0.32f));
        });
    }