IEnumerator TravelToRoutine(TravelTo travelToNode) { while(true){ //Debug.Log (gameObject); //Debug.Log (nav.destination); //Debug.Log (transform.position); if(nav.remainingDistance > nav.stoppingDistance || nav.pathPending){ yield return null; } else{ travelToNode.ReceiveStatus(Node.Status.Success); break; } } }
//-------------------------------------------------------- public void TravelTo(Vector3 destination, TravelTo travelToNode) { nav.SetDestination(destination); nav.Resume(); StartCoroutine("TravelToRoutine", travelToNode); }