using System.Collections; namespace Unity.VisualScripting { public abstract class LoopUnit : Unit { /// /// The entry point for the loop. /// [DoNotSerialize] [PortLabelHidden] public ControlInput enter { get; private set; } /// /// The action to execute after the loop has been completed or broken. /// [DoNotSerialize] public ControlOutput exit { get; private set; } /// /// The action to execute at each loop. /// [DoNotSerialize] public ControlOutput body { get; private set; } protected override void Definition() { enter = ControlInputCoroutine(nameof(enter), Loop, LoopCoroutine); exit = ControlOutput(nameof(exit)); body = ControlOutput(nameof(body)); Succession(enter, body); Succession(enter, exit); } protected abstract ControlOutput Loop(Flow flow); protected abstract IEnumerator LoopCoroutine(Flow flow); } }