/// <summary> /// Add a Command to the Front of the Queue. /// </summary> /// <param name="_command">The Command to Add.</param> /// <param name="startImmediately">If the Command should start immediately (= true) or wait for the current Command to end (= false). Default is 'false'.</param> /// <param name="breakPreviousQueue">If the rest of the Queue should be cleared (= true) or should continue as is after the new command finished (= false). Default is 'false'.</param> public void AddToFrontOfQueue(DHUI_FlightCommand_Base _command, bool startImmediately = false, bool breakPreviousQueue = false) { if (breakPreviousQueue) { ClearQueue(); } queuedCommands.Insert(0, _command); if (startImmediately) { ProcessNext(); } }
/// <summary> /// Jump to the next Command in the Queue and start processing it. /// </summary> private void ProcessNext() { if (queuedCommands != null && queuedCommands.Count > 0) { currentProcessedCommand = queuedCommands[0]; queuedCommands.RemoveAt(0); StartCurrentCommand(); } else { currentProcessedCommand = null; } }
/// <summary> /// Add a Command to the Back of the Queue /// </summary> /// <param name="_command">Command to Add.</param> public void AddToBackOfQueue(DHUI_FlightCommand_Base _command) { queuedCommands.Add(_command); }