Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (GameObject.Find("3rd Person Controller").GetComponent <NavMeshAgent>().enabled == true)
        {
            GetComponent <NavMeshAgent> ().destination = newLocation;


            if ((Vector3.Distance(ThisThing.transform.position, newLocation)) < 2)
            {
                animation.Play("stop");
                if (hasStop)
                {
                    ThisThing.transform.rotation *= Quaternion.AngleAxis(180, transform.up);
                    hasStop = false;
                    MainGUI.showMessage(description, title);
                }
            }
            else
            {
                animation.Play("run");
                hasStop = true;
            }
        }
    }