Advertisement
Guest User

Untitled

a guest
Mar 17th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.12 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. namespace HoloToolkit.Unity.InputModule
  6. {
  7.    
  8.  
  9.     public class HighlightCreator : MonoBehaviour, ISpeechHandler {
  10.  
  11.         public GameObject go;
  12.         void Start()
  13.         {
  14.             Instantiate(go, new Vector3(0f, 0f, 2f), Quaternion.Euler(new Vector3(0, 90, 0)));
  15.             go.transform.localScale = new Vector3(0.01f, 0.1f, 0.1f);
  16.         }
  17.  
  18.         public void createHighlight(string keyWord)
  19.         {
  20.             switch (keyWord.ToLower())
  21.             {
  22.                 case "next item":
  23.                     Debug.Log("Next Item");
  24.                     Instantiate(go, new Vector3(0f, 0.5f, 2f), Quaternion.Euler(new Vector3(0, 90, 0)));
  25.                     break;
  26.  
  27.                 case "remove all":
  28.                     Debug.Log("Remove all");
  29.                     Destroy(this.go);
  30.                     break;
  31.             }  
  32.                
  33.         }
  34.  
  35.         public void OnSpeechKeywordRecognized(SpeechEventData eventData)
  36.         {
  37.             createHighlight(eventData.RecognizedText);
  38.         }
  39.  
  40.     }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement