// Use this for initialization void Start() { //openHand(); // rotateArmToLeft(); //rotateArmToRight(); //rotateArmToUp(); //rotateArmToDown(); if (CoreXT.IsDevice) { OpenEars.Heard += delegate(object sender, OpenEarsHeardEventArgs e) { Log("Heard: " + e.Phrase); OnCommand(e.Phrase); }; OpenEars.Init(new string[] { "LEFT", "RIGHT", "OPEN", "CLOSE", "CENTER" }); OpenEars.StartListening(); Log("Open Ears initialized."); MindWave.Sensed += delegate(object sender, MindWaveSensedEventArgs e) { Log("Sensed: " + e.Phrase); OnCommand(e.Phrase); }; MindWave.Init(); // init for mind control MindWave.StartListening(); Log("MindWave initialized."); Log("Screen size: " + Screen.width + "x" + Screen.height); } }
void OnGUI() { GUILayout.BeginArea(new Rect(50, 50, Screen.width - 100, 100)); GUILayout.BeginHorizontal(); if (GUILayout.Button("Init", GUILayout.ExpandHeight(true))) { OpenEars.Init(new string[] { "LEFT", "RIGHT", "UP", "DOWN", "GRAB", "DROP" }); Log("OpenEars initialized."); } if (GUILayout.Button("Start", GUILayout.ExpandHeight(true))) { OpenEars.StartListening(); Log("Started listening."); } if (GUILayout.Button("Stop", GUILayout.ExpandHeight(true))) { OpenEars.StopListening(); Log("Stopped listening."); } if (GUILayout.Button("Speak", GUILayout.ExpandHeight(true))) { var phrase = "Hello"; OpenEars.Speak(phrase); Log("Saying " + phrase); } if (GUILayout.Button("Clear Log", GUILayout.ExpandHeight(true))) { _log = ""; } GUILayout.EndHorizontal(); GUILayout.EndArea(); OnGUILog(); }