示例#1
0
        /// <summary>
        /// Called by Unity.
        /// </summary>
        public void Start()
        {
            // Try to find the painter
            agentS  = Component.FindObjectOfType <Agent>();
            painter = Component.FindObjectOfType <WeightPainter>();
            recog.actions.Add("Mover", Move);
            recog.actions.Add("Crear ciudad", CreateCity);
            recog.actions.Add("Elegir Destino", destinoCity);
            recog.actions.Add("Mostrar telaraña", showWeb);
            recog.actions.Add("Ocultar telaraña", hideWeb);
            recog.actions.Add("Desactivar Diagonales", deactivateDiagonals);
            recog.actions.Add("Activar Diagonales", activateDiagonals);
            recog.actions.Add("Modificar Ciudad", modifyCity);
            recog.actions.Add("Iniciar", caminar);
            for (int i = 1; i < 31; i++)
            {
                recog.dic.Add(Convert.ToString(i));
            }

            keywordRecognizer = new KeywordRecognizer(recog.actions.Keys.ToArray());
            keywordRecognizer.OnPhraseRecognized += RecognizedSpeech;


            keywordRecognizer2 = new KeywordRecognizer(recog.dic.ToArray());

            keywordRecognizer.Start();
        }
示例#2
0
        private void RecognizedDestinationSizeY(PhraseRecognizedEventArgs speech)
        {
            Debug.Log(speech.text);
            tileY = Convert.ToInt32(speech.text);
            if (y <= gridY)
            {
                keywordRecognizer2.Stop();
                Tile temp = ReturnTile(tileX - 1, tileY - 1);
                if (temp.IsWalkable)
                {
                    painter = null;
                    onTileHover(temp);

                    final = Resources.Load <Sprite>("final");

                    temp.GetComponent <SpriteRenderer>().sprite = final;
                    FindObjectOfType <AudioManager>().Play("posDestinoModif");
                    keywordRecognizer2.OnPhraseRecognized -= RecognizedDestinationSizeY;
                }
                else
                {
                    FindObjectOfType <AudioManager>().Play("errorColDestino");
                }
            }
            else
            {
                FindObjectOfType <AudioManager>().Play("errorColDestino");
            }
        }
示例#3
0
 /// <summary>
 /// Called by Unity.
 /// </summary>
 public void Start()
 {
     // Try to find the painter
     painter = Component.FindObjectOfType <WeightPainter>();
 }