diff --git a/Assets/Scripts/Studio/Managers/SystemMain.cs b/Assets/Scripts/Studio/Core/SystemMain.cs similarity index 100% rename from Assets/Scripts/Studio/Managers/SystemMain.cs rename to Assets/Scripts/Studio/Core/SystemMain.cs diff --git a/Assets/Scripts/Studio/Managers/SystemMain.cs.meta b/Assets/Scripts/Studio/Core/SystemMain.cs.meta similarity index 100% rename from Assets/Scripts/Studio/Managers/SystemMain.cs.meta rename to Assets/Scripts/Studio/Core/SystemMain.cs.meta diff --git a/Assets/Scripts/Studio/Managers/CommandInvoker.cs b/Assets/Scripts/Studio/Managers/CommandInvoker.cs index e6a14733..06098c4c 100644 --- a/Assets/Scripts/Studio/Managers/CommandInvoker.cs +++ b/Assets/Scripts/Studio/Managers/CommandInvoker.cs @@ -4,8 +4,16 @@ namespace XED.Command { public class CommandInvoker { - public Stack commandStack = new Stack(); - public void Invoke(T command) where T : IReversibleCommand + Stack commandStack = new(); + Stack undoableStack = new (); + public void Invoke(IReversibleCommand command) + { + command.Execute(); + commandStack.Push(command); + undoableStack.Push(command); + } + + public void Invoke(IIrreversibleCommand command) { command.Execute(); commandStack.Push(command); @@ -13,12 +21,12 @@ namespace XED.Command public void Undo() { - if (commandStack.Count == 0) + if (undoableStack.Count == 0) { return; } - var command = commandStack.Pop(); - (command as IReversibleCommand) .Undo(); + var command = undoableStack.Pop(); + command.Undo(); } } } \ No newline at end of file