public RepeatCommand(Command command, TimeSpan repeatDelay, int totalRepeats = TotalRepeats.Infinite) { command.ThrowIfNull("command"); _command = command; Delay(repeatDelay); Times(totalRepeats); }
public RetryCommand(Command command, TimeSpan retryDelay, int maximumAttempts = MaximumAttempts.Infinite) { command.ThrowIfNull("command"); _command = command; Delay(retryDelay); Times(maximumAttempts); }
public override ChainedCommand And(Command command) { command.ThrowIfNull("command"); AddCommand(command); return this; }
public void ExecuteCommand(Command command) { command.ThrowIfNull("command"); _worldObserver.CommandExecuting(command); CommandResult result = command.Execute(_context); bool wasDeferred = result == CommandResult.Deferred; if (wasDeferred) { _commandList.Add(command, _worldInstance.WorldTime.Total); } else { _worldObserver.CommandExecuted(command, result); } }
public void EnqueueCommandWithExecutionDelay(Command command, TimeSpan executionDelay, Action<CommandResult> commandExecutedDelegate = null) { command.ThrowIfNull("command"); _commandList.Add(command, _worldInstance.WorldTime.Total + executionDelay, commandExecutedDelegate); }
public void EnqueueCommandToExecuteAtTime(Command command, TimeSpan totalWorldTime, Action<CommandResult> commandExecutedDelegate = null) { command.ThrowIfNull("command"); _commandList.Add(command, totalWorldTime, commandExecutedDelegate); }
public bool CommandQueued(Command command) { command.ThrowIfNull("command"); return _commandList.Contains(command); }
public void CancelCommand(Command command) { command.ThrowIfNull("command"); _commandList.Remove(command); }
public void CommandExecuting(Command command) { command.ThrowIfNull("command"); }
public void CommandExecuted(Command command, CommandResult result) { command.ThrowIfNull("command"); _logRendererState.EnqueueCommandExecutedLogEntry(_worldTime.Total, command, result); }
public ChainedCommand(Command command) { command.ThrowIfNull("command"); AddCommand(command); }
public static Command Tagged(Command command, Guid tag) { command.ThrowIfNull("command"); return command.WithTag(tag); }
public void Remove(Command command) { command.ThrowIfNull("command"); _commands.RemoveAll(arg => arg.Command == command); foreach (Command nestedCommand in command.NestedCommands) { Remove(nestedCommand); } }
public bool Contains(Command command) { command.ThrowIfNull("command"); return _commands.Any(arg => arg.Command == command); }
public void Add(Command command, TimeSpan executeAtTime, Action<CommandResult> commandExecutedDelegate = null) { command.ThrowIfNull("command"); _commands.Add(new CommandListEntry(command, executeAtTime, commandExecutedDelegate)); }