using UnityEngine; namespace Wwise.Wooduan.Components { public class AkCircularRoom : AkRoom { public float radius = 5; internal override AkSpace FindSpaceAtPosition(Vector3 position) { if (!isActiveAndEnabled || IsCulled) return null; var position2D = new Vector2(position.x, position.z); var center = transform.position; var center2D = new Vector2(center.x, center.z); return Vector2.Distance(position2D, center2D) <= radius ? this : null; } private void OnDrawGizmosSelected() { var defaultMatrix = Gizmos.matrix; Gizmos.matrix = transform.localToWorldMatrix; Gizmos.color = Physics2D.colliderAwakeColor; var beginPoint = Vector3.zero; var firstPoint = Vector3.zero; for (float theta = 0; theta < 2 * Mathf.PI; theta += 0.01f) { var x = radius * Mathf.Cos(theta); var z = radius * Mathf.Sin(theta); var endPoint = new Vector3(x, 0, z); if (theta == 0) firstPoint = endPoint; else Gizmos.DrawLine(beginPoint, endPoint); beginPoint = endPoint; } Gizmos.DrawLine(firstPoint, beginPoint); Gizmos.matrix = defaultMatrix; } } }