public static void DeactivateGrid(InvaderGrid pGrid) { Debug.Assert(pGrid != null); // Remove from SpriteBatch // Find the SBNode Debug.Assert(pGrid.pProxySprite != null); SpriteBaseNode pSBNode = pGrid.pProxySprite.GetSBNode(); // Remove it from the manager Debug.Assert(pSBNode != null); SpriteBatchManager.Remove(pSBNode); // Remove collision sprite from spriteBatch Debug.Assert(pGrid.poColObj != null); Debug.Assert(pGrid.poColObj.pColSprite != null); pSBNode = pGrid.poColObj.pColSprite.GetSBNode(); Debug.Assert(pSBNode != null); SpriteBatchManager.Remove(pSBNode); GameObjectManager.NonTreeRemove(pGrid); ForwardIterator pFwdItor = new ForwardIterator(pGrid); GameObject pGameObj = (GameObject)pFwdItor.Next(); while (!pFwdItor.IsDone()) { // Remove from SpriteBatch // Find the SBNode Debug.Assert(pGameObj.pProxySprite != null); pSBNode = pGameObj.pProxySprite.GetSBNode(); // Remove it from the manager Debug.Assert(pSBNode != null); SpriteBatchManager.Remove(pSBNode); // Remove collision sprite from spriteBatch Debug.Assert(pGameObj.poColObj != null); Debug.Assert(pGameObj.poColObj.pColSprite != null); pSBNode = pGameObj.poColObj.pColSprite.GetSBNode(); Debug.Assert(pSBNode != null); SpriteBatchManager.Remove(pSBNode); GameObjectManager.NonTreeRemove(pGameObj); pGameObj = (GameObject)pFwdItor.Next(); } }