63 lines
2.2 KiB
C#
63 lines
2.2 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
// Presenter가 InteractionView를 제어하기 위한 인터페이스
|
|
public interface IInteractionView
|
|
{
|
|
// VR 컨트롤러가 로봇을 잡았다 놨을 때 발생
|
|
event Action<RobotData> OnRobotReleased;
|
|
// VR 컨트롤러가 특정 포인트를 클릭했을 때 발생
|
|
event Action<int> OnPointClicked;
|
|
// VR 컨트롤러가 포인트를 잡고 드래그 시작/중/끝 했을 때 발생
|
|
event Action<int> OnPointDragStart;
|
|
event Action<int, Vector3> OnPointDragUpdate; // (포인트 인덱스, 새 월드 좌표)
|
|
event Action<int> OnPointDragEnd;
|
|
|
|
// Presenter가 호출할 함수들
|
|
void ShowGhostRobot(RobotData pose);
|
|
void HideGhostRobot();
|
|
void ShowDragArrow(Vector3 position);
|
|
void HideDragArrow();
|
|
}
|
|
|
|
// (이 스크립트는 VR 컨트롤러 로직이 있는 곳에 붙어야 합니다)
|
|
public class InteractionView : MonoBehaviour, IInteractionView
|
|
{
|
|
public event Action<RobotData> OnRobotReleased;
|
|
public event Action<int> OnPointClicked;
|
|
public event Action<int> OnPointDragStart;
|
|
public event Action<int, Vector3> OnPointDragUpdate;
|
|
public event Action<int> OnPointDragEnd;
|
|
|
|
void Update()
|
|
{
|
|
// 컨트롤러로 로봇을 잡고있는지 감지
|
|
// if (IsGrabbingRobot()) { ... }
|
|
|
|
// 컨트롤러 그랩 버튼을 뗐을 때
|
|
// if (OnGrabRelease())
|
|
// {
|
|
// RobotData currentPose = GetCurrentRobotPose();
|
|
// OnRobotReleased?.Invoke(currentPose); // 2. "위치 확정?" 팝업 요청
|
|
// }
|
|
|
|
// 컨트롤러로 포인트를 클릭했을 때
|
|
// if (OnPointClick(out int clickedPointIndex))
|
|
// {
|
|
// OnPointClicked?.Invoke(clickedPointIndex); // 8. "이동/삭제?" 팝업 요청
|
|
// }
|
|
|
|
// 컨트롤러로 포인트를 꾹 누르기 시작(드래그 시작)
|
|
// if (OnPointHold(out int draggedPointIndex))
|
|
// {
|
|
// OnPointDragStart?.Invoke(draggedPointIndex); // 5. 드래그 시작
|
|
// }
|
|
}
|
|
|
|
// --- Presenter가 호출할 함수들 ---
|
|
public void ShowGhostRobot(RobotData pose) { /* 반투명 로봇2 활성화 및 위치 설정 */ }
|
|
public void HideGhostRobot() { /* 반투명 로봇2 비활성화 */ }
|
|
public void ShowDragArrow(Vector3 position) { /* 드래그용 화살표 UI 활성화 및 위치 설정 */ }
|
|
public void HideDragArrow() { /* 드래그용 화살표 UI 비활성화 */ }
|
|
}
|