예제 #1
0
    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);
        }
    }
예제 #2
0
 private void BuildRoads()
 {
     _endTile = tileRoots[1].GetComponentsInChildren <RoadTile>().First(x => x.isEnd == true);
     GetComponent <NavMeshSurface>().BuildNavMesh();
     _endTile.PropagateRoad(null);
 }