Ejemplo n.º 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;
    }
Ejemplo n.º 2
0
    public void RepeatScene()
    {
        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);
        }
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        Time.timeScale = 1;

        UpgradeSystem upgrades = UpgradeSystem.Get();

        if (upgrades)
        {
            upgrades.CleanList();
        }
    }
Ejemplo n.º 3
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;
    }