36 lines
841 B
C#
36 lines
841 B
C#
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD>
|
|||
|
|
public interface IPathLineView
|
|||
|
|
{
|
|||
|
|
void DrawPath(List<RobotData> poses); // (RobotProgram.Steps<70><73><EFBFBD><EFBFBD> <20><>ȯ)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[RequireComponent(typeof(LineRenderer))]
|
|||
|
|
public class PathLineView : MonoBehaviour, IPathLineView
|
|||
|
|
{
|
|||
|
|
private LineRenderer lineRenderer;
|
|||
|
|
|
|||
|
|
void Awake()
|
|||
|
|
{
|
|||
|
|
lineRenderer = GetComponent<LineRenderer>();
|
|||
|
|
lineRenderer.positionCount = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void DrawPath(List<RobotData> poses)
|
|||
|
|
{
|
|||
|
|
if (poses == null || poses.Count < 2)
|
|||
|
|
{
|
|||
|
|
lineRenderer.positionCount = 0;
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
lineRenderer.positionCount = poses.Count;
|
|||
|
|
for (int i = 0; i < poses.Count; i++)
|
|||
|
|
{
|
|||
|
|
lineRenderer.SetPosition(i, new Vector3(poses[i].x, poses[i].y, poses[i].z));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|