// Use this for initialization void Start() { gameState = GameSates.SelfIntroduction; speakState = SpeakingStates.AgentSpeakTurn; dialogCanvas.GetComponent <Canvas>(); dialogChoice1 = "DialogChoice_1"; dialogChoice2 = "DialogChoice_2"; dialogChoice3 = "DialogChoice_3"; isDialogScreenActive = false; currentDialogSceneIndex = 0; isDialogSceneChanged = false; }
IEnumerator PhrasePause(int num) { yield return(new WaitForSeconds(num)); if (gameState == GameSates.SelfIntroduction) { Debug.Log(phrase); gameState = GameSates.Topics_Culinary; speakState = SpeakingStates.UserSpeakTurn; phrase = Phrase.Phrase_S1; } }
IEnumerator SwitchSelftroduction(int num) { speakState = SpeakingStates.UserSpeakTurn; yield return(new WaitForSeconds(num)); HelloWorld.SetActive(false); selfIntroduction_2.SetActive(true); Debug.Log("selfintro000"); //StartCoroutine(SwitchSpeechGUI(true, 3)); speechImage.SetActive(true); speechRecognitionCountDown.SetActive(true); speechRecognitionResultGUI.SetActive(true); speechRecognitionCountDown.GetComponent <CountDown>().StartSpeechRecCountDown(); }
IEnumerator ResultShowTime(int time) { Debug.Log("showing recognition"); yield return(new WaitForSeconds(time)); speakState = SpeakingStates.AgentSpeakTurn; if (gameState == GameSates.HelloWorld) { gameState = GameSates.SelfIntroduction; } else if (gameState == GameSates.SelfIntroduction) { if (phrase == Phrase.Phrase_S1) { phrase = Phrase.Phrase_S2; } } StartCoroutine(SwitchSpeechGUI(false)); }
void Start() { //feedBack data feedBack = new JSONObject(JSONObject.Type.OBJECT); Debug.Log(feedBackString); //// speechRecognitionResultString = speechRecognitionResultGUI.GetComponent <Text>(); //speechRecognitionResultString.text = ""; gameState = GameSates.Idle; speakState = SpeakingStates.AgentSpeakTurn; phrase = Phrase.Phrase_S1; agentSpeak = FindObjectOfType <Girl_Speaking>(); //facialExpress =MainCharacter.GetComponent<Facial_Expression>(); faceController = MainCharacter.GetComponent <MMD4MFaceController>(); dialogCanvas.GetComponent <Canvas>(); dialogChoice1 = "DialogChoice_1"; dialogChoice2 = "DialogChoice_2"; dialogChoice3 = "DialogChoice_3"; isDialogScreenActive = false; currentDialogSceneIndex = 0; point_sum = 50f; isDialogSceneChanged = false; _StartRecognition = false; _Speaking = false; _isSpeechGUIon = false; _isRecongitionFinished = true; _isTooLate = false; _isTurningSpeaker = true; _isGameStarted = false; inputScript = FindObjectOfType <InputFieldScript>(); userLineID = inputScript.ReturnID(); Debug.Log(userLineID); ////Websocket ws_ = new WebSocket("ws://localhost:3000"); //speech recon ws_.OnOpen += (sender, e) => { Debug.Log("WebSocket Open"); }; ws_.OnMessage += (sender, e) => { //speechRecognitionResultString.text = e.Data; if (e.Data == "<too_late>") { Debug.Log("too late"); InvertIsTooLate(_isTooLate); } else { currentRecognitionResult = e.Data; Debug.Log("message"); //Debug.Log(sender + speechRecognitionResultString.text); Debug.Log(sender + currentRecognitionResult); InvertBool(_isRecongitionFinished); } }; ws_.OnClose += (sender, e) => { Debug.Log("connect close"); // ws_.Connect(); }; ws_.Connect(); }