//Beim Erreichen von Triggern (Oberfläche, Ziel) private void OnTriggerEnter(Collider other) { if (other.CompareTag("Ziel")) { gameMan.YouWon(); } if (other.CompareTag("OberflaecheWarnung")) { gameMan.effectScript.Effekt(transform.position, Effects.Effekte.ZuHoch); } if (other.CompareTag("Oberflaeche")) { gameMan.effectScript.Effekt(transform.position, Effects.Effekte.Explosion); gameMan.YouLost(); } if (other.CompareTag("Text")) { SubtitleTrigger triggerBox = other.GetComponent <SubtitleTrigger>(); gameMan.GetComponent <GameUI>().ChangeSubtitles(triggerBox.subtitleText); if (triggerBox.image1 != null) { gameMan.GetComponent <GameUI>().ChangeImage1(triggerBox.image1); } if (triggerBox.image2 != null) { gameMan.GetComponent <GameUI>().ChangeImage2(triggerBox.image2); } if (triggerBox.launchEnemyTorpedo) { gameMan.StartSonarTorpedo(); } } }
private void Update() { subtitleTrigger = SettingsController.GetSubtitleTrigger(); if ((int)subtitleTrigger == 2) { isFace = GameObject.Find("World").GetComponent <FaceSceneBehavior>().faceDetected; AndroidSpeechRecognizer.StartListening(); } }
public void SetTextOnScreen(string text) { subtitleTrigger = SettingsController.GetSubtitleTrigger(); if ((int)subtitleTrigger == 2) { if (isFace) { if (foreignLang.ToString() != nativeLang.ToString() && translate == 0) //translate -> 0 = ON , translate -> 1 = OFF { translator = new Translator.Translator(); Action <Translator.Translator.Result> action = (Translator.Translator.Result result) => { this.text.text = result.translatedText; }; StartCoroutine(translator.translate(text, nativeLang, action)); } else { this.text.text = text; } } else { this.text.text = ""; } } else { if (foreignLang.ToString() != nativeLang.ToString() && translate == 0) //translate -> 0 = ON , translate -> 1 = OFF { translator = new Translator.Translator(); Action <Translator.Translator.Result> action = (Translator.Translator.Result result) => { this.text.text = result.translatedText; if ((int)SettingsController.GetSubtitleTrigger() == 0) //Always on { AndroidSpeechRecognizer.StartListening(); } }; StartCoroutine(translator.translate(text, nativeLang, action)); } else { this.text.text = text; if ((int)SettingsController.GetSubtitleTrigger() == 0) //Always on { AndroidSpeechRecognizer.StartListening(); } } } }
private void Start() { nativeLang = SettingsController.GetLanguage(); foreignLang = SettingsController.GetForeignLanguage(); translate = (int)SettingsController.GetTranslateLanguage(); subtitleTrigger = SettingsController.GetSubtitleTrigger(); if ((int)subtitleTrigger == 0) //Always on { AndroidSpeechRecognizer.Construct(new ScreenRecognitionListenerProxy()); AndroidSpeechRecognizer.StartListening(); } if ((int)subtitleTrigger == 2) //If face detected { AndroidSpeechRecognizer.Construct(new ScreenRecognitionListenerProxy()); AndroidSpeechRecognizer.StartListening(); } }
public static void SetSubtitleTrigger(SubtitleTrigger subtitleTrigger) { PlayerPrefs.SetInt("subtitleTrigger", (int)subtitleTrigger); }