public static void LoadSave() { //print("loading"); // string filePath = Application.persistentDataPath + gameDataPath; /* * if (File.Exists(filePath)) { * print("found game"); * //Save save = JsonUtility.FromJson<Save>(File.ReadAllText(filePath)); * InventoryScript.ReadFromSave(save); * ItemLoadScript.ReadFromSave(save); * EnemyPosScript.ReadFromSave(save); * SceneManager.LoadScene(save.savedScene); * } * else { * StartGame(); * }*/ if (officialState == null) { StartGame(); } else { InventoryScript.ReadFromSave(officialState); ItemLoadScript.ReadFromSave(officialState); EnemyPosScript.ReadFromSave(officialState); SceneManager.LoadScene(officialState.savedScene); } }
public static Save CreateSaveGameObject() { Save save = new Save(); InventoryScript.PopulateSave(save); ItemLoadScript.PopulateSave(save); EnemyPosScript.PopulateSave(save); return(save); }
public static void StartGame() { InventoryScript.LoadDefault(); ItemLoadScript.LoadDefault(); EnemyPosScript.LoadDefault(); SceneManager.LoadScene("Closet"); officialState = CreateSaveGameObject(); officialState.savedScene = "Closet"; officialState.checkpointNum = -1; }
// Use this for initialization void Awake() { game = gameObject; game.SetActive(ItemLoadScript.GetItem(toggleNum)); }
public void Toggle() { ItemLoadScript.ToggleItem(toggleNum); game.SetActive(ItemLoadScript.GetItem(toggleNum)); }