using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; //简单的只可抓取交互的物体 如三角木 public class SimpleGrabGO : VRGrabInterractableBase { //逆流程 [Tooltip("具体细节与主流程相反 拆=装,装=拆")] public bool reverseOperation; public override void Active(ProcessEnum stepName, UnityAction finishedEven) { thisCollider.enabled = true; SetGrabInteractable(true); if (!reverseOperation) { if (stepName == ProcessEnum.teardown)//拆卸流程 放置到自由位置 视为操作完成 { atFreePos = finishedEven; } else if (stepName == ProcessEnum.assemble)//安装流程 放置到固定位置视为操作完成 { atFixedPos = finishedEven; } } else//逆转流程 与上述逻辑相反 例如拆车时需要将三角木放置在固定位置 { if (stepName == ProcessEnum.teardown)//拆卸流程 放置到自由位置 视为操作完成 { atFixedPos = finishedEven; } else if (stepName == ProcessEnum.assemble)//安装流程 放置到固定位置视为操作完成 { atFreePos = finishedEven; } } } public override void UnActive(ProcessEnum stepName) { base.UnActive(stepName); if (stepName == ProcessEnum.assemble)//安装到车上后禁用collider 避免出现冲突情况 thisCollider.enabled = false; SetGrabInteractable(false); } }