public void PropagateRoad(RoadTile caller) { isVisited = true; if (caller != null) { nextTile = caller; } Collider[] n = Physics.OverlapSphere(transform.position, r, LayerMask.GetMask("Road")); bool isPropagated = false; foreach (Collider neighbour in n) { RoadTile road = neighbour.GetComponentInParent <RoadTile>(); if (!road.isVisited) { road.PropagateRoad(this); isPropagated = true; } } if (!isPropagated) { isStart = true; startParticle.SetActive(true); } }
private void BuildRoads() { _endTile = tileRoots[1].GetComponentsInChildren <RoadTile>().First(x => x.isEnd == true); GetComponent <NavMeshSurface>().BuildNavMesh(); _endTile.PropagateRoad(null); }