Exemplo n.º 1
0
    private void Awake()
    {
        menu         = GameObject.Find("OptionsPopup");
        multiplayer  = GameObject.FindGameObjectWithTag("multiplayer");
        tutorial     = GameObject.FindGameObjectWithTag("tutorial");
        options      = GameObject.FindGameObjectWithTag("options");
        singlePlayer = GameObject.FindGameObjectWithTag("singleplayer");
        help         = GameObject.FindGameObjectWithTag("help");
        exit         = GameObject.FindGameObjectWithTag("exit");
        mute         = GameObject.Find("mute");
        unmute       = GameObject.Find("unmute");

        switchRight   = GameObject.Find("switchRight");
        switchLeft    = GameObject.Find("switchLeft");
        effectsSwitch = GameObject.Find("switch");
        offSwitch     = GameObject.Find("offSwitch");
        onSwitch      = GameObject.Find("onSwitch");

        music  = Music.getInstance();
        music2 = Music2.getInstance();


        if (Music.playSoundEffects)
        {
            offSwitch.GetComponent <Renderer> ().enabled = false;

            onSwitch.GetComponent <Renderer> ().enabled = true;

            effectsSwitch.transform.position = switchRight.transform.position;
            isMute = false;
        }
        else
        {
            offSwitch.GetComponent <Renderer> ().enabled = true;

            onSwitch.GetComponent <Renderer> ().enabled = false;

            effectsSwitch.transform.position = switchLeft.transform.position;
            isMute = true;
        }
    }
    private void Awake()
    {
        audioSource = GetComponent <AudioSource>();

        musicSwitchRight = GameObject.Find("musicSwitchRight");
        musicSwitchLeft  = GameObject.Find("musicSwitchLeft");
        switchMusic      = GameObject.Find("switchMusic");
        onSwitchMusic    = GameObject.Find("onSwitchMusic");
        offSwitchMusic   = GameObject.Find("offSwitchMusic");


        hintsSwitchRight = GameObject.Find("hintsSwitchRight");
        hintsSwitchLeft  = GameObject.Find("hintsSwitchLeft");
        switchHints      = GameObject.Find("switchHints");
        onSwitchHints    = GameObject.Find("onSwitchHints");
        offSwitchHints   = GameObject.Find("offSwitchHints");


        onSwitchHints.GetComponent <Renderer> ().enabled  = true;
        offSwitchHints.GetComponent <Renderer> ().enabled = false;
        switchHints.transform.position = hintsSwitchRight.transform.position;


        Music2 musicInstance = Music2.getInstance();

        if (OptionsPopup.isMute)
        {
            onSwitchMusic.GetComponent <Renderer> ().enabled  = false;
            offSwitchMusic.GetComponent <Renderer> ().enabled = true;
            switchMusic.transform.position = musicSwitchLeft.transform.position;
            //audioSource.volume = 0f;
        }
        else
        {
            onSwitchMusic.GetComponent <Renderer> ().enabled  = true;
            offSwitchMusic.GetComponent <Renderer> ().enabled = false;
            switchMusic.transform.position = musicSwitchRight.transform.position;
        }
    }