public static bool AnyPlayerNearby(this World world, double x, double y, int radius = Player.Radius) { foreach (var i in world.PlayersCollision.HitTest(x, y, radius).Where(e => e is Player)) { var d = MathsUtils.DistSqr(i.X, i.Y, x, y); if (d < radius * radius) { return(true); } } return(false); }
public static bool AnyEnemyNearby(this World world, double x, double y, int radius = Player.Radius) { foreach (var i in world.EnemiesCollision.HitTest(x, y, radius)) { if (!(i is Enemy)) { continue; } var d = MathsUtils.DistSqr(i.X, i.Y, x, y); if (d < radius * radius) { return(true); } } return(false); }