private float IntersectsWithDistance(Zombie a, IPlayer b) { if (a.x < b.X - 16) return float.NaN; if (a.x > b.X + 16) return float.NaN; if (a.x < b.Y - 16) return float.NaN; if (a.x > b.Y + 16) return float.NaN; double distance = (a.x - b.X) * (a.x - b.X) + (a.y - b.Y) * (a.y - b.Y); if (distance <= 16) return (float)distance; return float.NaN; }
private bool Intersects(Zombie a, IPlayer b) { return (IntersectsWithDistance(a, b) != float.NaN); }