PreprocessBase.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using ChivaXR;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public delegate void PreprocessEventHandler(PreprocessBase process);
  6. /// <summary>
  7. /// 流程预处理
  8. /// 语音/视角控制等
  9. /// </summary>
  10. public class PreprocessBase : MonoBehaviour
  11. {
  12. [HideInInspector]
  13. public ProcessElement currentProcessElement;
  14. public event PreprocessEventHandler Preprocess_EnterEvent;
  15. public event PreprocessEventHandler Preprocess_ExitEvent;
  16. public event PreprocessEventHandler Preprocess_HalfExitEvent;
  17. /// <summary>
  18. /// 进入流程
  19. /// </summary>
  20. /// <param name="p"></param>
  21. public virtual void Enter(ProcessElement p)
  22. {
  23. currentProcessElement = p;
  24. Preprocess_EnterEvent?.Invoke(this);
  25. }
  26. /// <summary>
  27. /// 完成离开
  28. /// </summary>
  29. public virtual void Exit()
  30. {
  31. Preprocess_ExitEvent?.Invoke(this);
  32. currentProcessElement.ProProcessFinished();
  33. }
  34. /// <summary>
  35. /// 中途退出流程
  36. /// </summary>
  37. public virtual void QuitHalfWay()
  38. {
  39. Preprocess_HalfExitEvent?.Invoke(this);
  40. }
  41. }