/// <summary> /// Records the multi-stage action in the undo stack. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="action"></param> public void FinishMultiStageAction() { if (_activeMultiAction == null) { return; } // We check if the action ended properly so it can be stored in undo. if (_activeMultiAction.OnActionEnd()) { clearRedoStack(); _undoStack.Push(_activeMultiAction); } // There is no longer an active multi-stage action. _activeMultiAction = null; }
/// <summary> /// Starts a multi stage action but does not record it in the undo stack. /// </summary> /// <typeparam name="T"></typeparam> public void StartMultiStageAction <T>() where T : MultiStageAction, new() { // Only run 1 multi-action at a time. if (_activeMultiAction != null) { return; } T action = new T(); action.manager = this; if (action.Init()) { _activeMultiAction = action; _activeMultiAction.OnActionStart(); } }
public void Reset() { _activeMultiAction = null; clearUndoStack(); clearRedoStack(); }