A game about forced loneliness, made by TACStudios
1using System.Collections;
2
3namespace Unity.VisualScripting
4{
5 public abstract class LoopUnit : Unit
6 {
7 /// <summary>
8 /// The entry point for the loop.
9 /// </summary>
10 [DoNotSerialize]
11 [PortLabelHidden]
12 public ControlInput enter { get; private set; }
13
14 /// <summary>
15 /// The action to execute after the loop has been completed or broken.
16 /// </summary>
17 [DoNotSerialize]
18 public ControlOutput exit { get; private set; }
19
20 /// <summary>
21 /// The action to execute at each loop.
22 /// </summary>
23 [DoNotSerialize]
24 public ControlOutput body { get; private set; }
25
26 protected override void Definition()
27 {
28 enter = ControlInputCoroutine(nameof(enter), Loop, LoopCoroutine);
29 exit = ControlOutput(nameof(exit));
30 body = ControlOutput(nameof(body));
31
32 Succession(enter, body);
33 Succession(enter, exit);
34 }
35
36 protected abstract ControlOutput Loop(Flow flow);
37
38 protected abstract IEnumerator LoopCoroutine(Flow flow);
39 }
40}