Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {//if not idle, then move(2 states)
        if (!isIdle)
        {
            try
            {
                thisAgent.SetDestination(currentGoal.transform.position);
            }
            catch { }
        }
        //looks at player or current goal
        if (player && lookAtPLayer)
        {
            transform.LookAt(player.transform.position);
        }
        else if (currentGoal != null)
        {
            transform.LookAt(currentGoal.transform.position);
        }

        if (thisAgent.remainingDistance < 0.9)
        {
            director.ReachedDestination(this);
        }
    }