Beispiel #1
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.name == "The Explorer")
     {
         //SceneManager.LoadScene(1, LoadSceneMode.Additive);
         other.gameObject.transform.position = moveTo;
         Expedition.EnterTitleScreenState();
     }
 }
Beispiel #2
0
    public IEnumerator LoadAsyncScene(int sceneIndex)
    {
        if (!SceneManager.GetSceneByBuildIndex(sceneIndex).isLoaded)
        {
            Expedition.BiomeTransition(sceneIndex);
            Expedition.UserInterface.loadingIndicator.SetActive(true);
            loaderIsRunning = true;

            AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneIndex, LoadSceneMode.Additive);
            asyncLoad.completed += (asyncOperation) => {
                loaderIsRunning = false;
                Expedition.UserInterface.loadingIndicator.SetActive(false);
                try {
                    SceneManager.SetActiveScene(SceneManager.GetSceneByBuildIndex(sceneIndex));
                    if (emergency)
                    {
                        Expedition.Player.gameObject.transform.position = aihf;
                        Expedition.EnterTitleScreenState();
                    }
                }
                catch (Exception e) { Debug.LogException(e); }
                if (!_isA)
                {
                    _ACollider.isTrigger = true;
                }
                else
                {
                    _BCollider.isTrigger = true;
                }
            };
            if (!asyncLoad.isDone)
            {
                loaderIsRunning = true;
                yield return(null);
            }
        }
        else
        {
            Debug.Log("Scene '" + sceneIndex + "' is already loaded!");
        }
    }