示例#1
0
    // 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);
        }
    }
示例#2
0
    void closeHand()
    {
        var clawLeft  = GameObject.FindWithTag("clawLeft");
        var clawRight = GameObject.FindWithTag("clawRight");

        if (isOpen)
        {
            OpenEars.Speak("OK, don't crush me.");
            clawLeft.transform.Rotate(new Vector3(0, 40, 0));
            clawRight.transform.Rotate(new Vector3(0, -40, 0));

            var www = new WWW("http://apps.vitapoly.com/apps/mcrobot/post.php?cmd=close");

            isOpen = false;
        }
    }
示例#3
0
    void openHand()
    {
        //Debug.Log("open hand");
        var clawLeft  = GameObject.FindWithTag("clawLeft");
        var clawRight = GameObject.FindWithTag("clawRight");

        if (!isOpen)
        {
            OpenEars.Speak("Opening claw.");
            clawLeft.transform.Rotate(new Vector3(0, -40, 0));
            clawRight.transform.Rotate(new Vector3(0, 40, 0));

            var www = new WWW("http://apps.vitapoly.com/apps/mcrobot/post.php?cmd=open");

            isOpen = true;
        }
    }
示例#4
0
    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();
    }