Sin descripción
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TriggerStateTransition.cs 969B

1234567891011121314151617181920212223242526272829303132333435
  1. namespace Unity.VisualScripting
  2. {
  3. /// <summary>
  4. /// Triggers the transition in the parent state graph.
  5. /// </summary>
  6. [UnitSurtitle("State")]
  7. [UnitCategory("Nesting")]
  8. [UnitShortTitle("Trigger Transition")]
  9. [TypeIcon(typeof(IStateTransition))]
  10. public sealed class TriggerStateTransition : Unit
  11. {
  12. /// <summary>
  13. /// The moment at which the parent state transition should be triggered.
  14. /// </summary>
  15. [DoNotSerialize]
  16. [PortLabelHidden]
  17. public ControlInput trigger { get; private set; }
  18. protected override void Definition()
  19. {
  20. trigger = ControlInput(nameof(trigger), Trigger);
  21. }
  22. private ControlOutput Trigger(Flow flow)
  23. {
  24. var stateTransition = flow.stack.GetParent<INesterStateTransition>();
  25. flow.stack.ExitParentElement();
  26. stateTransition.Branch(flow);
  27. return null;
  28. }
  29. }
  30. }