public void OnLoadGamePressed() { if (SerializationManager.SaveExists() == false) { OnNewGamePressed(); return; } Debug.Log("IS THIS THE FIRST TIME???"); if (GlobalFlags.GetFirstTimeFlag() == true) { Debug.Log("YES!"); DragonlordChroniclesDatabase.EntityData player = Resources.Load <DragonlordChroniclesDatabase.EntityData>("ScriptableObjects/Player"); string[] lines; if (SerializationManager.GetTextFromFile("PlayerData.txt", out lines)) { player.Level = int.Parse(lines[0]); player.Experience = int.Parse(lines[1]); player.CurrentHealth = player.MaxHealth = int.Parse(lines[3]); player.Offense = int.Parse(lines[4]); player.Defense = int.Parse(lines[5]); player.Speed = int.Parse(lines[6]); } for (int i = 0; i < 4; i++) { if (SerializationManager.GetTextFromFile("DragonData_" + i.ToString() + ".txt", out lines)) { player.DragonList[i].DisplayName = lines[0]; Debug.Log(lines[0]); if (lines[0] != "") { player.DragonList[i].battleSprite = Resources.Load <DragonlordChroniclesDatabase.EntityData>("ScriptableObjects/Dragons/" + lines[0]).battleSprite; } else { player.DragonList[i].battleSprite = null; continue; } Debug.Log(lines[4]); player.DragonList[i].Level = int.Parse(lines[1]); player.DragonList[i].Experience = float.Parse(lines[2]); player.DragonList[i].MaxHealth = player.DragonList[i].CurrentHealth = int.Parse(lines[4]); player.DragonList[i].MaxMana = float.Parse(lines[6]); player.DragonList[i].Magic = float.Parse(lines[6]); player.DragonList[i].Speed = float.Parse(lines[7]); player.DragonList[i].Offense = float.Parse(lines[8]); player.DragonList[i].Defense = float.Parse(lines[9]); } } InventorySystem.Inventory playerInventory = Resources.Load <InventorySystem.Inventory>("ScriptableObjects/Inventories/PlayerInventory"); if (SerializationManager.GetTextFromFile("PlayerInventory.txt", out lines)) { for (int i = 0; i < lines.Length; i++) { playerInventory.Insert(lines[i]); } } ShopKeeperData weaponsShop = Resources.Load <ShopKeeperData>("ScriptableObjects/Shops/ArmorShop"); if (SerializationManager.GetTextFromFile("WeaponsShop.txt", out lines)) { weaponsShop.Gold = int.Parse(lines[0]); for (int i = 1; i < lines.Length; i++) { weaponsShop.items.Insert(lines[i]); } } ShopKeeperData goodsShop = Resources.Load <ShopKeeperData>("ScriptableObjects/Shops/Goods Shop"); if (SerializationManager.GetTextFromFile("GoodsShop.txt", out lines)) { goodsShop.Gold = int.Parse(lines[0]); for (int i = 1; i < lines.Length; i++) { goodsShop.items.Insert(lines[i]); } } } GlobalFlags.SetCurrentOverworldScene("Town - Interior"); GlobalFlags.SetPlayerPosition(new Vector2(0.5f, 0f)); GameManager.instance.PushState(StateManagement.GameStateType.Overworld, "Town - Interior"); GlobalFlags.SetFirstTimeFlag(false); }