Example #1
0
    public void AssignData()
    {
        titleUI.text = milestone.objectiveText;

        switch (milestone.type)
        {
        case MilestoneScriptableObject.MilestoneType.Score:
            CheckScoreType();
            break;

        case MilestoneScriptableObject.MilestoneType.EnemiesKilled:
            CheckEnemiesKilledType();
            break;

        case MilestoneScriptableObject.MilestoneType.TowersPlaced:
            CheckTowersPlacedType();
            break;

        case MilestoneScriptableObject.MilestoneType.TimesEscaped:
            CheckTimesEscapedType();
            break;

        case MilestoneScriptableObject.MilestoneType.GemsCollected:
            CheckGemsCollectedType();
            break;

        default:
            break;
        }

        MilestoneManager.Get().allMilestones.Add(this);
        MilestoneManager.Get().currentMilestonesTotal++;
    }
Example #2
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;
    }
Example #3
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();
        }
    }
Example #4
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;
    }
Example #5
0
    // Update is called once per frame
    private void Update()
    {
        if (milestone.isActive)
        {
            if (!milestone.isDone)
            {
                switch (milestone.type)
                {
                case MilestoneScriptableObject.MilestoneType.Score:
                    CheckScoreType();
                    break;

                case MilestoneScriptableObject.MilestoneType.EnemiesKilled:
                    CheckEnemiesKilledType();
                    break;

                case MilestoneScriptableObject.MilestoneType.TowersPlaced:
                    CheckTowersPlacedType();
                    break;

                case MilestoneScriptableObject.MilestoneType.TimesEscaped:
                    CheckTimesEscapedType();
                    break;

                case MilestoneScriptableObject.MilestoneType.GemsCollected:
                    CheckGemsCollectedType();
                    break;

                case MilestoneScriptableObject.MilestoneType.WavesSurvived:
                    CheckWavesSurvivedType();
                    break;

                case MilestoneScriptableObject.MilestoneType.DistanceTravelled:
                    CheckDistanceTravelledType();
                    break;

                default:
                    break;
                }
            }
            else
            {
                if (!doOnce)
                {
                    MilestoneManager.Get().milestonesToMove.Add(this);
                    MilestoneManager.Get().canSwitch = true;

                    if (!milestone.hasGivenReward)
                    {
                        GameManager.Get().upgradePointsCurrentMatch += milestone.rewardPoints;
                        milestone.hasGivenReward = true;
                        if (OnMilestoneDone != null)
                        {
                            OnMilestoneDone();
                        }
                    }

                    progressTextUI.text = "Done!";
                    progressBar.value   = 1;
                    doOnce = true;
                }
            }
        }
    }