using UnityEngine; namespace AibisDream.MiniGame.Language { public static class ExpressionParticleGeometry { public static bool TryGetSeparation( Bounds first, Bounds second, float padding, out Vector2 direction, out float overlap) { float overlapX = Mathf.Min(first.max.x, second.max.x) - Mathf.Max(first.min.x, second.min.x) + padding; float overlapY = Mathf.Min(first.max.y, second.max.y) - Mathf.Max(first.min.y, second.min.y) + padding; if (overlapX <= 0f || overlapY <= 0f) { direction = Vector2.zero; overlap = 0f; return false; } Vector2 centerDelta = first.center - second.center; if (overlapX <= overlapY) { direction = new Vector2(centerDelta.x >= 0f ? 1f : -1f, 0f); overlap = overlapX; } else { direction = new Vector2(0f, centerDelta.y >= 0f ? 1f : -1f); overlap = overlapY; } return true; } } }