Example #1
0
    void Start()
    {
        _anim = this.GetComponent <Animator>();

        if (_audioManager == null)
        {
            _audioManager = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <AudioManager>();
        }
        if (_popupManager == null)
        {
            _popupManager = GameObject.FindGameObjectWithTag("PopupManager").GetComponent <PopupManager>();
        }
        _ui = GameObject.FindGameObjectWithTag("GameCanvas").GetComponent <UIModes>();

        if (!cassetteOverride)
        {
            if (cassetteFound == null)
            {
                _cassetteColor = new Color(0, 0, 0, 0);
            }
            else
            {
                _cassetteColor = new Color(cassetteFound.color.r, cassetteFound.color.g, cassetteFound.color.b, 1f);
            }
        }
    }
    public void SwitchUIMode(int uiMode)
    {
        UIModes selectedMode = (UIModes)uiMode;

        switch (selectedMode)
        {
        case UIModes.Start:

            GameManager.Instance.StartGame();
            LevelGenerator.Instance.GenerateLevel();
            LevelGenerator.Instance.GenerateBottomPlatforms();



            gameplayScreen.SetActive(true);

            pauseMenuScreen.SetActive(false);
            mainMenuScreen.SetActive(false);

            break;

        case UIModes.MainMenu:

            GameManager.Instance.FinishGame();
            GameManager.Instance.ResumeGame();

            mainMenuScreen.SetActive(true);

            gameplayScreen.SetActive(false);
            pauseMenuScreen.SetActive(false);

            break;

        case UIModes.Pause:

            GameManager.Instance.PauseGame();

            pauseMenuScreen.SetActive(true);

            break;

        case UIModes.Resume:

            GameManager.Instance.ResumeGame();

            pauseMenuScreen.SetActive(false);

            break;

        case UIModes.Backgrounds:

            backgroundsScreen.SetActive(true);

            break;

        case UIModes.Settings:

            settingsScreen.SetActive(true);

            break;

        case UIModes.About:

            aboutScreen.SetActive(true);

            break;

        case UIModes.GameOver:

            gameOverScreen.SetActive(true);

            break;

        case UIModes.DisableSecondary:

            backgroundsScreen.SetActive(false);
            settingsScreen.SetActive(false);
            gameOverScreen.SetActive(false);
            aboutScreen.SetActive(false);

            break;

        case UIModes.Exit:

            Application.Quit();

            break;
        }
    }