public virtual void Reset() { Debug.Assert(this.poProxySprite != null); SBNode pSBNode = this.poProxySprite.GetSBNode(); Debug.Assert(pSBNode != null); SpriteBatchMan.RemoveSprite(pSBNode); Debug.Assert(this.poColObj != null); Debug.Assert(this.poColObj.pColSprite != null); pSBNode = this.poColObj.pColSprite.GetSBNode(); Debug.Assert(pSBNode != null); SpriteBatchMan.RemoveSprite(pSBNode); GONodeMan.Dettach(this); }
//intially had this in each of my objects(D.R.Y) //to remove Sprite & its collision box //from the sprite batches and GO node man public virtual void Remove() { //Debug.WriteLine("Remove: {0}", this); Debug.Assert(this.poProxySprite != null); SBNode pSBNode = this.poProxySprite.GetSBNode(); Debug.Assert(pSBNode != null); SpriteBatchMan.RemoveSprite(pSBNode); Debug.Assert(this.poColObj != null); Debug.Assert(this.poColObj.pColSprite != null); pSBNode = this.poColObj.pColSprite.GetSBNode(); Debug.Assert(pSBNode != null); SpriteBatchMan.RemoveSprite(pSBNode); GONodeMan.Dettach(this); //then add it to a graveyard to use later GraveyardMan.Bury(this); }