public void DoDrawGizmos() { if (m_Current != null) { hwmQuadtree <T> .Node gizmosNode = GetDisplayNode(); Gizmos.color = m_GizmosColor; hwmUtility.GizmosDrawBox2D(gizmosNode.GetLooseBox(), m_GizmosZ); DoDrawGizomsElements(gizmosNode); } }
public void EatFood(float radius) { ms_FoodQuadtreeNodes.Clear(); hwmBox2D eatAABB = hwmBox2D.BuildAABB(m_Head.GetPosition(), new Vector2(radius, radius)); slWorld.GetInstance().GetFoodSystem().GetQuadtree().GetRootNode().GetAllIntersectNode(ref ms_FoodQuadtreeNodes, eatAABB); hwmSphere2D headSphere = new hwmSphere2D(m_Head.GetPosition(), radius); for (int iNode = 0; iNode < ms_FoodQuadtreeNodes.Count; iNode++) { hwmQuadtree <slFood> .Node iterNode = ms_FoodQuadtreeNodes[iNode]; hwmBetterList <slFood> foods = iterNode.GetElements(); bool inHeadSphere = headSphere.IsInside(iterNode.GetLooseBox()); for (int iFood = foods.Count - 1; iFood >= 0; iFood--) { slFood iterFood = foods[iFood]; if (inHeadSphere || (iterFood.GetPosition() - m_Head.GetPosition()).sqrMagnitude <= radius * radius) { EatFood(iterFood); } } } }