namespace ChivaXR { using UnityEngine; public delegate void ProcessEventHandler(ProcessBase process); public class ProcessBase : MonoBehaviour { [HideInInspector] public bool isPlaying; [HideInInspector] public ProcessElement currentProcessElement; public event ProcessEventHandler Process_EnterEvent; public event ProcessEventHandler Process_UseEvent; public event ProcessEventHandler Process_ExitEvent; public event ProcessEventHandler Process_HalfExitEvent; /// /// 进入流程 /// /// public virtual void Enter(ProcessElement p) { currentProcessElement = p; isPlaying = true; Process_EnterEvent?.Invoke(this); } /// /// 完成离开 /// public virtual void Exit() { if (!isPlaying) return; isPlaying = false; Debug.Log("Exit" + currentProcessElement.stepID + "步骤"); Process_ExitEvent?.Invoke(this); currentProcessElement.Exit(); } /// /// 中途退出流程 /// public virtual void QuitHalfWay() { isPlaying = false; Process_HalfExitEvent?.Invoke(this); } /// /// 设置为进入状态 /// public virtual void SetEnterState() { } /// /// 设置为完成状态 /// public virtual void SetExitState() { } public virtual string GetPBDescribe() { return this.name; } } }