//~GameObject() //{ // this.name = GameObject.Name.Uninitialized; // this.poProxySprite = null; //} public virtual void Remove(SpriteBatchMan pSpriteBatchMan) { // 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 SBNode Debug.Assert(this.poProxySprite != null); SBNode pSBNode = this.poProxySprite.GetSBNode(); // Remove it from the manager Debug.Assert(pSBNode != null); pSpriteBatchMan.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); pSpriteBatchMan.Remove(pSBNode); // Remove from GameObjectMan GameObjectMan.Remove(this, pSpriteBatchMan); //GhostMan.Add(this); }
public virtual void Remove() { 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); SpriteBatchMan.Remove(pSpriteNode); // Remove collision sprite from spriteBatch Debug.Assert(this.poColObj != null); Debug.Assert(this.poColObj.pColSprite != null); pSpriteNode = this.poColObj.pColSprite.GetSpriteNode(); Debug.Assert(pSpriteNode != null); SpriteBatchMan.Remove(pSpriteNode); // Remove from GameObjectMan GameObjectMan.Remove(this); //GhostMan.Add(this); }
public static SpriteBatch Replace(SpriteBatch.Name name, SpriteBatch pSB) { SpriteBatchMan pMan = SpriteBatchMan.PrivGetInstance(); Debug.Assert(pMan != null); pMan.poNodeCompare.SetName(name); SpriteBatch pData = (SpriteBatch)pMan.BaseFind(pMan.poNodeCompare); SpriteBatch tmp = pData; SpriteBatchMan.Remove(pData); SpriteBatchMan.Add(name, pSB); return(tmp); }
//---------------------------------------------------------------------- // Abstract methods //---------------------------------------------------------------------- public virtual void remove() { //Debug.WriteLine("REMOVE: {0}", this); // remove from SpriteBatch Debug.Assert(this.getProxySprite() != null); SBNode pSBNode = this.getProxySprite().GetSBNode(); // remove it from the manager Debug.Assert(pSBNode != null); SpriteBatchMan.Remove(pSBNode); // remove collision sprite from spriteBatch Debug.Assert(this.poCollisionObject != null); Debug.Assert(this.poCollisionObject.pCollisionSprite != null); pSBNode = this.poCollisionObject.pCollisionSprite.GetSBNode(); Debug.Assert(pSBNode != null); SpriteBatchMan.Remove(pSBNode); // remove from GameObjectMan GameObjectMan.Remove(this); }