Beispiel #1
0
 public void RequestPath(GridMotor motor, Transform target, OnPathFound callback)
 {
     if (null != callback)
     {
         if (!isSearching)
         {
             OnSearchStart(new PathRequest()
             {
                 motor = motor, source = motor.transform.position, target = target.position, callback = callback
             });
         }
         else
         {
             requests.Enqueue(new PathRequest()
             {
                 motor = motor, source = motor.transform.position, target = target.position, callback = callback
             });
         }
     }
 }
Beispiel #2
0
 public PathFinder(IFindPath unit, Vector2Int _finish) : this(unit.GridPosition, _finish, unit.MaxHeight)
 {
     onPathfound    = unit.OnPathFound;
     onPathNotFound = unit.OnPathNotFound;
 }