void ISpeechHandler.OnSpeechKeywordRecognized(SpeechEventData eventData)
    {
        if (eventData.RecognizedText.Equals("Move Model"))
        {
            isNavigationEnabled = false;
        }
        else if (eventData.RecognizedText.Equals("Rotate Model"))
        {
            isNavigationEnabled = true;
        }
        else if (eventData.RecognizedText.Equals("Zoom In"))
        {
            model.zoomSmooth(1.2f, 0.5f);
        }
        else if (eventData.RecognizedText.Equals("Zoom Out"))
        {
            model.zoomSmooth(0.8f, 0.5f);
        }
        else if (eventData.RecognizedText.Equals("Swap Axis"))
        {
            modelAxisRotation = !modelAxisRotation;
        }
        else if (eventData.RecognizedText.Equals("Explode Model"))
        {
            modelManipulator.explode();
        }
        else if (eventData.RecognizedText.Equals("Add layer"))
        {
            modelManipulator.addLayer();
        }
        else if (eventData.RecognizedText.Equals("Remove layer"))
        {
            modelManipulator.removeLayer();
        }
        else
        {
            return;
        }

        eventData.Use();
    }
Exemple #2
0
        /// <summary>
        /// Voice commands from MixedRealitySpeechCommandProfile, keyword recognized
        /// requires isGlobal
        /// </summary>
        /// <param name="eventData"></param>
        public void OnSpeechKeywordRecognized(SpeechEventData eventData)
        {
            if (eventData.Command.Keyword == VoiceCommand && (!RequiresFocus || HasFocus) && Enabled)
            {
                StartGlobalVisual(true);
                IncreaseDimensionIndex();
                OnPointerClicked(null);
                eventData.Use();
            }

            // TODO(https://github.com/Microsoft/MixedRealityToolkit-Unity/issues/3767): Need to merge this
            // work below with the code above.
            // if (Enabled && ShouldListen(eventData.MixedRealityInputAction))
            // {
            //     StartGlobalVisual(true);
            //     IncreaseDimensionIndex();
            //     SendVoiceCommands(eventData.RecognizedText, 0, 1);
            //     SendOnClick(null);
            //     eventData.Use();
            // }
        }
    // STEP 4 : CUSTOM CODE FOR SPEECH RECOGNITION
    public void OnSpeechKeywordRecognized(SpeechEventData eventData)
    {
        // Your code goes here

        // If we recognize the keyword spin
        if (eventData.RecognizedText == "Spin")
        {
            // We start spinning the cube
            GetComponent <Animator>().SetBool("SpinCube", true);
        }
        // If we recognize the keyword stop
        if (eventData.RecognizedText == "Stop")
        {
            // We stop spinning the cube
            GetComponent <Animator>().SetBool("SpinCube", false);
        }

        // Homework:
        // If we recognize the keyword Architecture
        // We get the MeshRender component and get the material component
        // We set the material color to a new color
    }
    void ISpeechHandler.OnSpeechKeywordRecognized(SpeechEventData eventData)
    {
        if (eventData.RecognizedText.ToLower().Equals("move anchor"))
        {
            isCalibrationEnabled = true;
        }
        else if (eventData.RecognizedText.ToLower().Equals("attach anchor"))
        {
            isCalibrationEnabled = false;
            WorldAnchorManager.Instance.AttachAnchor(this.gameObject, AnchorName);
        }
        else if (eventData.RecognizedText.ToLower().Equals("take photo"))
        {
            // HololensPhotoCapture.Instance.TakePhoto();
        }
        else
        {
            return;
        }

        eventData.Use();
    }
        void ISpeechHandler.OnSpeechKeywordRecognized(SpeechEventData eventData)
        {
            string x = RecogniseCommand(eventData.RecognizedText);

            if (x.Equals("Play Video"))
            {
                audioSource.Play();
                videoPlayer.Play();
            }
            else if (x.Equals("Pause Video"))
            {
                audioSource.Pause();
                videoPlayer.Pause();
            }
            else if (x.Equals("Read Text"))
            {
                audioSource.Play();
            }
            else if (x.Equals("Stop Reading"))
            {
                audioSource.Pause();
            }
            else if (x.Equals("Edit"))
            {
                gameObject.GetComponent <TwoHandManipulatable>().enabled = true;
            }
            else if (x.Equals("Stop Editing"))
            {
                gameObject.GetComponent <TwoHandManipulatable>().enabled = false;
            }
            else
            {
                return;
            }

            eventData.Use();
        }
