Esempio n. 1
0
        //----------------------------------------------------------------------------------
        // Virtual Methods
        //----------------------------------------------------------------------------------
        public virtual void Remove()
        {
            // Keenan(delete.A)
            // -----------------------------------------------------------------
            // Very difficult at first... if you are messy, you will pay here!
            // Given a game object....
            // -----------------------------------------------------------------

            //Debug.WriteLine("REMOVE: {0}", this);

            // Remove from SpriteBatch

            // Find the SpriteNode
            Debug.Assert(this.pProxySprite != null);
            SpriteNode pSpriteNode = this.pProxySprite.GetSpriteNode();

            // Remove it from the manager
            Debug.Assert(pSpriteNode != null);
            SpriteNodeBatchManager.Remove(pSpriteNode);

            // Remove collision sprite from spriteBatch

            Debug.Assert(this.poCollObj != null);
            Debug.Assert(this.poCollObj.pCollSprite != null);
            pSpriteNode = this.poCollObj.pCollSprite.GetSpriteNode();

            Debug.Assert(pSpriteNode != null);
            SpriteNodeBatchManager.Remove(pSpriteNode);

            // Remove from GameObjectMan

            GameObjectManager.Remove(this);
        }