Example #1
0
    /*
     *	FUNCTION: Set the menu to show in front of the HUD Camera
     */
    public void ShowMenu(int index)
    {
        if ((int)MenuIDs.SettingsMenu == index)
        {
            //check which type of controls are active and
            //set the appropriate radio button
            if (hControllerScriptCS.isSwipeControlEnabled())
            {
                mrSwipeControls.enabled = true;
                mrGyroControls.enabled  = false;
            }
            else
            {
                mrSwipeControls.enabled = false;
                mrGyroControls.enabled  = true;
            }

            //check if the music is enabled or disabled and
            //set the appropriate radio button
            if (hSoundManagerScriptCS.isMusicEnabled())
            {
                mrMusicON.enabled  = true;
                mrMusicOFF.enabled = false;
            }
            else
            {
                mrMusicON.enabled  = false;
                mrMusicOFF.enabled = true;
            }

            //check if the sound is ON or OFF and se the
            //appropriate radio button
            if (hSoundManagerScriptCS.isSoundEnabled())
            {
                mrSoundON.enabled  = true;
                mrSoundOFF.enabled = false;
            }
            else
            {
                mrSoundON.enabled  = false;
                mrSoundOFF.enabled = true;
            }
        }
        else if ((int)MenuIDs.MissionsMenu == index)        //display mission menu
        {
            hMissionsControllerCS.updateMenuDescriptions(); //list the mission on the missions menu
        }
        tMenuTransforms[index].position = new Vector3(tMenuTransforms[index].position.x,
                                                      0, tMenuTransforms[index].position.z); //move the menu in front of the HUD Camera

        CurrentMenu = index;                                                                 //set the current menu
        hideHUDElements();                                                                   //hide the HUD
        hSoundManagerScriptCS.playSound(SoundManagerCS.MenuSounds.ButtonTap);
    }
Example #2
0
    private State state;    //if the music is ON of OFF

    void Start()
    {
        hSoundManagerCS = (SoundManagerCS)GameObject.Find("SoundManager").GetComponent(typeof(SoundManagerCS));
        uicMusic        = (UICheckbox)this.GetComponent(typeof(UICheckbox));

        //check if the script is a part of On or Off radio button
        if (this.name == "On")
        {
            state = State.On;
        }
        else
        {
            state = State.Off;
        }

        //set the Music radio button to On or Off
        if (state == State.On)
        {
            if (hSoundManagerCS.isMusicEnabled())
            {
                uicMusic.isChecked = true;
            }
            else
            {
                uicMusic.isChecked = false;
            }
        }
        else if (state == State.Off)
        {
            if (!hSoundManagerCS.isMusicEnabled())
            {
                uicMusic.isChecked = true;
            }
            else
            {
                uicMusic.isChecked = false;
            }
        }
    }    //end of Start()