Exemplo n.º 1
0
    void OnClick()
    {
        hInGameScriptCS.launchGame();                                 //start the gameplay

        hNGUIMenuScript.NGUIMenuScriptEnabled(false);                 //turn off the NGUI Menu Script (to improve performance)
        NGUITools.SetActive(this.transform.parent.gameObject, false); //close/ disable the current menu
    }
Exemplo n.º 2
0
    void Update()
    {
        if (iMenuStatus == 0)           //normal gameplay
        {
            ;
        }
        else if (iMenuStatus == 1)        //display main menu and pause game
        {
            if (isCustomMenuEnabled())
            {
                hMenuScriptCS.setMenuScriptStatus(true);
            }
            else
            {
                hNGUIMenuScript.NGUIMenuScriptEnabled(true);
            }

            bGamePaused = true;
            iMenuStatus = 2;
        }

        //Pause GamePlay
        if (iPauseStatus == 1)       //pause game
        {
            if (isCustomMenuEnabled())
            {
                hMenuScriptCS.setMenuScriptStatus(true);
                hMenuScriptCS.displayPauseMenu();
            }
            else
            {
                hNGUIMenuScript.NGUIMenuScriptEnabled(true);
                hNGUIMenuScript.ShowMenu(NGUIMenuScript.NGUIMenus.PauseMenu);
            }

            iPauseStatus = 2;
        }
        else if (iPauseStatus == 3)     //resume game
        {
            if (isCustomMenuEnabled())
            {
                hMenuScriptCS.setMenuScriptStatus(false);
            }
            else
            {
                hNGUIMenuScript.NGUIMenuScriptEnabled(false);
            }

            bGamePaused  = false;
            iPauseStatus = 0;
        }

        if (iDeathStatus == 1)                                 //call death menu
        {
            hPowerupsMainControllerCS.deactivateAllPowerups(); //deactivate if a powerup is enabled

            iDeathStatus = 2;
        }
        else if (iDeathStatus == 2)
        {
            if (isCustomMenuEnabled())            //if custom menu is in use
            {
                hMenuScriptCS.setMenuScriptStatus(true);
                hMenuScriptCS.displayGameOverMenu(); //display the Game Over menu
            }
            else                                     //if NGUI menu is in use
            {
                hNGUIMenuScript.NGUIMenuScriptEnabled(true);
                hNGUIMenuScript.ShowMenu(NGUIMenuScript.NGUIMenus.GameOverMenu);
            }

            iDeathStatus = 0;
        }

        if (bGamePaused == true)
        {
            return;
        }
    }    //end of Update()