using System.Collections;
using UnityEngine;
namespace Unity.VisualScripting
{
///
/// Delays flow by waiting until a condition becomes true.
///
[UnitTitle("Wait Until")]
[UnitShortTitle("Wait Until")]
[UnitOrder(2)]
public class WaitUntilUnit : WaitUnit
{
///
/// The condition to await.
///
[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 WaitUntil(() => flow.GetValue(condition));
yield return exit;
}
}
}