public static void TestTintFrom() { Color colourStart = new Color(0.4f, 0.2f, 0.7f, 0.5f); Color colourEnd = new Color(0.3f, 0.4f, 0.15f, 0.25f); Color colourVal = colourStart; Ref <Color> colourRef = new Ref <Color>( () => colourVal, t => colourVal = t ); CommandQueue queue = new CommandQueue(); queue.Sequence( Cmd.Repeat(2, Cmd.Sequence( Cmd.TintFrom(colourRef, colourEnd, 1.0), Cmd.WaitForFrames(1) ) ) ); queue.Update(0.2); AreEqual(colourVal, colourStart * 0.2f + colourEnd * 0.8f, 0.001f); colourVal = colourStart; queue.Update(0.8); AreEqual(colourVal, colourStart, 0.001f); queue.Update(0.0); queue.Update(0.5); AreEqual(colourVal, colourStart * 0.5f + colourEnd * 0.5f, 0.001f); }
/// <summary> /// Add a command to be executed in parallel. /// </summary> /// <param name="command"> /// The command to execute. Should be non-null. /// </param> /// <exception cref="System.ArgumentNullException"></exception> public void Add(CommandDelegate command) { if (command == null) { throw new System.ArgumentNullException("command"); } CommandQueue queue = new CommandQueue(); queue.Sequence(command); _queues.AddLast(queue); }
/// <summary> /// Create a new Queue with the specified commands. The CommandBehaviour /// will take care of updating the Queue. /// </summary> /// <returns> A new Queue that the Cmd will run on. </returns> /// <param name="commands">Cmd to be run sequentially.</param> public CommandQueue Queue(params CommandDelegate[] commands) { var queue = new CommandQueue(); if (commands.Length > 0) { queue.Sequence(commands); } _queues.Add(queue); return(queue); }