Exemplo n.º 1
0
    public void processResult(string result)
    {
        if (result != null && result.Equals(""))
        {
            return;
        }
        else
        {
            result = result.ToLower();
            if (result.Contains("walk") && (result.Contains("to")) || result.Contains("two"))
            {
                Debug.Log("Walking steps");
                bot_Controller.BotMove(new Vector3(5, 0, 5));
            }
            else if (result.Contains("jump"))
            {
                Debug.Log("Jumping");
            }
            else if ((result.Contains("shoot") || result.Contains("short") || result.Contains("fire") ||
                      result.Contains("cute") || result.Contains("shirt") || result.Contains("shout")) && result.Contains("enemy"))
            {
                StartCoroutine(cmd_Shoot());
            }
            else if (result.Contains("follow me"))
            {
                Debug.Log("Following Player");
                bot_Controller.FollowMe();
            }
            else if (result.Contains("follow enemy") || result.Contains("photo enemy"))
            {
                GameObject[] enemys = GameObject.FindGameObjectsWithTag("enemy");
                if (enemys.Length > 0)
                {
                    Debug.Log("Following Enemy");
                    bot_Controller.FollowEnemy(enemys [0]);
                }
                else
                {
                    Debug.Log("No Enemy");
                }
            }
            else if (result.Contains("reload"))
            {
                bot_Controller.Reload();
            }
            else if ((result.Contains("ammo") || result.Contains("bullets")) &&
                     (result.Contains("give") || result.Contains("lend") || result.Contains("gimme") || result.Contains("learn")))
            {
                weaponManager.m_CurrentWeapon.m_CurrentRound++;
                bot_Controller.Reload();
            }
            else if ((result.Contains("shoot") || result.Contains("short") || result.Contains("show") || result.Contains("fire") ||
                      result.Contains("cute") || result.Contains("destroy") || result.Contains("sure") || result.Contains("shirt") || result.Contains("shout")))
            {
                if (result.Contains("door") || result.Contains("gate"))
                {
                    GameObject enemy = GameObject.Find("_door");
                    bot_Controller.Shoot(enemy);
                }

                if (result.Contains("enemy"))
                {
                    StartCoroutine(cmd_Shoot());
                }

                if (result.Contains("red") || result.Contains("trade"))
                {
                    GameObject red = GameObject.FindGameObjectWithTag("target_red");
                    if (red != null)
                    {
                        Debug.Log("shooting targets");
                        bot_Controller.Shoot_obj(red);
                    }
                }
                if (result.Contains("blue") || result.Contains("clue"))
                {
                    GameObject red = GameObject.FindGameObjectWithTag("target_blue");
                    if (red != null)
                    {
                        Debug.Log("shooting targets");
                        bot_Controller.Shoot_obj(red);
                    }
                }
                if (result.Contains("green") || result.Contains("grain") || result.Contains("crane") || result.Contains("train"))
                {
                    GameObject red = GameObject.FindGameObjectWithTag("target_green");
                    if (red != null)
                    {
                        Debug.Log("shooting targets");
                        bot_Controller.Shoot_obj(red);
                    }
                }
                if (result.Contains("black"))
                {
                    GameObject red = GameObject.FindGameObjectWithTag("target_black");
                    if (red != null)
                    {
                        Debug.Log("shooting targets");
                        bot_Controller.Shoot_obj(red);
                    }
                }
                if (result.Contains("white"))
                {
                    GameObject red = GameObject.FindGameObjectWithTag("target_white");
                    if (red != null)
                    {
                        Debug.Log("shooting targets");
                        bot_Controller.Shoot_obj(red);
                    }
                }
            }
        }
    }