private void SetDestination()
    {
        if (waypointsVisited > 0)
        {
            ConnectedWaypoint nextWaypoint = currentWaypoint.nextWaypoint(previousWaypoint);
            previousWaypoint = currentWaypoint;
            currentWaypoint  = nextWaypoint;
        }

        Vector3 target = currentWaypoint.transform.position;

        _navMeshAgent.SetDestination(target);
        _traveling = true;

        if (currentWaypoint.name == "PlayerPoint")
        {
            _navMeshAgent.isStopped = true;
            gameObject.GetComponent <EnemyMove>();
            Debug.Log("hello");
        }
    }
示例#2
0
    private void SetDestination()
    {
        if (_waypointsVisited > 0)
        {
            ConnectedWaypoint nextWaypoint = _currentWaypoint.nextWaypoint(_previousWaypoint);
            _previousWaypoint = _currentWaypoint;
            _currentWaypoint  = nextWaypoint;
        }

        Vector3 targetVector = _currentWaypoint.transform.position;

        _navMeshAgent.SetDestination(targetVector);
        _travelling = true;
    }