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 }); } } }
public PathFinder(IFindPath unit, Vector2Int _finish) : this(unit.GridPosition, _finish, unit.MaxHeight) { onPathfound = unit.OnPathFound; onPathNotFound = unit.OnPathNotFound; }