No Description
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.

WaitWhileUnit.cs 868B

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Collections;
  2. using UnityEngine;
  3. namespace Unity.VisualScripting
  4. {
  5. /// <summary>
  6. /// Delays flow by waiting while a condition is true.
  7. /// </summary>
  8. [UnitTitle("Wait While")]
  9. [UnitShortTitle("Wait While")]
  10. [UnitOrder(3)]
  11. public class WaitWhileUnit : WaitUnit
  12. {
  13. /// <summary>
  14. /// The condition to check.
  15. /// </summary>
  16. [DoNotSerialize]
  17. public ValueInput condition { get; private set; }
  18. protected override void Definition()
  19. {
  20. base.Definition();
  21. condition = ValueInput<bool>(nameof(condition));
  22. Requirement(condition, enter);
  23. }
  24. protected override IEnumerator Await(Flow flow)
  25. {
  26. yield return new WaitWhile(() => flow.GetValue<bool>(condition));
  27. yield return exit;
  28. }
  29. }
  30. }