ExitStateNode.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using XNode;
  5. using System;
  6. using Sirenix.OdinInspector;
  7. using System.Linq;
  8. namespace ChivaVR.State
  9. {
  10. /// <summary>
  11. /// 离开状态
  12. /// </summary>
  13. public class ExitStateNode : StateNode
  14. {
  15. [Input] public Empty enter;
  16. public override void OnEnter()
  17. {
  18. NodePort enterPort = GetInputPort("enter");
  19. if (enterPort.GetConnections().Count == 0)
  20. {
  21. return;
  22. }
  23. for (int i = 0; i < enterPort.GetConnections().Count; i++)
  24. {
  25. StateNode node = enterPort.GetConnection(i).node as StateNode;
  26. if (!node.IsFinished) return;
  27. }
  28. IsRuning = true;
  29. OnExit();
  30. }
  31. /// <summary>
  32. /// 结束流程组
  33. /// </summary>
  34. public override void OnExit()
  35. {
  36. StateGraph stateGraph = graph as StateGraph;
  37. Debug.Log("Exit" + stateGraph.name);
  38. stateGraph.ExitStateGraph();
  39. }
  40. }
  41. }