예제 #1
0
 IEnumerator CreateNeighbourhood()
 {
     //se agregan los vecinos a las listas
     foreach (var sl in maze)
     {
         var cols = Physics.OverlapSphere(sl.transform.position, 30);
         foreach (var neigh in cols)
         {
             if (neigh.gameObject != sl.gameObject)
             {
                 sl.links.Add(neigh.GetComponent <Slot>());
             }
         }
     }
     //se inicia el DFS para crear el laberinto
     StartCoroutine(DFS.DeepFirstSearch(maze[0]));
     yield return(null);
 }
예제 #2
0
 bool CalculatePathDFS(Vector3 endPos)
 {
     if (endPos != null)
     {
         var dfs = _dfs.DeepFirstSearch(FindNearNode(transform.position), FindNearNode(endPos));
         if (dfs != null)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }