public SerializableSave MakeSerializableSave() { this.maxHP = GlobalController.pc.maxHP; this.maxEnergy = GlobalController.pc.maxEnergy; this.basePlayerDamage = GlobalController.pc.baseDamage; this.playerPosition = GlobalController.pc.transform.position; this.sceneName = SceneManager.GetActiveScene().path; this.playerItems = GlobalController.inventory.items.MakeSerializableInventory(); return(new SerializableSave(this)); }
public SerializableSave(Save s) { this.slotNum = s.slotNum; this.gameFlags = s.gameFlags; this.unlocks = s.unlocks.MakeSerializableUnlocks(); this.currentEnergy = s.currentEnergy; this.maxEnergy = s.maxEnergy; this.currentHP = s.currentHP; this.maxHP = s.maxHP; this.xPos = s.playerPosition.x; this.yPos = s.playerPosition.y; this.sceneName = s.sceneName; this.playerItems = s.playerItems; this.baseDamage = s.basePlayerDamage; persistentObjectKeys = new List <string>(); persistentObjectValues = new List <SerializedPersistentObject>(); foreach (KeyValuePair <string, SerializedPersistentObject> kv in s.persistentObjects) { persistentObjectKeys.Add(kv.Key); persistentObjectValues.Add(kv.Value); } }
public void LoadFromSerializableInventoryList(SerializableInventoryList i) { this.items = i.items; }
public void LoadFromSerializableInventoryList(SerializableInventoryList i) { this.items = i.items.Select(x => new InventoryItem(x)).ToList(); }