示例#1
0
    public static void InstantiateLoadingScreen()
    {
        // If there isn't a LoadingScreen, then create a new one
        if (instance == null)
        {
            instance = Instantiate(Resources.Load <GameObject>(prefabName)).GetComponent <LO_LoadingScreen>();
            // Don't destroy loading screen while it's loading
            DontDestroyOnLoad(instance.gameObject);
        }

        // Enable loading screen
        instance.gameObject.SetActive(true);
    }
示例#2
0
    // Load a new scene
    public static void LoadScene(string sceneName)
    {
        // If there isn't a LoadingScreen, then create a new one
        instance = Instantiate(Resources.Load <GameObject>(prefabName)).GetComponent <LO_LoadingScreen>();
        // Don't destroy loading screen while it's loading
        DontDestroyOnLoad(instance.gameObject);

        // Enable loading screen
        instance.gameObject.SetActive(true);
        // Start loading between scenes
        instance.loadingProcess = SceneManager.LoadSceneAsync(sceneName);
        // Don't allow scene switching
        instance.loadingProcess.allowSceneActivation = false;
    }
示例#3
0
 private void OnTriggerExit(Collider other)
 {
     if (onlyLoadWithTag == true && onTriggerExit == true)
     {
         if (other.gameObject.tag == objectTag)
         {
             LO_LoadingScreen.prefabName = prefabToLoad;
             LO_LoadingScreen.LoadScene(sceneName);
         }
     }
     else if (onTriggerExit == true)
     {
         LO_LoadingScreen.prefabName = prefabToLoad;
         LO_LoadingScreen.LoadScene(sceneName);
     }
 }
示例#4
0
    // Load a new scene
    public static void LoadScene(string sceneName)
    {
        // If there isn't a LoadingScreen, then create a new one
        if (instance == null)
        {
            instance = Instantiate(Resources.Load <GameObject>(prefabName)).GetComponent <LO_LoadingScreen>();
            // Don't destroy loading screen while it's loading
            DontDestroyOnLoad(instance.gameObject);
        }

        // Enable loading screen
        instance.gameObject.SetActive(true);
        // Start loading between scenes (Background process. That's why there is an Async)
        instance.loadingProcess = SceneManager.LoadSceneAsync(sceneName);
        // Don't switch scene even after loading is completed
        instance.loadingProcess.allowSceneActivation = false;
    }
示例#5
0
 public static void LauchPreloader()
 {
     LO_LoadingScreen.prefabName = s_instance.m_PreloadPrefab;
     LO_LoadingScreen.LoadScene(s_instance.m_SceneToLoad);
 }
示例#6
0
 public void ChangeToScene(string sceneName)
 {
     LO_LoadingScreen.LoadScene(sceneName);
 }
示例#7
0
 public void HideScreen()
 {
     LO_LoadingScreen.HideScreen();
 }
示例#8
0
 public void LoadLooader()
 {
     LO_LoadingScreen.InstantiateLoadingScreen();
 }