示例#1
0
    // Load specific level
    public IEnumerator LoadLevel()
    {
        // Display loading screen and start to load level
        loadingScreen.SetActive(true);
        LoadingManager.LoadLevel();

        // Update loading bar value
        while (LoadingManager.GetLoadProgress() < 0.5f)
        {
            loadingBar.value = LoadingManager.GetLoadProgress();
            //Debug.Log(loadingBar.value + " " + LoadingManager.GetLoadProgress());
            yield return(null);
        }

        // Hide loading screen (and hud if title) and set the timescale to 1
        loadingScreen.SetActive(false);
        if (LoadingManager.levelToLoad == "Title")
        {
            HUD.SetActive(false);
        }
        else
        {
            HUD.SetActive(true);
        }
        Time.timeScale = 1f;
    }