Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Transform FindNearWith (Transform target)
- {
- if (items.Count == 0) return null;
- Func<Transform, float?> getDist = x => Vector3.Distance (x.position, target.position);
- return items.Aggregate ((curMin, x) => (curMin == null || (getDist (x) ?? float.MaxValue) < getDist (x) ? x : curMin));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement