Beispiel #1
0
    public void SaveGameStatistics(QuickLife script)
    {
        GameMemento newMemento = Instantiate(MementoType).GetComponent <GameMemento>();

        newMemento.InitializeGame(this);
        script.SaveMemento(newMemento);
    }
Beispiel #2
0
 public void SaveInventory(QuickLife script)
 {
     for (int i = 0; i < items.Count; i++)
     {
         if (i == handIndex)
         {
             ConcreteItem itemInHand = handScript as ConcreteItem;
             if (itemInHand)
             {
                 ItemMementos[i] = itemInHand.CreateInventoryMemento();
                 //The item in your hand will already be saved in the QuickLife script by the timeVibration
                 script.SaveMemento(ItemMementos[i]);
             }
         }
         else
         {
             ItemMemento newMemento = Instantiate(MementoType).GetComponent <ItemMemento>();
             newMemento.InitializeInventory(i);
             script.SaveMemento(newMemento);
             //Place memento into a list of Mementos
             ItemMementos[i] = newMemento;
         }
     }
 }