36 lines
841 B
C#
36 lines
841 B
C#
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
|
||
// ÀÎÅÍÆäÀ̽º
|
||
public interface IPathLineView
|
||
{
|
||
void DrawPath(List<RobotData> poses); // (RobotProgram.Steps¿¡¼ º¯È¯)
|
||
}
|
||
|
||
[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));
|
||
}
|
||
}
|
||
}
|