/// <summary> /// Check if there is a circle overlap between two circlecolliders /// </summary> /// <param name="a">Collider a</param> /// <param name="b">Collider b</param> /// <returns>Returns true if an overlap is found</returns> protected static bool CircleOverlap(CircleCollider a, CircleCollider b) { float sqrRad = (a.Radius + b.Radius) * (a.Radius + b.Radius); Vector2 aPos = new Vector2(a.Entity.Position.X, a.Entity.Position.Y); Vector2 bPos = new Vector2(b.Entity.Position.X, b.Entity.Position.Y); if (Vector2.DistanceSquared(aPos, bPos) < sqrRad) { return(true); } return(false); }
/// <summary> /// Check if there is an overlap between a circle collider and the tilemap /// </summary> /// <param name="circle">Collider a</param> /// <param name="level">The tilemap</param> /// <returns>Returns true if an overlap is found</returns> public static bool CircleTilemapOverlap(CircleCollider circle, Level level) { // I'm not doing this, everything's a box now return(BoxTilemapOverlap(circle, level)); }