Ejemplo n.º 1
0
    public void SetDesination()
    {
        if (patroling)
        {
            if (wayPointsVisited > 0)
            {
                wayPointConnect newWayPoint = currentWayPoint.NextWayPoint(previousWayPoint);
                previousWayPoint = currentWayPoint;
                currentWayPoint  = newWayPoint;
            }

            Vector3 targetVector = currentWayPoint.transform.position;
            navMeshAgent.SetDestination(targetVector);
            isTravelling = true;
        }

        else if (isApproaching)
        {
            transform.LookAt(player.transform);
            navMeshAgent.isStopped = true;
            navMeshAgent.SetDestination(player.transform.position);
            navMeshAgent.isStopped = false;
        }

        else if (isAttacking)
        {
            navMeshAgent.isStopped = true;
        }

        else
        {
            Debug.Log("NOT SURE WHERE I'M GOING");
        }
    }
Ejemplo n.º 2
0
    private void SetDesination()
    {
        if (patroling)
        {
            if (wayPointsVisited > 0)
            {
                wayPointConnect newWayPoint = currentWayPoint.NextWayPoint(previousWayPoint);
                previousWayPoint = currentWayPoint;
                currentWayPoint  = newWayPoint;
            }

            Vector3 targetVector = currentWayPoint.transform.position;
            navMeshAgent.SetDestination(targetVector);
            isTravelling = true;
        }
    }