public void Kontynuuj() { int OstatniaPlansza; if (PlayerPrefs.HasKey("Up")) { if (File.Exists(Application.persistentDataPath + "/ZapisanaGra.d")) { BinaryFormatter Forma = new BinaryFormatter(); FileStream zapisGry = File.Open(Application.persistentDataPath + "/ZapisanaGra.d", FileMode.Open); ZapisGry zapisG = (ZapisGry)Forma.Deserialize(zapisGry); OstatniaPlansza = zapisG.Plansza; PlayerPrefs.SetFloat("PozX", zapisG.PlayerX); PlayerPrefs.SetFloat("PozY", zapisG.PlayerY); PlayerPrefs.SetFloat("PozZ", zapisG.PlayerZ); PlayerPrefs.SetInt("Wynik", zapisG.wynik); PlayerPrefs.SetInt("ILZY", zapisG.ilZycie); PlayerPrefs.SetString("NicK", zapisG.nick); PlayerPrefs.SetInt("PoziomTr", zapisG.poziomTr); PlayerPrefs.Save(); zapisGry.Close(); Time.timeScale = 1; klik_konty = true; if (OstatniaPlansza != 0) { SceneManager.LoadScene(OstatniaPlansza); } else { return; } } else { return; } } else { helpERROR.SetActive(true); menuInGame.SetActive(false); } }
public void PowrotDoMenu(string Menu) { BinaryFormatter Forma = new BinaryFormatter(); FileStream zapisGry = File.Create(Application.persistentDataPath + "/ZapisanaGra.d"); ZapisGry zapis = new ZapisGry(); zapis.Plansza = PlayerPrefs.GetInt("ZapisanaPlansza"); zapis.PlayerX = PlayerPrefs.GetFloat("PolX"); zapis.PlayerY = PlayerPrefs.GetFloat("PolY"); zapis.PlayerZ = PlayerPrefs.GetFloat("PolZ"); zapis.wynik = PlayerPrefs.GetInt("Wynik"); zapis.ilZycie = PlayerPrefs.GetInt("ILZY"); zapis.nick = PlayerPrefs.GetString("NicK"); zapis.poziomTr = PlayerPrefs.GetInt("PoziomTr"); Forma.Serialize(zapisGry, zapis); zapisGry.Close(); SceneManager.LoadScene(Menu); Time.timeScale = 1; }