Esempio n. 1
0
 /// <summary>
 /// Resets the algorithm for a new location.
 /// </summary>
 private void Reset(Vector2Int start, Vector2Int goal)
 {
     //Creates an heap the size of the map
     m_heap = new MinHeap(Map.GetSize());
     Map.Reset();
     m_goal                  = goal;
     Start                   = start;
     m_previousStart         = Start;
     Map.GetNode(m_goal).Rhs = 0;
     m_heap.Insert(m_goal, CalculatePriority(m_goal));
     m_travelledDistance = 0;
 }
Esempio n. 2
0
 /// <summary>
 /// Checks if one of the coordinates contains an obstacle
 /// </summary>
 private static bool CheckIfNodeContainsObstacle(List <Vector2Int> passingCoordinates, NavigationGraph map)
 {
     foreach (Vector2Int coordinate in passingCoordinates)
     {
         if (map.GetNode(coordinate).IsObstacle())
         {
             // There is a wall in the colliding line
             return(true);
         }
     }
     // No wall is found between these coordinates
     return(false);
 }