示例#1
0
 private void ResolvePathRequest(PathRequest request)
 {
     try
     {
         if (SearchForPath(request))
         {
             var fromCell = request.From;
             var toCell   = request.To;
             if (fromCell != null && toCell != null)
             {
                 var path = new List <IPathFindableCell> {
                     toCell
                 };
                 var current = toCell;
                 while (current != fromCell)
                 {
                     current = current.PathFrom;
                     path.Add(current);
                 }
                 path.Reverse();
                 request.PopulatePath(path);
             }
         }
         else
         {
             request.MarkPathInvalid();
         }
     }
     catch (Exception ex)
     {
         Debug.LogError(ex);
         _currentTask = null;
     }
 }