public void OnPathFound(Vector3[] newPath, bool pathSuccessful) { if (pathSuccessful) { path = newPath; targetIndex = 0; StopCoroutine("FollowPath"); StartCoroutine("FollowPath"); } else { Debug.Log("no path found"); RequestPathManager.ClearQueue(); Destroy(gameObject); } }
private void Awake() { instance = this; pathfinding = GetComponent <FindPath>(); }
private void Start() { RequestPathManager.RequestPath(transform.position, target.position, OnPathFound); }
private void Awake() { requestManager = GetComponent <RequestPathManager>(); grid = GetComponent <Grid3D>(); }