示例#1
0
    //sends the player to the audio options
    public void Audio()
    {
        if (!isPlaying)
        {//checking if an animation is playing before accessing another menu
            isPlaying    = true;
            _audio.pitch = 1.2f;
            _audio.PlayOneShot(select, SFXvolume);
            curMenu = CurMenu.Audio;
            //setting all the text to their current values
            Text myText = GameObject.Find("Canvas/Pause/Menus/AudioMenus/BGMValue").GetComponent <Text>();
            myText.text = (BGMvolume * 10).ToString();
            myText      = GameObject.Find("Canvas/Pause/Menus/AudioMenus/SFXValue").GetComponent <Text>();
            myText.text = (SFXvolume * 10).ToString();
            if (PlayerPrefs.HasKey("audioSettings"))
            {
                myText      = GameObject.Find("Canvas/Pause/Menus/AudioMenus/Audio").GetComponent <Text>();
                myText.text = audioSettings.ToString();
            }
            Slider myslider = GameObject.Find("Canvas/Pause/Menus/AudioMenus/SFXVolume/Slider").GetComponent <Slider>();
            myslider.value = (int)(SFXvolume * 10);
            myslider       = GameObject.Find("Canvas/Pause/Menus/AudioMenus/BGMVolume/Slider").GetComponent <Slider>();
            myslider.value = (int)(BGMvolume * 10);

            menusAnim.Play("CloseOptions");
            StartCoroutine(MyCoroutine(menusAnim.GetCurrentAnimatorStateInfo(0).length, "OpenAudio"));
        }
    }