示例#1
0
    public void ForcedChangeScene()
    {
        if (SceneManager.GetActiveScene().name == "Gameplay")
        {
            Destroy(GameManager.Get().gameObject);
            Destroy(WaveSystem.Get().gameObject);
            Destroy(TurretSpawner.Get().gameObject);
            Destroy(Highscore.Get().gameObject);
            Destroy(MilestoneManager.Get().gameObject);

            UpgradeSystem upgrades = UpgradeSystem.Get();

            if (upgrades)
            {
                upgrades.CleanList();
            }
        }
        else if (SceneManager.GetActiveScene().name == "Upgrade Screen")
        {
            AkSoundEngine.StopAll();
        }



        if (sceneName == "Gameplay")
        {
            AkSoundEngine.StopAll();
            UpgradeSystem upgrades = UpgradeSystem.Get();

            if (upgrades)
            {
                upgrades.CleanList();
            }

            LoaderManager.Get().LoadScene(sceneName);
            UILoadingScreen.Get().SetVisible(true);
        }
        else if (sceneName == "Upgrade Screen")
        {
            AkSoundEngine.StopAll();

            UpgradeSystem upgrades = UpgradeSystem.Get();

            if (upgrades)
            {
                upgrades.CleanList();
            }

            SceneManager.LoadScene(sceneName);
        }
        else
        {
            SceneManager.LoadScene(sceneName);
        }

        Time.timeScale = 1;
    }
示例#2
0
 public void NextLvl()
 {
     level++;
     LoaderManager.Get().LoadScene("GameScene");
     UILoadingScreen.Get().SetVisible(true);
     landingScreen.SetActive(false);
     winText.gameObject.SetActive(false);
     loseText.gameObject.SetActive(false);
     next.onClick.RemoveAllListeners();
 }
示例#3
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
         return;
     }
     instance = this;
     DontDestroyOnLoad(gameObject);
     instance.SetVisible(false);
 }
 public void GoToThisScene()
 {
     if (sceneName == "Level")
     {
         LoaderManager.Get().LoadScene(sceneName);
         UILoadingScreen.Get().SetVisible(true);
     }
     else
     {
         SceneManager.LoadScene(sceneName);
     }
 }
    public void GoToThisScene()
    {
        switch (sceneName)
        {
        case "Level1":
            BGMMenu.Get().stopMenuMusic();
            LoaderManager.Get().LoadScene(sceneName);
            UILoadingScreen.Get().SetVisible(true);
            break;

        case "Level2":
            BGMMenu.Get().stopMenuMusic();
            LoaderManager.Get().LoadScene(sceneName);
            UILoadingScreen.Get().SetVisible(true);
            break;

        case "GameOver":
            SceneManager.LoadScene(sceneName);
            break;

        case "Menu":
            if (SceneManager.GetActiveScene().name == "GameOver")
            {
                BGMMenu.Get().playMenuMusic();
            }
            SceneManager.LoadScene(sceneName);
            break;

        case "Controls":
            SceneManager.LoadScene(sceneName);
            break;

        case "Credits":
            SceneManager.LoadScene(sceneName);
            break;

        default:
            if (isLevelRestartButton)
            {
                SceneManager.LoadScene(SaveLastLevel.Get().loadLevelName());
            }
            else
            {
                SceneManager.LoadScene(sceneName);
            }
            break;
        }
    }
    IEnumerator AsynchronousLoad(string scene)
    {
        if (loadingProgress == 0)
        {
            ao = SceneManager.LoadSceneAsync(scene);
            ao.allowSceneActivation = false;
        }

        while (!ao.isDone)
        {
            timeLoading    += Time.deltaTime;
            loadingProgress = ao.progress + 1.0f;

            if (fakeLoad && !instantChange)
            {
                loadingProgress = loadingProgress * timeLoading / minTimeToLoad;
            }


            // Loading completed
            if (loadingProgress >= 1)
            {
                loadingProgress = 1;

                if (!doOnce)
                {
                    if (OnFullyLoadLevel != null)
                    {
                        OnFullyLoadLevel();
                    }

                    doOnce = true;
                }

                if (acceptLoad)
                {
                    ao.allowSceneActivation = true;
                    Destroy(UILoadingScreen.Get().gameObject);
                    Destroy(gameObject);
                }
            }

            yield return(null);
        }
    }
