28 lines
600 B
C#
28 lines
600 B
C#
using UnityEngine;
|
|
namespace DongWuYiXue.DaoNiaoShu
|
|
{
|
|
[ExecuteAlways]
|
|
public class LineSegment : MonoBehaviour
|
|
{
|
|
public Transform start;
|
|
public Transform end;
|
|
LineRenderer line;
|
|
|
|
void Start()
|
|
{
|
|
line = GetComponent<LineRenderer>();
|
|
}
|
|
void LateUpdate()
|
|
{
|
|
UpdateLine();
|
|
}
|
|
public void UpdateLine()
|
|
{
|
|
if (line != null)
|
|
{
|
|
line.SetPosition(0, start.position);
|
|
line.SetPosition(1, end.position);
|
|
}
|
|
}
|
|
}
|
|
} |