IEnumerator UpdateTarget() { while (this.target) { RequestPathManager.RequestPath(transform.position, target.position, this.OnPathFound); yield return(new WaitForSeconds(1)); } yield return(null); }
void FixedUpdate() { if (Input.GetKeyDown("r")) { this.transform.position = new Vector3(7, 0, 18); targetIndex = 0; StopCoroutine("FollowPath"); RequestPathManager.RequestPath(transform.position, target.position, this.OnPathFound); } }