예제 #1
0
 private void RemoveModifier(ModifierAction action)
 {
     for (int i = 0; i < action.modifiers.Count; i++)
     {
         ModifierSelectionHandler.Instance.SelectModifier(action.modifiers[i], false);
         ModifierHandler.Instance.DeleteModifier();
     }
 }
예제 #2
0
 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();
 }
예제 #3
0
 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());
     }
 }
예제 #4
0
 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());
     }
 }