//Called when we press a key public override void Execute(Transform boxTrans, Command command) { List<Command> oldCommands = InputHandler.oldCommands; if (oldCommands.Count > 0) { Command latestCommand = oldCommands[oldCommands.Count - 1]; //Move the box with this command latestCommand.Undo(boxTrans); //Remove the command from the list oldCommands.RemoveAt(oldCommands.Count - 1); } }
public override void Execute(Command command, float value) { int size = CommandPattern.completedCommands.Count; if (size > 0) { Command currentCommand = CommandPattern.completedCommands[size - 1]; currentCommand.Undo(); CommandPattern.completedCommands.RemoveAt(size - 1); CommandPattern.undoneCommands.Add(currentCommand); } }