Ejemplo n.º 1
0
    private void Start()
    {
        defaultLocation = Application.persistentDataPath + "/defaultSave.mdf";
        currentScene    = SceneManager.GetActiveScene().buildIndex;
        if (currentScene >= 2 && currentScene <= 4)
        {
            Cursor.visible = false;
            if (GameObject.Find("DataLoader") != null)   //dobbiamo caricare un salvataggio
            {
                Destroy(GameObject.Find("DataLoader"));
                // GetComponent<OverlayShower>().showIntro = false;
                LoadSave();

                player.transform.position = saveData.lastSpawn;
            }
            else
            {
                // GetComponent<OverlayShower>().showIntro = true;

                saveData = new DataFile();

                saveData.lastSpawn = player.transform.position;
                screenshot         = cam.GetComponent <Screenshot>();
                screenshot.folder  = Application.persistentDataPath;
                screenshot.fName   = "preview_wallpaper.png";
                screenshot.CaptureScreenshot();
            }
        }
    }
Ejemplo n.º 2
0
    public void SaveGame()
    {
        var location = Application.persistentDataPath + "/defaultSave.mdf";

        string data = JsonUtility.ToJson(saveData, true);

        File.WriteAllText(location, data);
        try {
            screenshot.CaptureScreenshot();
        }
        catch { }
    }