using System.Collections.Generic; using UnityEngine; // ÀÎÅÍÆäÀ̽º public interface IPointManagerView { void CreatePoint(RobotData pose); void UpdatePointPosition(int index, RobotData pose); void DeletePoint(int index); void RedrawPoints(List poses); // (RobotProgram.Steps¿¡¼­ º¯È¯) } public class PointManagerView : MonoBehaviour, IPointManagerView { [SerializeField] private GameObject pointPrefab; // ÀνºÆåÅÍ¿¡¼­ Æ÷ÀÎÆ® ÇÁ¸®ÆÕ ¿¬°á private List activePoints = new List(); 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); // (Âü°í: ÀÌ pointObj¿¡ 'InteractionView'°¡ °¨ÁöÇÒ ¼ö ÀÖ´Â ÄݶóÀÌ´õ¿Í ½ºÅ©¸³Æ®°¡ ÀÖ¾î¾ß ÇÔ) } 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 poses) { // ±âÁ¸ Æ÷ÀÎÆ® ¸ðµÎ »èÁ¦ foreach (var point in activePoints) Destroy(point); activePoints.Clear(); // ¸ðµç Æ÷ÀÎÆ® »õ·Î »ý¼º foreach (var pose in poses) CreatePoint(pose); } }