public void ReturnToMainMenu()
 {
     Time.timeScale = 1;
     SaveDataManagement.SaveState();
     Item.ResetNumInstance();
     SceneManager.LoadScene("MainMenu");
 }
    public void LoadNextLevel()
    {
        SaveDataManagement.SaveState();
        Item.ResetNumInstance();
        Time.timeScale = 1;
        int sceneIndex = SceneManager.GetActiveScene().buildIndex + 1;

        SceneManager.LoadScene(sceneIndex);
    }
    public void Restart()
    {
        Time.timeScale = 1;
        SaveDataManagement.SaveState();
        Item.ResetNumInstance();
        int sceneIndex = SceneManager.GetActiveScene().buildIndex;

        SceneManager.LoadScene(sceneIndex);
    }
Exemplo n.º 4
0
    private void DoWinEvent()
    {
        if (Time.timeScale != 0)
        {
            SaveDataManagement.SaveState();

            //show fail UI
            uiManager.ShowWinUI();

            //pause game
            Time.timeScale = 0;
            Item.ResetNumInstance();
        }
    }
 public void ShowWinUI()
 {
     SaveDataManagement.SaveState();
     winUI_Instance = Instantiate(winUI_Prefab, GameObject.FindWithTag("UI").transform);
 }
 public void ResetProgress()
 {
     SaveDataManagement.ResetProgress();
 }
 public void ExitGame()
 {
     SaveDataManagement.SaveState();
     Application.Quit();
 }
 public void LoadScene(string sceneName)
 {
     Time.timeScale = 1;
     SaveDataManagement.SaveState();
     SceneManager.LoadScene(sceneName);
 }
Exemplo n.º 9
0
    /// <summary>
    /// Saves player stats frequently.
    /// </summary>
    /// <param name="saveFrequency">The frequency of saving.</param>
    /// <returns></returns>
    private IEnumerator DoSave(int saveFrequency)
    {
        yield return(new WaitForSeconds(saveFrequency));

        SaveDataManagement.SaveState();
    }