Exemple #1
0
    public void OnButtonPress(string type)
    {
        if (type == "start")
        {
            if (MainMenuBtn.confirmNew)
            {
                // Reset all global values and switch to first scene
                GlobalControl.canContinue = true;
                GlobalControl.resetPlayer();
                GlobalControl.resetObjects();
                GlobalControl.respawnAll();

                StartCoroutine(SceneSwitch("Start_"));
            }
            else
            {
                MainMenuBtn.confirmNew = true;
            }
        }
        else if (type == "continue")
        {
            if (GlobalControl.canContinue)
            {
                StartCoroutine(SceneSwitch2(GlobalControl.prevArea));
            }
        }
        else if (type == "controls")
        {
            MainMenuBtn.inControl = true;
        }
        else if (type == "trophy")
        {
            MainMenuBtn.inTrophy = true;
        }
        else if (type == "exit")
        {
            MainMenuBtn.confirmNew = false;
            MainMenuBtn.inControl  = false;
            MainMenuBtn.inTrophy   = false;
        }
    }