Exemple #6
0
    public void OnSpeechKeywordRecognized(SpeechEventData eventData)
    {
        if (!eventData.used)
        {
            switch (eventData.RecognizedText.ToLower())
            {
            case "start":
                Debug.Log("start heard: ");
                FindObjectOfType <DialogueManager> ().StartDialogue(dialogue);
                break;

            case "next":
                Debug.Log("next heard: ");
                FindObjectOfType <DialogueManager> ().DisplayNextSentence();
                break;

            case "back":
                Debug.Log("back heard: ");
                FindObjectOfType <DialogueManager> ().DisplayPrevSentence();
                break;

            case "okay":
                FindObjectOfType <DialogueManager> ().DisplayNextSentence();
                break;

            case "abnormal":
                FindObjectOfType <DialogueManager> ().DisplayNextSentence();
                break;

            default:
                break;
            }

            eventData.Use();
        }
    }
        // もうちょっといけてる方法考えたい
        public void OnSpeechKeywordRecognized(SpeechEventData eventData)
        {
            switch (eventData.RecognizedText)
            {
            case "Delete":
                if (GazeManager.Instance.HitObject != null)
                {
                    var deletable = GazeManager.Instance.HitObject.GetComponentInParent <IDeletable>();
                    if (deletable != null)
                    {
                        deletable.DeleteFigure();
                    }
                }
                break;

            case "Close":
                var sizer = SizerManager.Instance.Sizer as IPolygonClosable;
                if (sizer != null)
                {
                    sizer.ClosePolygon();
                }
                break;
            }
        }
 public void OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     SpeechInput(eventData.RecognizedText.ToLower());
 }
 void ISpeechHandler.OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
 }
Exemple #10
0
    void ISpeechHandler.OnSpeechKeywordRecognized(SpeechEventData eventData)
    {
        var action = GetObject(eventData.RecognizedText);

        ExecCommand(action);
    }
Exemple #11
0
 void IMixedRealitySpeechHandler.OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     Debug.Log(eventData.Command.Keyword.ToLower());
 }
Exemple #12
0
 public void OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
 }
 public void OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     ProcessVoice(eventData.RecognizedText);
 }
Exemple #14
0
 //ISpeachHandler
 //音声認識
 //SpeechInputSourceを任意のオブジェクトにアタッチし、単語を登録する必要がある。
 public void OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     displayedText.text = eventData.RecognizedText.ToLower();
 }
 public void OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     speechCount++;
 }
Exemple #16
0
 public void OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     RespondToVoiceCommand(eventData.RecognizedText);
 }
Exemple #17
0
 public void OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     ChangeColor(eventData.RecognizedText);
 }
Exemple #18
0
    /*	Afhandelen stemcommando's voor de huidige state.
     *      Naast de aangeven voiceommands wordt er ook gereageerd op de namen van onderdelen van het been.
     *      Het resultaat eventData komt voort uit de herkende worden, gebaseerd op de aangegeven woorden in de editor,
     *      én de namen van de onderdelen van het been.
     */
    public void OnSpeechKeywordRecognized(SpeechEventData eventData)
    {
        string recognizedText = eventData.RecognizedText.ToLower();

        switch (recognizedText)
        {
        case "start":
            if (currentState == standbyState)
            {
                standbyState.Next();
            }
            break;

        case "on":
            if (currentState == standbyState)
            {
                standbyState.Next();
            }
            break;

        case "calibrate":
            currentState.Calibrate();
            break;

        case "next":
            currentState.Next();
            break;

        case "back":
            currentState.Back();
            break;

        case "restart":
            currentState.Restart();
            break;

        case "stop":
            currentState.Stop();
            break;

        case "off":
            currentState.Stop();
            break;

        case "pre surgery":
            currentState = preSurgeryState;
            currentState.Init();
            break;

        case "post surgery":
            currentState = postSurgeryState;
            currentState.Init();
            break;

        default:
            appManager.VoiceCommandText.text = recognizedText;
            appManager.Leg.HighlightLegPart(new string[] { recognizedText });
            break;
        }

        // Aanpassen interface-tekst voor de gebruiker.
        appManager.VoiceCommandText.text = eventData.RecognizedText;
        StartCoroutine(appManager.CustomText.Fade(appManager.VoiceCommandText));
    }
