123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 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;
- /// <summary>
- /// 进入流程
- /// </summary>
- /// <param name="p"></param>
- public virtual void Enter(ProcessElement p)
- {
- currentProcessElement = p;
- isPlaying = true;
- Process_EnterEvent?.Invoke(this);
- }
- /// <summary>
- /// 完成离开
- /// </summary>
- public virtual void Exit()
- {
- if (!isPlaying) return;
- isPlaying = false;
- Debug.Log("Exit" + currentProcessElement.stepID + "步骤");
- Process_ExitEvent?.Invoke(this);
- currentProcessElement.Exit();
- }
- /// <summary>
- /// 中途退出流程
- /// </summary>
- public virtual void QuitHalfWay()
- {
- isPlaying = false;
- Process_HalfExitEvent?.Invoke(this);
- }
- /// <summary>
- /// 设置为进入状态
- /// </summary>
- public virtual void SetEnterState()
- {
- }
- /// <summary>
- /// 设置为完成状态
- /// </summary>
- public virtual void SetExitState()
- {
- }
- public virtual string GetPBDescribe()
- {
- return this.name;
- }
- }
- }
|