Assets/Scripts/GameManager.cs
/// <summary>
/// Saves the current map to a file and reloads the scene for a new level to be created
/// </summary>
Saves the current map to a file and reloads the scene for a new level to be created
Saves the current map to a file and reloads the scene for a new level to be created
void SaveAndCloseCurrentSession()
    {
        var currentDateTime = System.DateTime.Now.ToString("yyyyMMddHHmmss");
        var levelFilePath = Application.persistentDataPath + "/" + currentDateTime + "-level.dat";
        var demoFilePath = Application.persistentDataPath + "/" + currentDateTime + "-demo.dat";
        var fullDemoFilePath = Application.persistentDataPath + "/" + currentDateTime + "-full-demo.dat";
        Level levelData = new Level(LevelManager.instance.GetLevel());
        var demoData = GetDemonstrationString();
        var fullDemoData = GetFullDemonstrationString();
        File.WriteAllText(levelFilePath, levelData.ToString());
        File.WriteAllText(demoFilePath, demoData);
        File.WriteAllText(fullDemoFilePath, fullDemoData);
        LogToGui("Level written to: " + levelFilePath);
        LogToGui("Demo written to: " + demoFilePath);
        LogToGui("Full demo written to: " + fullDemoFilePath);
        Scene currentScene = SceneManager.GetActiveScene();
        SceneManager.LoadScene(currentScene.name);
    }
void SaveAndCloseCurrentSession ( ) { var currentDateTime = System . DateTime . Now . ToString ( " " ) ; var levelFilePath = Application . persistentDataPath + " " + currentDateTime + " " ; var demoFilePath = Application . persistentDataPath + " " + currentDateTime + " " ; var fullDemoFilePath = Application . persistentDataPath + " " + currentDateTime + " " ; Level levelData = new Level ( LevelManager . instance . GetLevel ( ) ) ; var demoData = GetDemonstrationString ( ) ; var fullDemoData = GetFullDemonstrationString ( ) ; File . WriteAllText ( levelFilePath , levelData . ToString ( ) ) ; File . WriteAllText ( demoFilePath , demoData ) ; File . WriteAllText ( fullDemoFilePath , fullDemoData ) ; LogToGui ( " " + levelFilePath ) ; LogToGui ( " " + demoFilePath ) ; LogToGui ( " " + fullDemoFilePath ) ; Scene currentScene = SceneManager . GetActiveScene ( ) ; SceneManager . LoadScene ( currentScene . name ) ; }
Saves the current map to a file and reloads the scene for a new level to be created
Saves the current map to a file and reloads the scene for a new level to be created
// Write debugging information for the location of the  // Reload the scene for a fresh level generation session