Exemple #19
0
        void ISpeechHandler.OnSpeechKeywordRecognized(SpeechEventData eventData)
        {
            CurrentCommand  = eventData.RecognizedText.ToLower();
            commandDetected = true;
            Debug.Log("Command: " + CurrentCommand);
            if (CurrentCommand == "state")
            {
                Debug.Log(StateManager.Instance.CurrentState);
                return;
            }
            switch (CurrentCommand)
            {
            case "transition standby":
                if (!StateManager.Instance.RobotCalibrated)
                {
                    return;
                }
                StateManager.Instance.TransitionToStandbyState();
                break;

            case "transition calibrate":
                StateManager.Instance.TransitionToCalibrateState();
                break;

            case "transition waypoints":
                if (!StateManager.Instance.RobotCalibrated)
                {
                    return;
                }
                StateManager.Instance.TransitionToWaypointState();
                break;

            case "transition label":
                if (!StateManager.Instance.RobotCalibrated)
                {
                    return;
                }
                Debug.Log("Transitioned to label state");
                StateManager.Instance.TransitionToLabelState();
                break;

            case "transition grasping":
                if (!StateManager.Instance.RobotCalibrated)
                {
                    return;
                }
                Debug.Log("Transitioned to grasping state");
                StateManager.Instance.TransitionToGraspingState();
                break;

            case "transition puppet":
                if (!StateManager.Instance.RobotCalibrated)
                {
                    return;
                }
                StateManager.Instance.TransitionToPuppetState();
                break;

            case "transition arm trail":
                if (!StateManager.Instance.RobotCalibrated)
                {
                    return;
                }
                StateManager.Instance.TransitionToArmTrailState();
                break;

            case "look straight":
                StateManager.Instance.EinCommandsToExecute.Add("lookStraight");
                break;

            case "look smug":
                StateManager.Instance.EinCommandsToExecute.Add("lookSmug");
                break;

            case "look at me":
                StateManager.Instance.LookAtUser = true;
                break;

            case "stop looking":
                StateManager.Instance.LookAtUser = false;
                break;
            }
            switch (StateManager.Instance.CurrentState)
            {
            case StateManager.State.CalibratingState:
                ParseCalibrateCommands(CurrentCommand);
                break;

            case StateManager.State.WaypointState:
                ParseWaypointCommands(CurrentCommand);
                break;

            case StateManager.State.PuppetState:
                ParsePuppetCommands(CurrentCommand);
                break;

            case StateManager.State.LabelState:
                ParseLabelCommands(CurrentCommand);
                break;

            case StateManager.State.GraspingState:
                ParseGraspCommands(CurrentCommand);
                break;
            }
        }
 public void OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     print("Recognize text: ");
     print(eventData.RecognizedText);
     ChangeState(eventData.RecognizedText);
 }
 public void OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     ChangeMode(eventData.RecognizedText);
     throw new System.NotImplementedException();
 }
 void IMixedRealitySpeechHandler.OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     Debug.Log("OnSpeechKeywordRecognized: " + Manager.Get_isTalking());
 }
 public void OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     speechCommandsReceived.Add(eventData.Command.Keyword);
 }
    public void OnSpeechKeywordRecognized(SpeechEventData eventData)
    {
        if (eventData.RecognizedText.Equals("scan") && areWePicking == false)
        {
            areWeScanning = false;
            if (allowToScanItems == false)
            {
                if (copyBarcodeValue.Equals("A17"))
                {
                    copyBarcodeValue = "Baydoor";
                    errors.text      = "";
                    guideText.text   = "baydoor scanned, say 'end' if you wish to proceed to picking, say 'back' to cancel";
                    return;
                }
                confirmBarcode = copyBarcodeValue;
                guideText.text = "You have scanned: " + copyBarcodeValue + ", say 'yes' to confirm the location";
                StartCoroutine(ShowCorrectLogo(true));
            }
            if (allowToScanItems == true)
            {
                if (ItemsLibary.getItem(copyBarcodeValue).Equals(""))
                {
                    StartCoroutine(ShowCorrectLogo(false));
                    errors.text   = "you did not scan an item, try again, if you're done with items say: 'done'";
                    areWeScanning = true;
                    return;
                }
                StartCoroutine(ShowCorrectLogo(true));
                copyBarcodeValue = ItemsLibary.getItem(copyBarcodeValue);
                guideText.text   = copyBarcodeValue + " added to: " + confirmBarcode;
                errors.text      = "Item scanned: " + copyBarcodeValue + ", say 'scan' to add more items to location, say 'done' to confirm the items to location";
                guideScript.InsertPickUpItemToPanel(copyBarcodeValue, confirmBarcode);
                areWeScanning = true;
            }
            string isConfirmedLocationOrNot = ItemsLibary.getItem(confirmBarcode);
            if (cube == null && isConfirmedLocationOrNot.Equals("") && !copyBarcodeValue.Equals(""))
            {
                //if cube is null then we instantiate a cube that is used as postition for text meshes, also follow camera.
                cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
                cube.AddComponent <TapToPlace>();
                cube.GetComponent <TapToPlace>().IsBeingPlaced                 = true;
                cube.GetComponent <TapToPlace>().DefaultGazeDistance           = 10;
                cube.GetComponent <TapToPlace>().AllowMeshVisualizationControl = false;
                cube.GetComponent <Transform>().localScale = new Vector3(0.1f, 0.1f, 0.1f);
                cube.transform.position = cam.transform.position + cam.transform.forward * 2;
                cube.GetComponent <MeshRenderer>().enabled = false;
            }
            else if (cube != null && isConfirmedLocationOrNot.Equals("") && !copyBarcodeValue.Equals(""))
            {//if cube exists, then just make it follow the camera.
                cube.GetComponent <TapToPlace>().IsBeingPlaced = true;
            }
        }
        if (eventData.RecognizedText.Equals("scan") && areWePicking == true)
        {
            areWeScanning = false;
            if (copyBarcodeValue.Equals("A17") && SpawnRobots.startPosition.GetComponent <TextMesh>().text.Equals("Baydoor") && allowToScanItems == false)
            {
                copyBarcodeValue = "Baydoor";
                errors.text      = "";
                debugText.text   = "";
                itemText.text    = "";
                microsoftLogo.SetActive(true);
                pickListPanel.SetActive(false);
                guideText.text = "there are no tasks left and you have scanned baydoor, job done! go home!";
                GameObject.Find("myControls").GetComponent <SpawnRobots>().enabled = false;
                return;
            }
            if (ItemsLibary.getItem(copyBarcodeValue).Equals("") && locationNumbers[SpawnRobots.counter].Description.Equals(copyBarcodeValue) && allowToScanItems == false)
            {
                StartCoroutine(ShowCorrectLogo(true));
                errors.text      = "You have scanned the correct location number, now scan the items";
                confirmBarcode   = copyBarcodeValue;
                allowToScanItems = true;
                areWeScanning    = true;
                return;
            }
            else
            {
                if (copyBarcodeValue.Equals("A17"))
                {
                    StartCoroutine(ShowCorrectLogo(false));
                    errors.text = "You have scanned baydoor but your job is not done! Scan the correct location number.";
                }
                else
                {
                    StartCoroutine(ShowCorrectLogo(false));
                    errors.text = "Wrong location number scanned. Try again.";
                }
            }
            if (allowToScanItems == true)
            {
                if (ItemsLibary.getItem(copyBarcodeValue).Equals(""))
                {
                    StartCoroutine(ShowCorrectLogo(false));
                    errors.text   = "you did not scan an item, try again, if you're done picking up items here say 'done'";
                    areWeScanning = true;
                    return;
                }
                copyBarcodeValue = ItemsLibary.getItem(copyBarcodeValue);
                //errors.text = "something went wrong? item scanned was: " + copyBarcodeValue + ", confirmed barcode was: " + confirmBarcode;
                for (int i = 0; i < GuideScript.items.Count; i++)
                {
                    // first checks, if the scanned barcode exist in the list, and if is belongs to the current locationnumber
                    if (GuideScript.items[i].Name.Equals(copyBarcodeValue) && GuideScript.items[i].BelongsToLocation.Equals(confirmBarcode))
                    {
                        errors.text = "You have picked up an item : " + copyBarcodeValue + ", say 'scan' to pickup more items from location, say 'done' for next location";
                        GuideScript.items.Remove(GuideScript.items[i]);
                        StartCoroutine(guideScript.UpdateItemsPanel()); //update the panel, so that it shows that we have picked up an item, now pickup shows the remanining items
                        //StartCoroutine(ShowCorrectLogo(true));
                    }
                }
            }
            areWeScanning = true;
        }
        if (eventData.RecognizedText.Equals("yes") && areWePicking == false && firstTimeYes == true && allowToScanItems == false)
        {
            string isConfirmedLocationOrNot = ItemsLibary.getItem(confirmBarcode);
            if (isConfirmedLocationOrNot.Equals(""))
            {
                Create3DTextOnWall(confirmBarcode);
                allowToScanItems = true;
            }
            else
            {
                StartCoroutine(ShowCorrectLogo(false));
                errors.text   = "you did not scan a location number";
                areWeScanning = true;
            }
        }
        if (eventData.RecognizedText.Equals("back") && guideText.text.Equals(
                "baydoor scanned, say 'end' if you wish to proceed to picking, say 'back' to cancel"))
        {
            areWeScanning = true;
            errors.text   = "baydoor canceled, scan missing location numbers!";
        }
        if (eventData.RecognizedText.Equals("end") && guideText.text.Equals(
                "baydoor scanned, say 'end' if you wish to proceed to picking, say 'back' to cancel") &&
            areWePicking == false)
        {
            Create3DTextOnWall(copyBarcodeValue);
            areWePicking     = true;
            allowToScanItems = false;
            areWeScanning    = false;
            //combine child meshes in spatialmapping
            MeshFilter[]      meshFilters = GameObject.Find("SpatialMapping").GetComponentsInChildren <MeshFilter>();
            CombineInstance[] combine     = new CombineInstance[meshFilters.Length];
            int i = 1;
            while (i < meshFilters.Length)
            {
                combine[i].mesh      = meshFilters[i].sharedMesh;
                combine[i].transform = meshFilters[i].transform.localToWorldMatrix;
                meshFilters[i].gameObject.SetActive(false);
                i++;
            }
            spatialMapping.transform.GetComponent <MeshFilter>().mesh = new Mesh();
            spatialMapping.transform.GetComponent <MeshFilter>().mesh.CombineMeshes(combine);
            spatialMapping.transform.gameObject.SetActive(true);
            spatialMapping.GetComponent <Renderer>().material = combinedMeshMaterial;

            //spatialMapping.GetComponent<MeshRenderer>().enabled = false;

            StartCoroutine(waitBake());
        }
        if (eventData.RecognizedText.Equals("go") && guideText.text.Equals(
                "area has been optimized, now you can pickup the goods from the picklist by saying: 'go'") &&
            areWePicking == true)
        {
            //Print the name of the LocationNumber
            guideText.text = "follow the line and scan the location number: " + locationNumbers[0].Description;
            errors.text    = "we are in picking mode.";
            GameObject.Find("myControls").GetComponent <SpawnRobots>().enabled = true;
            areWeScanning = true;
            pickListPanel.GetComponent <Image>().enabled = true;
            foreach (Transform child in pickListPanel.transform)
            {
                child.gameObject.GetComponent <Text>().enabled = false;
            }
        }
        if (eventData.RecognizedText.Equals("done") && areWePicking == false && allowToScanItems == true)
        {
            guideText.text   = "find a new location-number to scan";
            errors.text      = "you have succesfully added items to a location";
            allowToScanItems = false;
            areWeScanning    = true;
        }
        if (eventData.RecognizedText.Equals("done") && areWePicking == true && allowToScanItems == true)
        {
            bool anyItemsLeft = true;
            for (int i = 0; i < GuideScript.items.Count; i++)
            {
                if (GuideScript.items[i].BelongsToLocation.Equals(confirmBarcode))
                {
                    anyItemsLeft = true;
                    errors.text  = "You are not done with Scanning items! - Go further";
                    break; //break because you are not done with scanning items.
                }
                else
                {
                    anyItemsLeft = false;
                }
            }
            if (GuideScript.items.Count == 0)
            {
                anyItemsLeft = false;
            }
            if (anyItemsLeft == false)
            {
                // Change direction of the Robot with the counter.
                SpawnRobots.counter++;
                allowToScanItems = false;
                errors.text      = "items have been picked up, now go to: " + locationNumbers[SpawnRobots.counter].Description;
            }
            areWeScanning = true;
        }
    }
