public void PushOperation(IOperation op) { undoOperations.Push(op); redoOperations.Clear(); GC.Collect(); Debug.Log($"Added to stack: {op.GetType().Name}"); OnStacksChanged?.Invoke(); }
public void Redo() { if (redoOperations.Count == 0) { return; } IOperation op = redoOperations.Pop(); op.Apply(); undoOperations.Push(op); source.PlayOneShot(redoAudio); Debug.Log($"Redo: {op.GetType().Name}"); OnStacksChanged?.Invoke(); }
public void Undo() { if (undoOperations.Count == 0) { return; } IOperation op = undoOperations.Pop(); op.Revert(); redoOperations.Push(op); source.PlayOneShot(undoAudio); Debug.Log($"Undo: {op.GetType().Name}"); OnStacksChanged?.Invoke(); }