Exemple #1
0
    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);
        }
    }
Exemple #2
0
    public static Save CreateSaveGameObject()
    {
        Save save = new Save();

        InventoryScript.PopulateSave(save);
        ItemLoadScript.PopulateSave(save);
        EnemyPosScript.PopulateSave(save);
        return(save);
    }
Exemple #3
0
 public static void StartGame()
 {
     InventoryScript.LoadDefault();
     ItemLoadScript.LoadDefault();
     EnemyPosScript.LoadDefault();
     SceneManager.LoadScene("Closet");
     officialState               = CreateSaveGameObject();
     officialState.savedScene    = "Closet";
     officialState.checkpointNum = -1;
 }
Exemple #4
0
 // Use this for initialization
 void Awake()
 {
     game = gameObject;
     game.SetActive(ItemLoadScript.GetItem(toggleNum));
 }
Exemple #5
0
 public void Toggle()
 {
     ItemLoadScript.ToggleItem(toggleNum);
     game.SetActive(ItemLoadScript.GetItem(toggleNum));
 }