// Token: 0x06001C37 RID: 7223 RVA: 0x00083A1C File Offset: 0x00081C1C public static Vector3 RandomColliderVolumePoint(Collider collider) { Transform transform = collider.transform; Vector3 vector = Vector3.zero; if (collider is BoxCollider) { BoxCollider boxCollider = (BoxCollider)collider; Vector3 size = boxCollider.size; Vector3 center = boxCollider.center; vector = new Vector3(center.x + UnityEngine.Random.Range(size.x * -0.5f, size.x * 0.5f), center.y + UnityEngine.Random.Range(size.y * -0.5f, size.y * 0.5f), center.z + UnityEngine.Random.Range(size.z * -0.5f, size.z * 0.5f)); } else if (collider is SphereCollider) { SphereCollider sphereCollider = (SphereCollider)collider; vector = sphereCollider.center + UnityEngine.Random.insideUnitSphere * sphereCollider.radius; } else if (collider is CapsuleCollider) { CapsuleCollider capsuleCollider = (CapsuleCollider)collider; float radius = capsuleCollider.radius; float num = Mathf.Max(capsuleCollider.height - radius, 0f); float num2 = Util.CalculateSphereVolume(radius); float num3 = Util.CalculateCylinderVolume(radius, num); float max = num2 + num3; if (UnityEngine.Random.Range(0f, max) <= num2) { vector = UnityEngine.Random.insideUnitSphere * radius; float num4 = ((float)UnityEngine.Random.Range(0, 2) * 2f - 1f) * num * 0.5f; switch (capsuleCollider.direction) { case 0: vector.x += num4; break; case 1: vector.y += num4; break; case 2: vector.z += num4; break; } } else { Vector2 vector2 = UnityEngine.Random.insideUnitCircle * radius; float num5 = UnityEngine.Random.Range(num * -0.5f, num * 0.5f); switch (capsuleCollider.direction) { case 0: vector = new Vector3(num5, vector2.x, vector2.y); break; case 1: vector = new Vector3(vector2.x, num5, vector2.y); break; case 2: vector = new Vector3(vector2.x, vector2.y, num5); break; } } vector += capsuleCollider.center; } else if (collider is CharacterController) { CharacterController characterController = (CharacterController)collider; float radius2 = characterController.radius; float num6 = Mathf.Max(characterController.height - radius2, 0f); float num7 = Util.CalculateSphereVolume(radius2); float num8 = Util.CalculateCylinderVolume(radius2, num6); float max2 = num7 + num8; if (UnityEngine.Random.Range(0f, max2) <= num7) { vector = UnityEngine.Random.insideUnitSphere * radius2; float num9 = ((float)UnityEngine.Random.Range(0, 2) * 2f - 1f) * num6 * 0.5f; vector.y += num9; } else { Vector2 vector3 = UnityEngine.Random.insideUnitCircle * radius2; float y = UnityEngine.Random.Range(num6 * -0.5f, num6 * 0.5f); vector = new Vector3(vector3.x, y, vector3.y); } vector += characterController.center; } return(transform.TransformPoint(vector)); }