public override void Hide() { #if !UNITY_EDITOR && UNITY_ANDROID EasyTTSUtil.StopSpeech(); #endif m_UI.Hide(); }
public static void UpdatePieceWiseStep() { if (piecewise == true) { GameObject[] elementList = GameObject.FindGameObjectsWithTag("DiagramElement"); if (piecewiseStep < elementList.Length) { elementList [piecewiseStep].GetComponent <DiagramElementOBJ> ().enabled = true; elementList [piecewiseStep].SetActive(true); EasyTTSUtil.StopSpeech(); if (piecewiseStep == 0) { EasyTTSUtil.SpeechAdd(diagramTitle + ", Loaded, " + elementList [piecewiseStep].GetComponent <DiagramElementOBJ> ().elementLabel + "."); } else if (elementList [piecewiseStep].GetComponent <DiagramElementOBJ> ().elementLabel != "Label") { EasyTTSUtil.SpeechAdd(", Loaded, " + elementList [piecewiseStep].GetComponent <DiagramElementOBJ> ().elementLabel + "."); } piecewiseStep++; } else { EasyTTSUtil.StopSpeech(); EasyTTSUtil.SpeechAdd("All Elements Loaded"); } } }
void OnGUI() { GUI.BeginGroup(new Rect(Screen.width / 2 - 250, Screen.height / 2 - 250, 1000, 1000)); GUI.Box(new Rect(0, 0, 500, 450), "EasyTTS Demo"); stringToEdit = GUI.TextField(new Rect(30, 30, 440, 200), stringToEdit, 600); if (GUI.Button(new Rect(30, 230, 440, 40), "Speak")) { EasyTTSUtil.SpeechAdd(stringToEdit); } else if (GUI.Button(new Rect(30, 270, 440, 40), "Repeat")) { EasyTTSUtil.SpeechFlush(stringToEdit); } else if (GUI.Button(new Rect(30, 310, 440, 40), "Stop")) { EasyTTSUtil.StopSpeech(); } else if (GUI.Button(new Rect(30, 350, 440, 40), "Clear")) { stringToEdit = ""; } GUI.Label(new Rect(30, 400, 440, 100), "Stop and Repeat button only works once build on mobile iOS or Android "); GUI.EndGroup(); }
public void check() { if (touch == gesture.RIGHT) { EasyTTSUtil.StopSpeech(); swipeRight = true; } if (touch == gesture.LEFT) { EasyTTSUtil.StopSpeech(); swipeLeft = true; } if (touch == gesture.DOUBLE) { EasyTTSUtil.StopSpeech(); pressButton(); } if (touch == gesture.UP) { loop = false; } if (touch == gesture.DOWN) { loop = true; } }
void Update() { if (Input.touchCount > 0) //if there is any touch { touch = Input.GetTouch(0); } else if (Time.time - timer > 5) { EasyTTSUtil.StopSpeech(); } }
public void touchGlobalLeaderboardButton() { if (FB.IsLoggedIn) { SceneManager.LoadScene("si_leaderboards"); } else { EasyTTSUtil.StopSpeech(); EasyTTSUtil.SpeechAdd("You must be logged in to view the leaderboard.", 1f, 0.6f, 1f); } }
public void TTSSay(string SayText) { // print (SayText); #if UNITY_EDITOR_OSX || UNITY_IOS EasyTTSUtil.StopSpeech(); EasyTTSUtil.SpeechAdd(SayText); #endif #if UNITY_STANDALONE_WIN || UNITY_64 /* * if( VoiceAvailable()>0 ) * { * InitVoice(); // init the engine * * if (voice_nb > GetVoiceCount()) voice_nb = 0; * if (voice_nb < 0) voice_nb = 0; * * // Unity V4.x.x ******************************************* * // IntPtr pStr = GetVoiceName(voice_nb); * // string str = Marshal.PtrToStringAnsi(pStr); * // Debug.Log ("Voice name : "+str); // Voice Name * // Unity V4.x.x ******************************************* * * //Debug.Log ("Voice name : "+GetVoiceName(voice_nb)); // Voice Name other Unity version * * // Debug.Log ("Number of voice : "+GetVoiceCount()); // Number of voice * * SetVoice(voice_nb); // 0 to voiceCount - 1 * // Debug.Log ("Voice Rate : "+GetVoiceRate()); * SetVoiceRate(0); * * //Debug.Log ("Voice name : "+GetVoiceName(voice_nb)); * Say(SayText); * // FreeVoice(); * * } */ #endif }
void OnGUI() { GUI.BeginGroup(new Rect(Screen.width / 2 - 250, Screen.height / 2 - 250, 1100, 1000)); GUI.Box(new Rect(0, 0, 500, 450), "EasyTTS Demo"); stringToEdit = GUI.TextField(new Rect(30, 20, 440, 160), stringToEdit, 600); volume = GUI.HorizontalSlider(new Rect(90, 200, 300, 20), volume, 0.01f, 1); GUI.Label(new Rect(40, 195, 300, 40), "Volume"); GUI.Label(new Rect(400, 195, 300, 40), volume + "%"); pitch = GUI.HorizontalSlider(new Rect(90, 225, 300, 20), pitch, 0.5f, 2); GUI.Label(new Rect(40, 222, 300, 40), "Pitch"); GUI.Label(new Rect(400, 222, 300, 40), pitch + "%"); rate = GUI.HorizontalSlider(new Rect(90, 250, 300, 20), rate, 0.01f, 1); GUI.Label(new Rect(40, 245, 300, 40), "Rate"); GUI.Label(new Rect(400, 245, 300, 40), rate + "%"); if (GUI.Button(new Rect(30, 275, 440, 40), "Speak")) { EasyTTSUtil.SpeechAdd(stringToEdit, volume, rate, pitch); } else if (GUI.Button(new Rect(30, 320, 440, 40), "Repeat")) { EasyTTSUtil.SpeechFlush(stringToEdit, volume, rate, pitch); } else if (GUI.Button(new Rect(30, 365, 440, 40), "Stop")) { EasyTTSUtil.StopSpeech(); } else if (GUI.Button(new Rect(30, 410, 440, 40), "Clear")) { stringToEdit = ""; } GUI.Label(new Rect(30, 460, 440, 100), "Stop and Repeat button only works once build on mobile iOS or Android "); GUI.EndGroup(); }
public void touchTutorialButton(int id) { noiseSource.Stop(); EasyTTSUtil.StopSpeech(); if (tutorialRoutine != null) { StopCoroutine(tutorialRoutine); } List <AudioClip> noises = new List <AudioClip>(); string commandText = ""; switch (id) { case 0: commandText = "Welcome to Chicken Road! Your goal is to dodge the obstacles. You will hear a sound, and you must respond with the correct gesture. Beat a level by dodging 60% or more obstacles. You can also try free play so the fun never ends!"; break; case 1: noises.Add(chicken.GetComponent <obstacle>().getSound()); commandText = "Swipe left or right to dodge the chicken"; break; case 2: noises.Add(ducks.GetComponent <obstacle>().getSound()); commandText = "Swipe down to avoid hitting the ducks"; break; case 3: noises.Add(goose.GetComponent <obstacle>().getSound()); commandText = "Swipe up to escape the goose"; break; case 4: noises.Add(fence.GetComponent <obstacle>().getSound()); commandText = "Swipe up to break through the fence"; break; case 5: noises.Add(deer.GetComponent <obstacle>().getSound()); commandText = "Swipe down to avoid hitting the deer"; break; case 6: noises.Add(forkLeft.GetComponent <obstacle>().getSound()); noises.Add(forkRight.GetComponent <obstacle>().getSound()); commandText = "Swipe with the command to correctly follow the fork"; break; case 7: noises.Add(parrot.GetComponent <obstacle>().getSound()); commandText = "Double tap to get rid of the parrot"; break; case 8: noises.Add(racecar.GetComponent <obstacle>().getSound()); commandText = "Swipe up or down to avoid hitting the race car"; break; default: break; } tutorialRoutine = StartCoroutine(playTutorial(noises, commandText)); }
void Update() { CurrentColorUnderMouse = GameManager.colorBelowMousePointer; float roomForError = .15f; //Input.touchCount > 0 && if (Input.touchCount > 0 && (CurrentColorUnderMouse.r + roomForError >= this.elementColor.r && CurrentColorUnderMouse.r - roomForError <= this.elementColor.r) && (CurrentColorUnderMouse.g + roomForError >= this.elementColor.g && CurrentColorUnderMouse.g - roomForError <= this.elementColor.g) && (CurrentColorUnderMouse.b + roomForError >= this.elementColor.b && CurrentColorUnderMouse.b - roomForError <= this.elementColor.b) && CurrentColorUnderMouse.a != 0) { if (CurrentColorUnderMouse != PrevColorUnderMouse) { print("why2"); timer = 0; EasyTTSUtil.StopSpeech(); toSpeak = elementLabel; toSpeak2 = elementDescription; if (GameManager.haptic == true) { Handheld.Vibrate(); } if (toneSource.isPlaying == false) { if (GameManager.audio == true) { toneSource.Play(); toneSource.volume = 1f; toneSource.pitch = map(tagCount, 0f, 15, .9f, 1.8f); } } } else { timer++; print("why"); if (timer == 10 && toSpeak != "") { // EasyTTSUtil.StopSpeech (); EasyTTSUtil.SpeechAdd(toSpeak); print(toSpeak); } if (timer == 55 && toSpeak2 != "") { print("eh"); // EasyTTSUtil.StopSpeech (); EasyTTSUtil.SpeechAdd(toSpeak2); } } } else { if (toneSource.volume > 0) { toneSource.volume = 0f; toneSource.Stop(); } toSpeak = ""; toSpeak2 = ""; // EasyTTSUtil.StopSpeech (); } PrevColorUnderMouse = CurrentColorUnderMouse; }
// Change text for testing if new text is successfully read public void stopReading() { EasyTTSUtil.StopSpeech(); }
public void stopSpeak() { EasyTTSUtil.StopSpeech(); }