コード例 #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);
        }
コード例 #2
0
        public virtual void Remove()
        {
            Debug.WriteLine("REMOVE GAME OBJECT: {0}", this);

            // Remove proxy sprite from SpriteBatch
            Debug.Assert(this.pProxySprite != null);
            SBNode pSBNode = this.pProxySprite.GetSBNode();

            Debug.Assert(pSBNode != null);
            SpriteBatchManager.Remove(pSBNode);

            // Remove collision sprite box from spriteBatch
            Debug.Assert(this.poColObj != null);
            Debug.Assert(this.poColObj.pColSprite != null);
            pSBNode = this.poColObj.pColSprite.GetSBNode();

            Debug.Assert(pSBNode != null);
            SpriteBatchManager.Remove(pSBNode);

            // Remove from GameObjectMan
            GameObjectManager.Remove(this);

            //add to the ghost manager since it's a dead object
            GhostManager.Add(this);
        }
コード例 #3
0
        public virtual void Remove()
        {
            Debug.Assert(this.pProxySprite != null);
            SpriteBatchNode sbNode = this.pProxySprite.GetSpriteBatchNode();

            Debug.Assert(sbNode != null);
            SpriteBatchManager.Remove(sbNode);
            if (GameManager.GetCollisionBoxes())
            {
                if (this.pCollisionObject.pCollisionSpriteBox.pSpriteBatchNode != null)
                {
                    sbNode = this.pCollisionObject.pCollisionSpriteBox.GetSpriteBatchNode();
                    Debug.Assert(sbNode != null);
                    SpriteBatchManager.Remove(sbNode);
                }
            }
            GameObjectManager.Remove(this);
        }
コード例 #4
0
        public virtual void Remove()
        {
            // Grab a reference to the object's parent
            // We may need to remove it as well if it has no children after this is removed
            GameObject pParent = (GameObject)this.GetParent();

            // Remove from SpriteBatch
            // Find the SBNode
            Debug.Assert(this.pProxySprite != null);
            SpriteBaseNode pSBNode = this.pProxySprite.GetSBNode();

            // Remove it from the manager
            Debug.Assert(pSBNode != null);
            SpriteBatchManager.Remove(pSBNode);

            // Remove collision sprite from spriteBatch

            Debug.Assert(this.poColObj != null);
            Debug.Assert(this.poColObj.pColSprite != null);
            pSBNode = this.poColObj.pColSprite.GetSBNode();

            Debug.Assert(pSBNode != null);
            SpriteBatchManager.Remove(pSBNode);

            // Remove from GameObjectMan
            GameObjectManager.Remove(this);

            // check to see if the parent has any more children
            if (pParent != null && pParent.GetFirstChild() == null)
            {
                // We just removed the last of the parent's children
                // so it is time to remove the parent as well
                pParent.Remove();
            }

            // TODO Add to ghost manager
        }