public void ExecuteCommand(string command, string[] arguments) { IConsoleCommand consoleCommand; if (TryGet(command, out consoleCommand)) { var commandToExecute = new ConsoleCommandInstance(this, consoleCommand, arguments); // todo: add multy threading commandsQueue.Enqueue(commandToExecute); } }
// Update is called once per frame public void Update() { if (currentCommand == null && commandsQueue.Count > 0) { // todo: add multy threading currentCommand = commandsQueue.Dequeue(); currentCommand.Command.Action(currentCommand.Arguments); currentCommand = null; } }