Scripting / Instructions
InstructionSequence
Abstract base for instructions that hold an ordered list of child instructions and execute them sequentially within a single turn slot.
Instruction → PlayerInstruction
└── InstructionSequence ← you are here
├── Instruction_Combo
└── Instruction_PingPong
Fields & Properties
| Member | Type | Description |
|---|---|---|
childs | List<PlayerInstruction> | Internal serialized list of children. Access read-only via Childrens. |
Childrens | IReadOnlyList<PlayerInstruction> | Read-only view of the child instruction list. |
maxCapacity abstract | int | Maximum number of children this sequence accepts. The UI enforces this limit. |
Abstract Methods — Must Override
| Method | Description |
|---|---|
Execute() | Instant side-effects before animation. Usually empty for sequences. |
Tick(ExecutionContext ctx) | Coroutine. For a pure sequence, leave the body empty and call yield break — children are automatically executed by GetExecutionList(). |
Public Methods
| Method | Description |
|---|---|
AddInstruction(PlayerInstruction i) | Appends a child to the sequence. |
RemoveInstruction(PlayerInstruction i) | Removes a child from the sequence. |
Insert(int index, PlayerInstruction i) | Inserts a child at a specific index. |
Validate() override | Returns false if the child list is empty or any child is invalid. |
GetExecutionList(int loop) override | Iterates all children and yields their execution lists in order. This is what makes children run sequentially. |
Example
namespace LoopAdventure { [TypeName("MyCombo")] public class Instruction_MyCombo : InstructionSequence { public override string displayName => "My Combo"; public override int maxCapacity => 3; // Children are run automatically via GetExecutionList. public override void Execute() { } protected override IEnumerator Tick(ExecutionContext ctx) { yield break; } } }