private void UpdateVolume(int volume)
 {
     if (volumeText != null)
     {
         volumeText.text = String.Format("Volume: {0}", volume);
         textToSpeechPlugin.IncreaseMusicVolumeByValue(volume);
     }
 }
Beispiel #2
0
    //set face data
    public void setFaceData(string json)
    {
        previousExpression = expression;
        JSONObject jsonObject = JSONObject.Parse(json);

        if (jsonObject != null)
        {
            try {
                volume     = (int)(jsonObject.GetValue("volume").Number);
                expression = (int)(jsonObject.GetValue("expression").Number);
                speech     = jsonObject.GetValue("speech").ToString();
                faceColor  = new Color((float)(jsonObject.GetValue("red").Number / 255f),
                                       (float)(jsonObject.GetValue("green").Number / 255f),
                                       (float)(jsonObject.GetValue("blue").Number / 255f));
                //textToSpeechPlugin.SetPitch(pitch); //(0-2)
                //textToSpeechPlugin.SetSpeechRate(speechRate); //(0-2)
                textToSpeechPlugin.IncreaseMusicVolumeByValue(volume); //(0-15)
                textToSpeechPlugin.SpeakOut(speech, "id");
                eyeBlend = 0f;
            } catch (Exception e) {
                Debug.LogException(e, this);
            }
        }
    }