Merge pull request #11487 from reaperrr/bldg-shape-prep

Improve Rectangle HitShape customizability
This commit is contained in:
Matthias Mailänder
2016-07-10 17:09:31 +02:00
committed by GitHub
3 changed files with 51 additions and 9 deletions

View File

@@ -30,6 +30,11 @@ namespace OpenRA
return actors.MinByOrDefault(a => (a.CenterPosition - pos).LengthSquared);
}
public static WPos PositionClosestTo(this IEnumerable<WPos> positions, WPos pos)
{
return positions.MinByOrDefault(p => (p - pos).LengthSquared);
}
public static IEnumerable<Actor> FindActorsInCircle(this World world, WPos origin, WDist r)
{
// Target ranges are calculated in 2D, so ignore height differences