using System; using System.Collections; using System.Collections.Generic; using DG.Tweening; using MotionFramework; using UnityEngine; namespace DefaultNamespace.ProcessMode { public class test : MonoBehaviour { private AnimationProcessManager processManager; private IEnumerator Start() { processManager = MotionEngine.GetModule(); yield return new WaitForSeconds(1); processManager.AddProcess("Teaching"); List actions = CreateStepActions(); AnimationStep step = new AnimationStep($"描述步骤", 100, actions); processManager.AddStepToProcess("Teaching", step); // List actions1 = CreateStepActions1(); // AnimationStep step1 = new AnimationStep($"描述步骤", 100, actions1); // processManager.AddStepToProcess("Teaching", step1); } private List CreateStepActions() { List actions = new List(); GameObject obj1 = GameObject.Find("变电箱_门"); GameObject 插座 = GameObject.Find("插座"); Action action1 = () => { }; Action action2 = () => { }; actions.Add(new ActionWithDescription(new List() { obj1,插座 }, action1, $"步骤 {1} 的动作描述")); actions.Add(new ActionWithDescription(new List() { 插座,obj1}, action1, $"步骤 {2} 的动作描述")); return actions; } private List CreateStepActions1() { List actions = new List(); GameObject obj1 = GameObject.Find("变电箱_门"); GameObject 插座 = GameObject.Find("插座"); Action action1 = () => { }; actions.Add(new ActionWithDescription(new List() { obj1 }, action1, $"步骤 {1} 的动作描述")); actions.Add(new ActionWithDescription(new List() { 插座 }, action1, $"步骤 {2} 的动作描述")); return actions; } private void Update() { if (Input.GetMouseButtonDown(0)) { // 假设您有方法来检测点击对象 GameObject clickedObject = DetectClickedObject(); if (clickedObject != null) { processManager.HandleClick(clickedObject); } } } private GameObject DetectClickedObject() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { return hit.collider.gameObject; } return null; } } }