Exemple #25
0
 public void OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     //throw new System.NotImplementedException();
 }
 public void OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     GotoNextScene();
 }
Exemple #27
0
 public void OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     key(eventData.RecognizedText);
 }
Exemple #28
0
    public void OnSpeechKeywordRecognized(SpeechEventData eventData)
    {
        int sphere = -1;

        switch (eventData.RecognizedText.ToLower())
        {
        case "closest":
            nav.Closest();

            Debug.Log("Closest Reached!\n");
            break;

        case "go to sphere":
            sphere = 0;
            break;

        case "go to one":
            sphere = 1;
            break;

        case "go to two":
            sphere = 2;
            break;

        case "go to three":
            sphere = 3;
            break;

        case "go to four":
            sphere = 4;
            break;

        case "go to five":
            sphere = 5;
            break;

        case "go to six":
            sphere = 6;
            break;

        case "go to seven":
            sphere = 7;
            break;

        case "go to eight":
            sphere = 8;
            break;

        case "go to nine":
            sphere = 9;
            break;

        case "go to ten":
            sphere = 10;
            break;

        case "go to eleven":
            sphere = 11;
            break;

        case "go to twelve":
            sphere = 12;
            break;

        case "go to thirteen":
            sphere = 13;
            break;

        case "go to fourteen":
            sphere = 14;
            break;

        case "go to fifteen":
            sphere = 15;
            break;

        case "go to sixteen":
            sphere = 16;
            break;

        case "go to seventeen":
            sphere = 17;
            break;

        case "go to eighteen":
            sphere = 18;
            break;

        case "go to nineteen":
            sphere = 19;
            break;

        case "go to twenty":
            sphere = 20;
            break;

        case "go to twenty one":
            sphere = 21;
            break;

        case "go to twenty two":
            sphere = 22;
            break;

        case "go to twenty three":
            sphere = 23;
            break;

        case "go to twenty four":
            sphere = 24;
            break;

        case "go to twenty five":
            sphere = 25;
            break;

        case "go to twenty six":
            sphere = 26;
            break;

        case "go to twenty seven":
            sphere = 27;
            break;

        case "go to twenty eight":
            sphere = 28;
            break;

        case "go to twenty nine":
            sphere = 29;
            break;

        case "go to thirty":
            sphere = 30;
            break;

        case "go to thirty one":
            sphere = 31;
            break;

        case "go to target":
            nav.Target();
            break;

        case "reset":
            nav.Reset();

            break;
        }
        if (sphere != -1)
        {
            nav.ProcessCommand(sphere);
        }
    }
 void IMixedRealitySpeechHandler.OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     ShowVisualFeedback(eventData.Command.Keyword);
 }
Exemple #30
0
 public void OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     onClicked.OnNext(Unit.Default);
 }