using System.Collections;
using UnityEngine;
namespace Unity.VisualScripting
{
///
/// Delays flow by waiting while a condition is true.
///
[UnitTitle("Wait While")]
[UnitShortTitle("Wait While")]
[UnitOrder(3)]
public class WaitWhileUnit : WaitUnit
{
///
/// The condition to check.
///
[DoNotSerialize]
public ValueInput condition { get; private set; }
protected override void Definition()
{
base.Definition();
condition = ValueInput(nameof(condition));
Requirement(condition, enter);
}
protected override IEnumerator Await(Flow flow)
{
yield return new WaitWhile(() => flow.GetValue(condition));
yield return exit;
}
}
}