public static void Aoe(this World world, Position pos, float radius, bool players, Action <Entity> callback) //Null for player { if (players) { foreach (Entity i in world.PlayersCollision.HitTest(pos.X, pos.Y, radius)) { if (i is Pet) { continue; } double d = MathsUtils.Dist(i.X, i.Y, pos.X, pos.Y); if (d < radius) { callback(i); } } } else { foreach (Entity i in world.EnemiesCollision.HitTest(pos.X, pos.Y, radius)) { if (!(i is Enemy)) { continue; } double d = MathsUtils.Dist(i.X, i.Y, pos.X, pos.Y); if (d < radius) { callback(i); } } } }
public static bool AnyPlayerNearby(this World world, double x, double y) { foreach (Player i in world.PlayersCollision.HitTest(x, y, 16).OfType <Player>()) { double d = MathsUtils.Dist(i.X, i.Y, x, y); if (d < 16 * 16) { return(true); } } return(false); }