Пример #1
0
    private void SetDefaultValues()
    {
        optionCanvas.GetComponent <Canvas>().sortingOrder  = -1;
        upgradeCanvas.GetComponent <Canvas>().sortingOrder = -1;
        evSystem.SetSelectedGameObject(mainStartButton);
        var sliders = optionCanvas.gameObject.GetComponentsInChildren <Slider>();

        foreach (var slider in sliders)
        {
            if (slider.name == "Sld_MusicVol")
            {
                slider.value = prefsControl.GetMusicVolume();
            }
            else if (slider.name == "Sld_SFXVol")
            {
                slider.value = prefsControl.GetSfXVolume();
            }
        }
        var toggles = optionCanvas.gameObject.GetComponentsInChildren <Toggle>();

        foreach (var toggle in toggles)
        {
            if (toggle.name == "Tog_AutoFire")
            {
                toggle.isOn = prefsControl.GetAutoFire();
            }
            else if (toggle.name == "Tog_Accelerometer")
            {
                toggle.isOn = prefsControl.GetAccelerometer();
            }
        }
    }
Пример #2
0
 void Start()
 {
     audio        = GetComponent <AudioSource>();
     playerPrefs  = FindObjectOfType <PlayerPrefsControlScript>();
     audio.volume = playerPrefs.GetMusicVolume();
 }