public ItemObject GetReachableItemByDistance(IntPoint3 location, IItemFilter filter, Unreachables unreachables) { var items = m_items .Where(i => i.IsReserved == false && i.IsInstalled == false && unreachables.IsUnreachable(i.Location) == false) .Where(i => filter.Match(i)) .OrderBy(i => (i.Location - location).ManhattanLength); foreach (var item in items) { var found = AStar.AStarFinder.CanReach(m_env, location, item.Location, DirectionSet.Exact); if (found) return item; unreachables.Add(item.Location); } return null; }
public ItemObject GetReachableItemByDistance(IntVector3 location, IItemFilter filter, Unreachables unreachables) { var items = m_items .Where(i => i.IsReserved == false && i.IsInstalled == false && unreachables.IsUnreachable(i.Location) == false) .Where(i => filter.Match(i)) .OrderBy(i => (i.Location - location).ManhattanLength); foreach (var item in items) { var found = AStar.CanReach(m_env, location, item.Location, DirectionSet.Exact); if (found) { return(item); } unreachables.Add(item.Location); } return(null); }