private IEnumerator continuousSave()
    {
        while (true)
        {
            yield return(new WaitForSeconds(20));

            SaveValues.getInstance().SaveGame();
        }
    }
    private IEnumerator startUp()
    {
        yield return(new WaitForSeconds(0));

        SaveValues.getInstance().LoadGame();
        //Get the path of the Game data folder
        string m_Path = Application.dataPath;

        //Output the Game data path to the console
        StartCoroutine(continuousSave());
        // Dont destroy this object when a new scene is loaded
    }
Beispiel #3
0
    //Save game to a file
    public void SaveGame()
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + "/gamesave.save");

        SaveValues.getInstance().UpdateValues();
        bf.Serialize(file, SaveValues.getInstance());

        Debug.Log("Serialising " + Application.persistentDataPath + "/gamesave.save");

        file.Close();

        Debug.Log("Game Saved");
    }
Beispiel #4
0
 //Save game to a file
 public void SaveGame()
 {
     SaveValues.getInstance().SaveGame();
 }