示例#7
0
 public void GoToLevel()
 {
     if (savedStatus.isPlayerAlive)
     {
         savedStatus.level++;
         if (savedStatus.level > maxLevels)
         {
             SceneManager.LoadScene("Menu");
         }
         else
         {
             LoaderManager.Get().LoadScene("Level" + (savedStatus.level));
             UILoadingScreen.Get().SetVisible(true);
         }
     }
     else
     {
         LoaderManager.Get().LoadScene("Level" + savedStatus.level);
         UILoadingScreen.Get().SetVisible(true);
     }
 }
    public void Initialize(Action <bool> initializationCallback = null)
    {
        bool success = true;

        if (_loadingScreen == null)
        {
            UIObject uiObject = UIManager.Instance.CreateNewUIObject(LoadingScreenPrefabId, UILayerId.Overlay);
            _loadingScreen = uiObject as UILoadingScreen;
            if (_loadingScreen == null)
            {
                CustomLogger.Error(nameof(LoadingScreenController), $"Could not retrieve loading screen prefab with id {LoadingScreenPrefabId}");
                success = false;
            }
            else
            {
                _loadingScreen.OnShowComplete += ShowLoadingScreenComplete;
                _loadingScreen.OnHideComplete += HideLoadingScreenComplete;
                _loadingScreen.HideInstant();
            }
        }
        initializationCallback?.Invoke(success);
    }
    public void ChangeScene()
    {
        if (hasLoadingScreen)
        {
            LoaderManager.Get().LoadScene(sceneToChange);
            UILoadingScreen.Get().SetVisible(true);

            if (GameManager.Get())
            {
                Destroy(GameManager.Get().gameObject);
            }
        }
        else
        {
            if (GameManager.Get())
            {
                Destroy(GameManager.Get().gameObject);
            }

            SceneManager.LoadScene(sceneToChange);
        }
    }
    public void ChangeScene()
    {
        if (sceneName == "")
        {
            sceneName = SceneManager.GetActiveScene().name;
        }

        Time.timeScale = 1;

        if (isALevel)
        {
            if (assignLevelNumber)
            {
                PlayerStatusSave.Get().level = levelNumber;
            }

            LoaderManager.Get().LoadScene(sceneName);
            UILoadingScreen.Get().SetVisible(true);
        }
        else
        {
            SceneManager.LoadScene(sceneName);
        }
    }
示例#11
0
    public void ChangeScene()
    {
        if (SceneManager.GetActiveScene().name == "Gameplay")
        {
            Destroy(GameManager.Get().gameObject);
            Destroy(WaveSystem.Get().gameObject);
            Destroy(TurretSpawner.Get().gameObject);
            Destroy(Highscore.Get().gameObject);
            Destroy(MilestoneManager.Get().gameObject);

            UpgradeSystem upgrades = UpgradeSystem.Get();

            if (upgrades)
            {
                upgrades.CleanList();
            }

            AkSoundEngine.StopAll();
        }
        else if (SceneManager.GetActiveScene().name == "Upgrade Screen")
        {
            AkSoundEngine.StopAll();
        }

        if (sceneName == "Upgrade Screen")
        {
            AkSoundEngine.StopAll();

            UpgradeSystem upgrades = UpgradeSystem.Get();

            if (upgrades)
            {
                upgrades.CleanList();
            }

            int goToTutorial = PlayerPrefs.GetInt("isFirstTimePlaying", 1);

            if (goToTutorial == 1)
            {
                SceneManager.LoadScene("Tutorial");
            }
            else if (goToTutorial == 0)
            {
                SceneManager.LoadScene(sceneName);
            }
        }
        else if (sceneName == "Gameplay")
        {
            AkSoundEngine.StopAll();
            UpgradeSystem upgrades = UpgradeSystem.Get();

            if (upgrades)
            {
                upgrades.CleanList();
            }

            int goToTutorial = PlayerPrefs.GetInt("isFirstTimePlaying", 1);

            if (goToTutorial == 1)
            {
                SceneManager.LoadScene("Tutorial");
            }
            else if (goToTutorial == 0)
            {
                LoaderManager.Get().LoadScene(sceneName);
                UILoadingScreen.Get().SetVisible(true);
            }
        }
        else
        {
            SceneManager.LoadScene(sceneName);
        }

        Time.timeScale = 1;
    }
示例#12
0
 void Start()
 {
     UILoadingScreen.Get().SetVisible(false);
 }
示例#13
0
 public void GoToLevel2()
 {
     LoaderManager.Get().LoadScene("Level2");
     UILoadingScreen.Get().SetVisible(true);
 }
示例#14
0
 void GoToGameScene()
 {
     LoaderManager.Get().LoadScene("GameScene");
     UILoadingScreen.Get().SetVisible(true);
 }
示例#15
0
 public void LoadNextLevel()
 {
     LoaderManager.Get().LoadScene("Menu");
     UILoadingScreen.Get().SetVisible(true);
 }