Exemplo n.º 1
0
    // this method start to load the new scene and update loading bar
    IEnumerator LoadLevelAsync(int levelIndex)
    {
        isChangingScene = true;
        transition.SetTrigger("Start");
        yield return(new WaitForSeconds(transitionTime));

        slider.gameObject.SetActive(true);
        PlayerSaveSystem.Save();

        AsyncOperation operation = SceneManager.LoadSceneAsync(levelIndex);

        while (!operation.isDone)
        {
            float progress = Mathf.Clamp01(operation.progress / .9f);
            slider.value = progress;

            yield return(null);
        }
    }
Exemplo n.º 2
0
 //New game starts a new game. It will overwrite the old saves.
 public void NewGame()
 {
     PlayerSaveSystem.Save();    // I reset the savedata, if there is one (Thomas)
     LevelLoader.instance.LoadLevel(GlobalVariables.HUB_SCENE);
 }