Example #1
0
        /// <summary>
        /// Adds a <see cref="ConcurrentInstructions"/> to the end of this set.
        /// </summary>
        /// <param name="instructions">Instructions to add. Must be two or more instructions.</param>
        /// <returns>This instruction set.</returns>
        public InstructionSet InstructConcurrent(params InstructionBase[] instructions)
        {
            if (instructions.Length == 0)
            {
                throw new ArgumentOutOfRangeException(nameof(instructions), "Two or more instruction must be provided.");
            }

            Instructions.AddLast(new ConcurrentInstructions(instructions));
            return(this);
        }
Example #2
0
 /// <summary>
 /// Adds an instruction to the end of this set.
 /// </summary>
 /// <param name="instruction"></param>
 /// <returns>This instruction set.</returns>
 public InstructionSet Instruct(InstructionBase instruction)
 {
     Instructions.AddLast(instruction);
     return(this);
 }
Example #3
0
 /// <summary>
 /// Adds a new <see cref="SadConsole.Instructions.Wait"/> instruction with the specified duration to the end of this set.
 /// </summary>
 /// <param name="duration">The time to wait.</param>
 /// <returns>This instruction set.</returns>
 public InstructionSet Wait(TimeSpan duration)
 {
     Instructions.AddLast(new Wait(duration));
     return(this);
 }
Example #4
0
 /// <summary>
 /// Adds a new <see cref="PredicateInstruction"/> instruction with the specified callback to the end of this set.
 /// </summary>
 /// <param name="expression">The code callback.</param>
 /// <returns>This instruction set.</returns>
 public InstructionSet WaitTrue(Func <bool> expression)
 {
     Instructions.AddLast(new PredicateInstruction(expression));
     return(this);
 }
Example #5
0
 /// <summary>
 /// Adds a new <see cref="CodeInstruction"/> instruction with the specified callback to the end of this set.
 /// </summary>
 /// <param name="expression">The code callback.</param>
 /// <returns>This instruction set.</returns>
 public InstructionSet Code(Func <Console, TimeSpan, bool> expression)
 {
     Instructions.AddLast(new CodeInstruction(expression));
     return(this);
 }
 /// <summary>
 /// Adds a new <see cref="CodeInstruction"/> instruction with the specified callback to the end of this set.
 /// </summary>
 /// <param name="expression">The code callback.</param>
 /// <returns>This instruction set.</returns>
 public InstructionSet Code(Action expression)
 {
     Instructions.AddLast(new CodeInstruction((s, d) => { expression.Invoke(); return(true); }));
     return(this);
 }
 /// <summary>
 /// Adds a new <see cref="CodeInstruction"/> instruction with the specified callback to the end of this set.
 /// </summary>
 /// <param name="expression">The code callback.</param>
 /// <returns>This instruction set.</returns>
 public InstructionSet Code(Func <IScreenObject, TimeSpan, bool> expression)
 {
     Instructions.AddLast(new CodeInstruction(expression));
     return(this);
 }