using UnityEngine; using DG.Tweening; public class VisualLineSegment : MonoBehaviour { public Vector3 StartPoint { get; private set; } public Vector3 EndPoint { get; private set; } protected LineRenderer lineRenderer; protected virtual void Awake() { lineRenderer = GetComponent(); } public void Initialize(Vector3 startPoint, Vector3 endPoint) { StartPoint = startPoint; EndPoint = endPoint; lineRenderer.positionCount = 2; lineRenderer.SetPosition(0, StartPoint); lineRenderer.SetPosition(1, EndPoint); } // public void ShrinkAndDisappear() // { // // Shrink the line segment from the end to the start // DOTween.To(() => EndPoint, x => EndPoint = x, StartPoint, 1f) // .OnUpdate(() => { // lineRenderer.SetPosition(0, StartPoint); // lineRenderer.SetPosition(1, EndPoint); // }) // .OnComplete(() => Destroy(gameObject)); // } }