Example #1
0
 private void UpdateVolume(int volume)
 {
     if (volumeText != null)
     {
         volumeText.text = String.Format("Volume: {0}", volume);
         utilsPlugin.IncreaseMusicVolumeByValue(volume);
     }
 }
    void Start()
    {
#if UNITY_ANDROID
        if (Application.platform != RuntimePlatform.Android)
        {
            return;
        }

        textToSpeechPlugin.SetLocale(SpeechLocale.UK);

        if (Speech_Pitch_Slider != null &&
            Speech_Rate_Slider != null &&
            Speech_Volume_Slider != null)
        {
            all_control_slider_is_assigned = true;

            Speech_Pitch_Slider.maxValue = 2;
            Speech_Pitch_Slider.minValue = 0.1f;
            Speech_Pitch_Slider.value    = Speech_Pitch;

            Speech_Rate_Slider.maxValue = 2;
            Speech_Rate_Slider.minValue = 0.1f;
            Speech_Rate_Slider.value    = Speech_Rate;

            Speech_Volume_Slider.maxValue = 15;
            Speech_Volume_Slider.minValue = 0;
            Mathf.Clamp(Speech_Volume, 0, 15);
            Speech_Volume_Slider.value = Speech_Volume;
        }
        else
        {
            textToSpeechPlugin.SetPitch(Speech_Pitch);
            textToSpeechPlugin.SetSpeechRate(Speech_Rate);
            Mathf.Clamp(Speech_Volume, 0, 15);
            utilsPlugin.IncreaseMusicVolumeByValue(Speech_Volume); // 0 to 15, max 15
        }
#endif
    }