48 lines
1.6 KiB
C#
48 lines
1.6 KiB
C#
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD>
|
|||
|
|
public interface IPointManagerView
|
|||
|
|
{
|
|||
|
|
void CreatePoint(RobotData pose);
|
|||
|
|
void UpdatePointPosition(int index, RobotData pose);
|
|||
|
|
void DeletePoint(int index);
|
|||
|
|
void RedrawPoints(List<RobotData> poses); // (RobotProgram.Steps<70><73><EFBFBD><EFBFBD> <20><>ȯ)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public class PointManagerView : MonoBehaviour, IPointManagerView
|
|||
|
|
{
|
|||
|
|
[SerializeField] private GameObject pointPrefab; // <20>ν<EFBFBD><CEBD><EFBFBD><EFBFBD>Ϳ<EFBFBD><CDBF><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
private List<GameObject> activePoints = new List<GameObject>();
|
|||
|
|
|
|||
|
|
public void CreatePoint(RobotData pose)
|
|||
|
|
{
|
|||
|
|
Vector3 position = new Vector3(pose.x, pose.y, pose.z);
|
|||
|
|
GameObject pointObj = Instantiate(pointPrefab, position, Quaternion.identity, this.transform);
|
|||
|
|
activePoints.Add(pointObj);
|
|||
|
|
// (<28><><EFBFBD><EFBFBD>: <20><> pointObj<62><6A> 'InteractionView'<27><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD> <20>ݶ<EFBFBD><DDB6>̴<EFBFBD><CCB4><EFBFBD> <20><>ũ<EFBFBD><C5A9>Ʈ<EFBFBD><C6AE> <20>־<EFBFBD><D6BE><EFBFBD> <20><>)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void UpdatePointPosition(int index, RobotData pose)
|
|||
|
|
{
|
|||
|
|
if (index < 0 || index >= activePoints.Count) return;
|
|||
|
|
activePoints[index].transform.position = new Vector3(pose.x, pose.y, pose.z);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void DeletePoint(int index)
|
|||
|
|
{
|
|||
|
|
if (index < 0 || index >= activePoints.Count) return;
|
|||
|
|
Destroy(activePoints[index]);
|
|||
|
|
activePoints.RemoveAt(index);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void RedrawPoints(List<RobotData> poses)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
foreach (var point in activePoints) Destroy(point);
|
|||
|
|
activePoints.Clear();
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
foreach (var pose in poses) CreatePoint(pose);
|
|||
|
|
}
|
|||
|
|
}
|