void Start()
 {
     this.scoreText.text = GameController.instance.GetComponent <GameController>().playerScore.ToString() + " Pontos";
     this.gameoverLine   = "Fim de Jogo. Você marcou " + this.scoreText.text + ". Clique na tela uma vez para retornar ao menu inicial, ou utilize um clique duplo para iniciar uma nova partida.";
     textToSpeechPlugin.SpeakOut(this.gameoverLine, "gameoverspeech");
     StartCoroutine(repeatTTS(18.0f));
 }
Example #2
0
    private IEnumerator repeatTTS(float waitTime)
    {
        yield return(new WaitForSeconds(waitTime));

        textToSpeechPlugin.SpeakOut(this.introLine, "introspeech");
        StartCoroutine(repeatTTS(15.0f));
    }
    private void onResults(string data)
    {
        if (resultText != null)
        {
            string[] results = data.Split(',');
            Debug.Log(" result length " + results.Length);

            //when you set morethan 1 results index zero is always the closest to the words the you said
            //but it's not always the case so if you are not happy with index zero result you can always
            //check the other index

            //sample on checking other results
            foreach (string possibleResults in results)
            {
                Debug.Log(" possibleResults " + possibleResults);
            }

            //sample showing the nearest result
            string whatToSay   = results.GetValue(0).ToString();
            string utteranceId = "test-utteranceId";
            resultText.text = string.Format("Result: {0}", whatToSay);

            //check if Text to speech has initialized
            if (hasInit)
            {
                //Text To Speech Sample Usage
                textToSpeechPlugin.SpeakOut(whatToSay, utteranceId);
            }
        }
    }
Example #4
0
 public void SpeakTTS(string whatToSay)
 {
     if (textToSpeechPlugin.isInitialized())
     {
         utilsPlugin.UnMuteBeep();
         textToSpeechPlugin.SpeakOut(whatToSay, "null");
     }
 }
 // Use this for initialization
 void Start()
 {
     this.tutorialLine += " Para facilitar nossa navegação dividi o espaço manobrável à nossa frente em três regiões: Esquerda, Direita e Centro. A aproximação dos asteroides será representada por sons, um asteroide se aproximando pela região esquerda será representado por um som à sua esquerda, um asteroide que se aproxima pela região da direita será representado por um som à sua direita e um asteroide vindo diretamente de frente será representado por um som nos dois canais simultâneamente.";
     this.tutorialLine += " Para mover a nave para a esquerda ou para a direita basta tocar na sua tela na metade esquerda ou direita, respectivamente. Se a tela não registrar nenhum toque a nave irá automaticamente retornar para a posição central. Para ajuda-lo a manter a referência de nosso posicionamento os sons são sempre reproduzidos independentemente da posição atual da nave, portanto um som à direita sempre representará um asteroide se aproximando pela região da direita e respectivamente para as demais regiões.";
     this.tutorialLine += " Nossos escudos são capazes de absorver quatro impactos de asteróides, mas qualquer impacto depois disso destruirá a nave. Os escudos são capazes de se recuperar com o tempo, então procure manter a calma depois de atingido para evitar impactos consecutivos que podem acarretar na destruição da nave";
     this.tutorialLine += " Por quanto mais tempo você nos mantiver voando, mais informações serei capaz de enviar aos nossos aliados, por outro lado o campo de asteróides se torna mais denso e mais perigoso a medida que viajamos dentro dele. Boa sorte capitão, pilote como nunca, a rebelião depende de você!";
     textToSpeechPlugin.SpeakOut(this.tutorialLine, "tutorialspeech");
     StartCoroutine(endTutorial(150.0f));
 }
    private void Talk(string _sting)
    {
        string utteranceId = "test-utteranceId";

        if (textToSpeechPlugin.isInitialized())
        {
            // un mute volume
            utilsPlugin.UnMuteBeep();
            textToSpeechPlugin.SpeakOut(_sting, utteranceId);
        }
    }
    public void SpeakOut()
    {
        if (inputField != null)
        {
            string whatToSay   = inputField.text;
            string utteranceId = "test-utteranceId";

            if (textToSpeechPlugin.isInitialized())
            {
                UpdateStatus("Trying to speak...");
                Debug.Log("[TextToSpeechDemo] SpeakOut whatToSay: " + whatToSay + " utteranceId " + utteranceId);
                textToSpeechPlugin.SpeakOut(whatToSay, utteranceId);
            }
        }
    }
Example #8
0
    public void SpeakOut()
    {
        if (inputField != null)
        {
            string whatToSay   = inputField.text;
            string utteranceId = "test-utteranceId";

            if (textToSpeechPlugin.isInitialized())
            {
                // un mute volume
                utilsPlugin.UnMuteBeep();

                UpdateStatus("Trying to speak...");
                Debug.Log(TAG + "SpeakOut whatToSay: " + whatToSay + " utteranceId " + utteranceId);
                textToSpeechPlugin.SpeakOut(whatToSay, utteranceId);
            }
        }
    }
Example #9
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);
            }
        }
    }