private void RemoveModifier(ModifierAction action) { for (int i = 0; i < action.modifiers.Count; i++) { ModifierSelectionHandler.Instance.SelectModifier(action.modifiers[i], false); ModifierHandler.Instance.DeleteModifier(); } }
private void RestoreModifier(ModifierAction action) { recreating = true; action.modifiers.Clear(); ModifierSelectionHandler.Instance.Restore(action.dtos); foreach (Modifier m in recreatedModifiers) { action.modifiers.Add(m); } recreating = false; recreatedModifiers.Clear(); }
public void Undo() { if (actionIndex > 0) { undoRedoActive = true; actionIndex--; ModifierAction ma = actionHistory[actionIndex]; if (ma.action == Action.Delete) { RestoreModifier(ma); } else { RemoveModifier(ma); } undoRedoActive = false; StartCoroutine(ModifierHandler.Instance.IUpdateLevels()); } }
public void Redo() { if (actionIndex < actionHistory.Count) { undoRedoActive = true; ModifierAction ma = actionHistory[actionIndex]; if (ma.action == Action.Create) { RestoreModifier(ma); } else { Debug.Log("Remove"); RemoveModifier(ma); } actionIndex++; undoRedoActive = false; StartCoroutine(ModifierHandler.Instance.IUpdateLevels()); } }