Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (UnitySphinx.GetSearchModel() == "kws")
        {
            str = UnitySphinx.DequeueString();
            print("listening for keyword");
            if (str != "")
            {
                UnitySphinx.SetSearchModel(UnitySphinx.SearchModel.jsgf);
                //guitext.text = "order up";
                print(str);
            }
        }

        /*
         * else if (UnitySphinx.GetSearchModel() == "jsgf")
         * {
         *  if (str!="")
         *  {
         *      Vector3 v;
         *      if (str == "ALAXA")
         *          v = new Vector3(0, 0.5f, 0);
         *      else if (str == "AYNACHA")
         *          v = new Vector3(0, -0.5f, 0);
         *      else if (str == "KUPI")
         *          v = new Vector3(0.5f, 0, 0);
         *      else v = new Vector3(-0.5f, 0, 0);
         *
         *      transform.position += v;
         *      print("de prueba " + str);
         *  }
         *
         *
         * }*/
    }
Exemplo n.º 2
0
 void Update()
 {
     str = UnitySphinx.DequeueString();
     if (UnitySphinx.GetSearchModel() == "kws")
     {
         print("listening for keyword");
         if (str != "")
         {
             UnitySphinx.SetSearchModel(UnitySphinx.SearchModel.jsgf);
             guitext.text = "order up";
             print(str);
         }
     }
     else if (UnitySphinx.GetSearchModel() == "jsgf")
     {
         print("listening for order");
         if (str != "")
         {
             guitext.text = str;
             char[]     delimChars = { ' ' };
             string[]   cmd        = str.Split(delimChars);
             int        numAnimals = interpretNum(cmd [0]);
             GameObject animal     = interpretAnimal(cmd [1]);
             for (int i = 0; i < numAnimals; i++)
             {
                 Vector3 randPos =
                     new Vector3(spawn.position.x + UnityEngine.Random.Range(-0.1f, 0.1f),
                                 spawn.position.y + UnityEngine.Random.Range(-0.1f, 0.1f),
                                 spawn.position.z + UnityEngine.Random.Range(-0.1f, 0.1f));
                 Instantiate(animal, randPos, spawn.rotation);
             }
             UnitySphinx.SetSearchModel(UnitySphinx.SearchModel.kws);
         }
     }
 }
Exemplo n.º 3
0
 void Awake()
 {
     if (instance != null)
     {
         Debug.LogError("There is more than one instance of UnitySphinx in this scene.");
     }
     instance = this;
 }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     if (!UnitySphinx.IsInitialized())
     {
         UnitySphinx.Init();
     }
     UnitySphinx.Run();
 }
 // Use this for initialization
 void Start()
 {
     jsgf = Application.dataPath + "/Resources/UnitySphinx/model/en-us/movement.gram";
     kws  = Application.dataPath + "/Resources/UnitySphinx/model/en-us/keyphrase.list";
     UnitySphinx.Init(jsgf, kws);
     UnitySphinx.Run();
     direction     = 0f;
     meters        = 0f;
     startposition = 0f;
     velocity      = 0f;
 }
Exemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        Vector3    fwd = transform.TransformDirection(Vector3.forward);
        RaycastHit Hit;


        if (Physics.Raycast(transform.position, fwd, out Hit, 100f))
        {
            string str         = UnitySphinx.DequeueString();
            bool   morirpuma   = false;
            bool   corrergente = false;
            if (UnitySphinx.GetSearchModel() == "jsgf")
            {
                if (str != "")
                {
                    if (str == "THANTHA TITI")
                    {
                        morirpuma = true;
                    }
                    else if (str == "SINTI TITI")
                    {
                        corrergente = true;
                        pumasmuertos++;
                    }

                    print(str);
                }
            }

            if (Hit.collider.gameObject.tag == "Highlightable" && morirpuma)
            {
                Debug.Log("puma hiteado");
                Hit.collider.gameObject.GetComponent <Perseguir>().Highlighted = true;
                Destroy(Hit.collider.gameObject);
                pumasmuertos++;
                if (pumasmuertos >= 15)
                {
                    SceneManager.LoadScene("Menu");
                }
            }

            if (Hit.collider.gameObject.tag.Equals("Escapador") && corrergente)
            {
                Debug.Log("roboot hiteado");

                Hit.collider.gameObject.GetComponent <Corredor>().Correr = true;
                // Destroy(Hit.collider.gameObject);
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        str = UnitySphinx.DequeueString();
        if (UnitySphinx.GetSearchModel() == "kws")
        {
            //print("listening for keyword");
            if (str != "")
            {
                if (str.IndexOf("movement") != -1)
                {
                    UnitySphinx.Stop();
                    jsgf = Application.dataPath + "/Resources/UnitySphinx/model/en-us/movement.gram";
                    UnitySphinx.Init(jsgf, kws);
                    UnitySphinx.Run();
                    UnitySphinx.SetSearchModel(UnitySphinx.SearchModel.jsgf);
                }
                if (str.IndexOf("rotation") != -1)
                {
                    UnitySphinx.Stop();
                    jsgf = Application.dataPath + "/Resources/UnitySphinx/model/en-us/rotation.gram";
                    UnitySphinx.Init(jsgf, kws);
                    UnitySphinx.Run();
                    UnitySphinx.SetSearchModel(UnitySphinx.SearchModel.jsgf);
                }

                print(str);
            }
        }
        else if (UnitySphinx.GetSearchModel() == "jsgf")
        {
            print("listening for order");

            if (str != "")
            {
                if (str.IndexOf("move") != -1)
                {
                    startposition = 0f;
                    if (str.IndexOf("up") != -1)
                    {
                        direction = 1;
                    }
                    else if (str.IndexOf("down") != -1)
                    {
                        direction = -1;
                    }
                    if (str.IndexOf("one") != -1)
                    {
                        meters = 1;
                    }
                    if (str.IndexOf("two") != -1)
                    {
                        meters = 2;
                    }
                    else if (str.IndexOf("three") != -1)
                    {
                        meters = 3;
                    }
                    else if (str.IndexOf("four") != -1)
                    {
                        meters = 4;
                    }
                }

                if (str.IndexOf("rotate") != -1)
                {
                    if (str.IndexOf("right") != -1)
                    {
                        direction = 1;
                    }
                    else if (str.IndexOf("left") != -1)
                    {
                        direction = -1;
                    }
                    if (str.IndexOf("fast") != -1)
                    {
                        velocity = 4;
                    }
                    if (str.IndexOf("slow") != -1)
                    {
                        velocity = 1;
                    }
                }
                if (str.IndexOf("exit") != -1)
                {
                    meters    = 0;
                    direction = 0;
                    velocity  = 0f;
                    UnitySphinx.SetSearchModel(UnitySphinx.SearchModel.kws);
                }
                print(str);
            }

            if (startposition <= meters)
            {
                startposition = startposition + 0.05f;
                transform.Translate(0, 0, direction * 0.05f);
            }
            transform.Rotate(0, 0, direction * velocity * Time.deltaTime * 50);
        }
    }
Exemplo n.º 8
0
 // Use this for initialization
 void Start()
 {
     guitext = GetComponent <GUIText> ();
     UnitySphinx.Init();
     UnitySphinx.Run();
 }
Exemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     //UnitySphinx.Init();
     UnitySphinx.Run();
     UnitySphinx.SetSearchModel(UnitySphinx.SearchModel.jsgf);
 }