Example #1
0
    void SaveGameStatus()
    {
        OnGameSave?.Invoke();
        var obj = GameObject.FindGameObjectWithTag("SceneManager");

        if (obj == null)
        {
            return;             //The game is not currently running, so nothing to save.
        }
        var mapdata = obj.GetComponent <MapManager>().SerializeMapData();

        using (StreamWriter SW = new StreamWriter(Path.Combine(AppdataPath, "Map.json"))) {
            SW.Write(mapdata);
        }
    }
Example #2
0
 /// <summary>
 /// Saves everything about the game.
 /// </summary>
 public static void SaveGame()
 {
     OnGameSave?.Invoke();
 }