Class InstructionSet
A set of instructions to be executed sequentially.
Implements
Inherited Members
Namespace: SadConsole.Instructions
Assembly: SadConsole.dll
Syntax
public class InstructionSet : InstructionBase, IComponent
Constructors
InstructionSet()
Declaration
public InstructionSet()
Properties
CurrentInstruction
Represents the current instruction if this set is currently executing.
Declaration
public InstructionBase? CurrentInstruction { get; }
Property Value
| Type | Description |
|---|---|
| InstructionBase |
Instructions
All instructions in this set.
Declaration
public LinkedList<InstructionBase> Instructions { get; }
Property Value
| Type | Description |
|---|---|
| LinkedList<InstructionBase> |
Name
The name of this instruction to identify it apart from other instruction sets.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
Code(Action)
Adds a new CodeInstruction instruction with the specified callback to the end of this set.
Declaration
public InstructionSet Code(Action expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | expression | The code callback. |
Returns
| Type | Description |
|---|---|
| InstructionSet | This instruction set. |
Code(Func<IScreenObject, TimeSpan, bool>)
Adds a new CodeInstruction instruction with the specified callback to the end of this set.
Declaration
public InstructionSet Code(Func<IScreenObject, TimeSpan, bool> expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IScreenObject, TimeSpan, bool> | expression | The code callback. |
Returns
| Type | Description |
|---|---|
| InstructionSet | This instruction set. |
Instruct(InstructionBase)
Adds an instruction to the end of this set.
Declaration
public InstructionSet Instruct(InstructionBase instruction)
Parameters
| Type | Name | Description |
|---|---|---|
| InstructionBase | instruction |
Returns
| Type | Description |
|---|---|
| InstructionSet | This instruction set. |
InstructConcurrent(params InstructionBase[])
Adds a ConcurrentInstructions to the end of this set.
Declaration
public InstructionSet InstructConcurrent(params InstructionBase[] instructions)
Parameters
| Type | Name | Description |
|---|---|---|
| InstructionBase[] | instructions | Instructions to add. Must be two or more instructions. |
Returns
| Type | Description |
|---|---|
| InstructionSet | This instruction set. |
Reset()
Resets the Done flag.
Declaration
public override void Reset()
Overrides
Remarks
On the base class, resets the IsFinished to false. Override this method to reset the derived class' counters and status flags for the instruction.
Update(IScreenObject, TimeSpan)
Runs the instruction set. Once all instructions are finished, this set will set the IsFinished property will be set to true.
Declaration
public override void Update(IScreenObject componentHost, TimeSpan delta)
Parameters
| Type | Name | Description |
|---|---|---|
| IScreenObject | componentHost | |
| TimeSpan | delta |
Overrides
Wait(TimeSpan)
Adds a new Wait instruction with the specified duration to the end of this set.
Declaration
public InstructionSet Wait(TimeSpan duration)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | duration | The time to wait. |
Returns
| Type | Description |
|---|---|
| InstructionSet | This instruction set. |
WaitTrue(Func<bool>)
Adds a new PredicateInstruction instruction with the specified callback to the end of this set.
Declaration
public InstructionSet WaitTrue(Func<bool> expression)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<bool> | expression | The code callback. |
Returns
| Type | Description |
|---|---|
| InstructionSet | This instruction set. |