//---------------------------------------------------------------------------------- // Static Methods //---------------------------------------------------------------------------------- public static void Collide(GameObject pTreeNodeA, GameObject pTreeNodeB) { // Cache A & B GameObject pNodeA = pTreeNodeA; GameObject pNodeB = pTreeNodeB; while (pNodeA != null) { // Start back at the top pNodeB = pTreeNodeB; while (pNodeB != null) { //Debug.WriteLine("ColPair: test: {0}, {1}", pNodeA.GetName(), pNodeB.GetName()); // Get Rectangles CollRect rectA = pNodeA.GetCollObj().poColRect; CollRect rectB = pNodeB.GetCollObj().poColRect; // Check if (CollRect.Intersect(rectA, rectB)) { // Success, liftoff!! pNodeA.Accept(pNodeB); break; } pNodeB = (GameObject)Iterator.GetSibling(pNodeB); } pNodeA = (GameObject)Iterator.GetSibling(pNodeA); } }