void onActivityResult(string recognizedText) { VoiceCommandInstruction instruction = VoiceCommandInstruction.None; char[] delimiterChars = { '~' }; string[] words = recognizedText.Split(delimiterChars); switch (SpeechListener.Instance.SpeechLanguage) { case SpeechLanguage.English: for (int i = 0; i < englishInstructionKeywords.GetLength(0); i++) { if (words[0] == englishInstructionKeywords[i]) { instruction = (VoiceCommandInstruction)i; } } break; case SpeechLanguage.Spanish: for (int i = 0; i < spanishInstructionKeywords.GetLength(0); i++) { if (words[0] == spanishInstructionKeywords[i]) { instruction = (VoiceCommandInstruction)i; } } break; } if (instruction != VoiceCommandInstruction.None) { onInstructionGiven.Invoke(instruction); } onSpeechRecognition.Invoke(words[0]); }
void ChangeCurrentInstruction(VoiceCommandInstruction newInstruction) { currentInstruction = newInstruction; }