Maze / Library /PackageCache /com.unity.visualscripting@1.8.0 /Runtime /VisualScripting.Flow /Framework /Control /LoopUnit.cs
| using System.Collections; | |
| namespace Unity.VisualScripting | |
| { | |
| public abstract class LoopUnit : Unit | |
| { | |
| /// <summary> | |
| /// The entry point for the loop. | |
| /// </summary> | |
| [] | |
| [] | |
| public ControlInput enter { get; private set; } | |
| /// <summary> | |
| /// The action to execute after the loop has been completed or broken. | |
| /// </summary> | |
| [] | |
| public ControlOutput exit { get; private set; } | |
| /// <summary> | |
| /// The action to execute at each loop. | |
| /// </summary> | |
| [] | |
| 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); | |
| } | |
| } | |