예제 #1
0
 public void restoreFromMemento(GameMemento memento)
 {
     if (memento != null)
     {
         hp  = memento.getGameHp();
         mp  = memento.getGameMp();
         exp = memento.getGameExp();
     }
 }
예제 #2
0
 private void AddState(string stateName, GameMemento memento)
 {
     if (!mMementos.ContainsKey(stateName))
     {
         mMementos.Add(stateName, memento);
     }
     else
     {
         Console.WriteLine($"存檔失敗!{stateName}已重複");
     }
 }
예제 #3
0
 public void setMemento(string stateName, GameMemento memento)
 {
     if (mMementos.Count < restoreNumber)
     {
         AddState(stateName, memento);
     }
     else
     {
         Console.WriteLine($"已到達最大存檔次數:{restoreNumber},請充值最大次數");
     }
 }