Esempio n. 1
0
 public void swapUndo()
 {
     //Debug.Log("swapUndo:" + objectToUndo.name);
     //Debug.Log(oppositeUndoMemento == null);
     if (oppositeUndoMemento == null)
     {
         oppositeUndoMemento = createMementoFunc();
         oppositeUndoMemento.save(objectToUndo);
     }
     undoMemento.restore(objectToUndo);
     var lTemp = undoMemento;
     undoMemento = oppositeUndoMemento;
     oppositeUndoMemento = lTemp;
     //Debug.Log(oppositeUndoMemento == null);
 }
Esempio n. 2
0
 public UndoObject(Object pObjectToUndo, System.Func<UndoMemento> pCreateMementoFunc)
 {
     //Debug.Log("UndoObject:" + pObjectToUndo.name);
     createMementoFunc = pCreateMementoFunc;
     objectToUndo = pObjectToUndo;
     undoMemento = createMementoFunc();
     undoMemento.save(objectToUndo);
     oppositeUndoMemento = null;
 }