暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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. }