void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "door") { dooraudio.Play(); EasyTTSUtil.SpeechAdd("this is door."); SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onFinalResults.AddListener(OnFinalResult); listener.onPartialResults.AddListener(OnPartialResult); SpeechRecognizer.RequestAccess(); EasyTTSUtil.SpeechAdd("passed request"); if (SpeechRecognizer.IsRecording()) { EasyTTSUtil.SpeechAdd("Stoping recording"); SpeechRecognizer.StopIfRecording(); } else { SpeechRecognizer.StartRecording(true); EasyTTSUtil.SpeechAdd("Start recording"); } EasyTTSUtil.SpeechAdd(resultText); EasyTTSUtil.SpeechAdd("and finihsed testing"); } }
public void speak(string _word) { if (PlayerPrefs.GetInt("VoiceActivated") == 1) { EasyTTSUtil.SpeechAdd(_word); } }
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, 160), stringToEdit, 600); if (GUI.Button(new Rect(30, 230, 440, 40), "Speak")) { EasyTTSUtil.SpeechAdd(stringToEdit); } else if (GUI.Button(new Rect(30, 275, 440, 40), "ENG")) { // EasyTTSUtil.SpeechFlush (stringToEdit); EasyTTSUtil.Initialize(EasyTTSUtil.UnitedStates); EasyTTSUtil.SpeechFlush(eng); } else if (GUI.Button(new Rect(30, 320, 440, 40), "JP")) { // EasyTTSUtil.StopSpeech (); EasyTTSUtil.Initialize(EasyTTSUtil.Japan); EasyTTSUtil.SpeechFlush(jp); } else if (GUI.Button(new Rect(30, 365, 440, 40), "CH")) { // stringToEdit = ""; EasyTTSUtil.Initialize(EasyTTSUtil.China); EasyTTSUtil.SpeechFlush(ch); } GUI.Label(new Rect(30, 420, 440, 100), "Stop and Repeat button only works once build on mobile iOS or Android "); GUI.EndGroup(); }
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 OnTriggerPass2D(Collider2D other) { if (other.gameObject.tag == "bathroom") { tts = "The women's bathrrom is on your left"; EasyTTSUtil.SpeechAdd(tts); } // if (other.gameObject.tag == "bathroom") { // string bathroom = ""; // string direction = ""; // if (bathroomCollision == "") { // bathroomCollision = other.gameObject.name; // } else { // if (other.gameObject.name == "wBathroomRight" && bathroomCollision == "wBathroomLeft") { // bathroom = "women's bathroom"; // direction = "left"; // } // if (other.gameObject.name == "wBathroomRight" && bathroomCollision == "wBathroomRight") { // bathroom = "women's bathroom"; // direction = "right"; // } // if (other.gameObject.name == "mBathroomRight" && bathroomCollision == "mBathroomLeft") { // bathroom = "men's bathroom"; // direction = "left"; // } // if (other.gameObject.name == "mBathroomRight" && bathroomCollision == "mBathroomRight") { // bathroom = "men's bathroom"; // direction = "right"; // } // tts = $"The {bathroom} is on your {direction}"; // EasyTTSUtil.SpeechAdd(tts); // bathroomCollision = ""; // } // } }
// Update is called once per frame void Update() { if (GameManager.url != "" && img == null) { StartCoroutine(myCo()); StartCoroutine(Check()); } if (longStringFromFile != " " && counter < LineList.Length) { ReadText(); } else { if (GameManager.piecewiseStep == 0 && GameManager.piecewise == true) { GameManager.UpdatePieceWiseStep(); } else if (title == "!" && longStringFromFile != " " && counter == LineList.Length && GameManager.piecewise == false) { title = GameManager.diagramTitle; print(title); EasyTTSUtil.SpeechAdd(title); } } }
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(); }
void ClickFour() { EasyTTSUtil.SpeechAdd("Level four"); s = "Level four"; if (isGenerate) { Debug.Log("Level four"); Debug.Log(json ["Level four"] ["Start"] [0] [0].AsFloat); Debug.Log(json ["Level four"] ["End"].Count); rand = (int)Random.Range(0, json ["Level four"] ["End"].Count); startPos.x = json ["Level four"] ["Start"] [rand] [0].AsFloat; startPos.y = json ["Level four"] ["Start"] [rand] [1].AsFloat; startPos.z = json ["Level four"] ["Start"] [rand] [2].AsFloat; endPos.x = json ["Level four"] ["End"] [rand] [0].AsFloat; endPos.y = json ["Level four"] ["End"] [rand] [1].AsFloat; endPos.z = json ["Level four"] ["End"] [rand] [2].AsFloat; Debug.Log(startPos); Debug.Log(endPos); roomLoc.getStartingPoint(startPos); roomLoc.getEndingPoint(endPos); Application.LoadLevel("CCNYGrove"); } else { roomLoc.getStartingPoint(new Vector3(44f, 2f, 138.7f)); roomLoc.getEndingPoint(new Vector3(-62.6f, 2f, 168.5f)); Application.LoadLevel("CCNYGrove"); } }
public void startReading(string textToRead) { if (textToRead.Length > 0) { EasyTTSUtil.SpeechAdd(textToRead); } }
void printNewInstruction() { string newInstruct = infoBrg.getNextInstruction(); if (newInstruct != instruct) { if (newInstruct != null) { Debug.Log("Waypoint direction: " + newInstruct); // <----DEBUGGING } if (newInstruct == "Forward") { EasyTTSUtil.SpeechAdd("Walk " + newInstruct); correctDirection = "Forward"; } else if (newInstruct == "Behind") { EasyTTSUtil.SpeechAdd(" Turn left."); correctDirection = "Left"; } else if (newInstruct != null) { EasyTTSUtil.SpeechAdd("Turn " + newInstruct); correctDirection = newInstruct; } instruct = newInstruct; } }
// Update is called once per frame void Update() { if (gonwe_bool) { EasyTTSUtil.SpeechAdd(speak_e_gao, 1f, 0.5f, 1.0f); gonwe_bool = false; } }
public void startReading(string textToRead) { // Read the specified text if the string is not empty if (textToRead.Length > 0) { EasyTTSUtil.SpeechAdd(textToRead); } }
void Start() { EasyTTSUtil.Initialize(EasyTTSUtil.UnitedStates); EasyTTSUtil.SpeechAdd("You're in the mode Selection Menu"); EasyTTSUtil.SpeechAdd("Please swipe up to select One route mode, " + "swipe down to select same destination mode."); }
private void Update() { if (one) { EasyTTSUtil.SpeechAdd(result); one = false; } }
// Use this for initialization void Start() { EasyTTSUtil.Initialize(EasyTTSUtil.Japan); engineName = EasyTTSUtil.GetDefaultEngineName(); dataLoaderListenning = Camera.main.GetComponent <DataLoaderListenning>(); DownloadTheAudio(dem); EasyTTSUtil.SpeechAdd(result); }
void rotateAngle(int direction) { Vector3 rot = transform.rotation.eulerAngles; Vector3 newRot; if (direction == 1) { // Left transform.Rotate(0, -90f, 0); newRot = transform.rotation.eulerAngles; if (mode == 3) { if (trainingTimes > 0) { EasyTTSUtil.SpeechAdd("Good job. Let's try" + trainingTimes + " more time."); Debug.Log(trainingTimes + " more time(training)"); isAllowMove = false; source.Stop(); StartCoroutine(MyCoroutine(3)); trainingTimes--; transform.position = origin; } else { mode++; resetTutorial(); } } //Debug.Log("Degree Turned: " + readDegreeTurnMade (rot, newRot)); //Debug.Log ("Left Turn..."); } else if (direction == 2) { // Right transform.Rotate(0, 90f, 0); newRot = transform.rotation.eulerAngles; //Debug.Log("Degree Turned: " + readDegreeTurnMade (rot, newRot)); //Debug.Log ("Right Turn..."); if (mode == 4) { if (trainingTimes > 0) { EasyTTSUtil.SpeechAdd("Good job. Let's try" + trainingTimes + " more time."); Debug.Log(trainingTimes + " more time(training)"); isAllowMove = false; source.Stop(); StartCoroutine(MyCoroutine(3)); trainingTimes--; transform.position = origin; } else { mode++; resetTutorial(); } } } }
void ClickNo() { EasyTTSUtil.SpeechAdd("no"); Debug.Log("no"); //StartCoroutine (MyCoroutine()); //if(selection > 0) Application.LoadLevel("1ModeSelect"); //selection ++; }
void ClickYes() { EasyTTSUtil.SpeechAdd("Yes"); Debug.Log("yes"); //StartCoroutine (MyCoroutine()); //if(selection > 0) Application.LoadLevel("CCNYGrove"); //selection ++; }
void readGameResults() { timer.text = "Time Spent: " + nextDir.getEndTime(); EasyTTSUtil.SpeechAdd(timer.text); collisions.text = "Number of Collisions: " + nextDir.getNumOfCollisions(); EasyTTSUtil.SpeechAdd(collisions.text); highScore.text = "Your Score is " + (1000 - nextDir.getNumOfCollisions() * 10); EasyTTSUtil.SpeechAdd(highScore.text); }
void ClickTrainingTutorial() { EasyTTSUtil.SpeechAdd("Training mode tutorial"); Debug.Log("Training mode tutorial"); StartCoroutine(MyCoroutine()); if (selection > 0) { Application.LoadLevel("TrainingModeTutorial"); } selection++; }
void ClickGameMode() { EasyTTSUtil.SpeechAdd("Game mode"); Debug.Log("Game Mode"); StartCoroutine(MyCoroutine()); if (selection > 0) { Application.LoadLevel("DemoLevel"); } selection++; }
void ClickTrainingMode() { EasyTTSUtil.SpeechAdd("Training mode"); Debug.Log("Training model"); StartCoroutine(MyCoroutine()); if (selection > 0) { Application.LoadLevel("DifficultyControllerType"); } selection++; }
void ClickGeneralTutorial() { EasyTTSUtil.SpeechAdd("General tutorial"); Debug.Log("General tutorial"); StartCoroutine(MyCoroutine()); if (selection > 0) { Application.LoadLevel("GeneralTutorial"); } selection++; }
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); } }
/* * Movement method to rotate the avatar left or right * 90 DEGREES with swipes on the ANDROID device (Mobile Application). * @param h - Horizontal direction swipe */ void rotate(float h) { if (h >= 0) // Determines if left or right swipe { accessDirection = "Right"; transform.Rotate(0, 90f, 0); //** Right Rotation accessLog(); EasyTTSUtil.SpeechFlush("Right " + 90 + " degree turn made"); if (mode == 4) { if (trainingTimes > 0) { EasyTTSUtil.SpeechAdd("Good. Let's try" + trainingTimes + " more time."); Debug.Log(trainingTimes + " more time(training)"); isAllowMove = false; source.Stop(); StartCoroutine(MyCoroutine(3)); trainingTimes--; transform.position = origin; } else { mode++; resetTutorial(); } } } else { accessDirection = "Left"; transform.Rotate(0, -90f, 0); // **Left Rotation accessLog(); EasyTTSUtil.SpeechFlush("Left " + 90 + " degree turn made"); if (mode == 3) { if (trainingTimes > 0) { EasyTTSUtil.SpeechAdd("Good. Let's try" + trainingTimes + " more time."); Debug.Log(trainingTimes + " more time(training)"); isAllowMove = false; source.Stop(); StartCoroutine(MyCoroutine(3)); trainingTimes--; transform.position = origin; } else { mode++; resetTutorial(); } } } }
void introMessage() { EasyTTSUtil.SpeechAdd("Welcome to the Sight City game tutorial. " + "In this tutorial, we are going to control a player to explore a floor layout. First " + "Let's study how to control the player. Please put your finger on the screen and " + "swipe up to move forward."); isAllowMove = false; StartCoroutine(MyCoroutine(10)); Debug.Log("moveforward tutorial"); correctDirection = "Forward"; }
/* * Auto-Movement method to direct the avatar to walk to * the next waypoint on his path to destination. * @param v - Vertical direction swipe */ /* * void autoWalkInAndroid(float v) * { * if (v >= 0) // Only takes upward swipes * { * // Moves the avatar forward * playerRigidbody.constraints = RigidbodyConstraints.FreezeRotation; * infoBrg.setPermission(true); * //playerRigidbody.constraints = ~RigidbodyConstraints.FreezeRotationY; * } * * } */ /* * Movement method to rotate the avatar left or right * 90 DEGREES with swipes on the ANDROID device (Mobile Application). * @param h - Horizontal direction swipe */ void rotate(float h) { string direction = ""; string newInstruct = infoBrg.getNextInstruction(); if (h >= 0) // Determines if left or right swipe { direction = "Right"; accessDirection = direction; if (newInstruct == direction || newInstruct == "Behind") { transform.Rotate(0, 90f, 0); //** Right Rotation EasyTTSUtil.SpeechFlush("Right " + 90 + " degree turn made"); } else if (newInstruct == "Forward") { EasyTTSUtil.SpeechAdd("Walk " + newInstruct); } else if (newInstruct == "Behind") { EasyTTSUtil.SpeechAdd(/* "Waypoint is " + newInstruct */ ""); } else if (newInstruct != null) { EasyTTSUtil.SpeechAdd("Turn " + newInstruct); } accessLog(); } else { direction = "Left"; accessDirection = direction; if (newInstruct == direction || newInstruct == "Behind") { transform.Rotate(0, -90f, 0); // **Left Rotation EasyTTSUtil.SpeechFlush("Left " + 90 + " degree turn made"); } else if (newInstruct == "Forward") { EasyTTSUtil.SpeechAdd("Walk " + newInstruct); } else if (newInstruct == "Behind") { EasyTTSUtil.SpeechAdd(/* "Waypoint is " + newInstruct */ ""); } else if (newInstruct != null) { EasyTTSUtil.SpeechAdd("Turn " + newInstruct); } accessLog(); } }
/* * Movement method to move the avatar FORWARD with * swipes on the ANDROID device (Mobile Application). * @param v - Vertical direction swipe */ void moveInAndroid(float v) { accessDirection = "Forward"; if (v >= 0) // Only takes upward swipes // Moves the avatar forward { movement.Set(0f, 0f, v); movement = transform.forward; movement = movement.normalized * speed * Time.deltaTime * 10; playerRigidbody.MovePosition(transform.position + movement); accessLog(); if (mode == 1) { mode++; resetTutorial(); } if (mode == 2) { if (movedDistance >= 10) { if (trainingTimes > 0) { EasyTTSUtil.SpeechAdd("Good job. Let's try" + trainingTimes); if (trainingTimes == 1) { EasyTTSUtil.SpeechAdd("more time."); } if (trainingTimes > 1) { EasyTTSUtil.SpeechAdd("more times."); } Debug.Log(trainingTimes + " more time(training)"); isAllowMove = false; source.Stop(); StartCoroutine(MyCoroutine(3)); trainingTimes--; transform.position = origin; movedDistance = 0; } else { mode++; resetTutorial(); } } } } }
IEnumerator playTutorial(List <AudioClip> noises, string commandText) { int i = 0; while (i < noises.Count) { noiseSource.PlayOneShot(noises[i]); yield return(new WaitForSeconds(noises[i].length + 0.2f)); i++; } EasyTTSUtil.SpeechAdd(commandText, 1f, 0.6f, 1f); yield return(new WaitForSeconds(2f)); }
void OnTriggerEnter(Collider col) { if (col.gameObject.CompareTag("target")) { EasyTTSUtil.SpeechAdd("Congratulations, you've reached your destination."); Debug.Log("Game Over, you've completed the course"); isAllowMove = false; isReachTarget = true; infoBrg.setReachTarget(isReachTarget); source.Stop(); mode++; resetTutorial(); } }