using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// AABB碰撞盒 /// public class PhysicsBox : PhysicsPrimitive { public override PrimitiveType Type { get { return PrimitiveType.Box; } } [SerializeField] private Vector3 m_Size; public Vector3 Size { get { return m_Size; } } public float Long { get { return m_Size.x; } } public float Wide { get { return m_Size.z; } } public float Height { get { return m_Size.y; } } public bool m_DrawGizmo = true; public float Top { get { return Position.y + Height / 2f; } } public float Left { get { return Position.x - Long / 2f; } } public float Right { get { return Position.x + Long / 2f; } } public float Bottom { get { return Position.y - Height / 2f; } } public void OnDrawGizmos() { if (!m_IsActive || !m_DrawGizmo) return; Vector3 pos = Position; Gizmos.color = m_HintColor; Gizmos.DrawCube(pos, m_Size); //Gizmos.color = Color.blue; //Gizmos.DrawSphere(pos, 0.1f); } private void Start() { base.OnInit(); } }