Пример #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);
    }
Пример #2
0
    void Start()
    {
        hControllerScriptCS = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));
        uicControls         = (UICheckbox)this.GetComponent(typeof(UICheckbox));

        //check which radio button is this
        if (this.name == "Swipe")
        {
            controlType = ControllerScriptCS.ControlType.Swipe;
        }
        else
        {
            controlType = ControllerScriptCS.ControlType.Gyro;
        }

        //check or uncheck according to type of controls currently enabled
        if (controlType == ControllerScriptCS.ControlType.Swipe)
        {
            if (hControllerScriptCS.isSwipeControlEnabled())
            {
                uicControls.isChecked = true;
            }
            else
            {
                uicControls.isChecked = false;
            }
        }
        else if (controlType == ControllerScriptCS.ControlType.Gyro)
        {
            if (!hControllerScriptCS.isSwipeControlEnabled())
            {
                uicControls.isChecked = true;
            }
            else
            {
                uicControls.isChecked = false;
            }
        }
    }    //end of start