public RestoreFromMemento ( Memento, memento ) : void | ||
memento | Memento, | |
return | void |
public void RestoreFromMemento(Memento memento)
{
state = memento.SavedState;
Console.WriteLine("Originator: State after restoring from Memento: " + state);
}
private void Undo() { if (currentMemento > 0) { currentMemento--; originator.RestoreFromMemento(careTaker.getMemento(currentMemento)); // this.gameState = originator.GetGameState(); // Destroy(this.gameState); // this.gameState = Instantiate(originator.GetGameState()); Debug.Log("Undo! Current Memento: " + currentMemento); } }