Esempio n. 1
0
        public static void Remove(SpriteNode pSpriteBatchNode)
        {
            SpriteNodeMan pSpriteNodeMan = pSpriteBatchNode.pBackSpriteNodeMan;

            Debug.Assert(pSpriteNodeMan != null);
            pSpriteNodeMan.Remove(pSpriteBatchNode);
        }
        public virtual void Remove()
        {
            // Keenan(delete.A)
            // -----------------------------------------------------------------
            // Very difficult at first... if you are messy, you will pay here!
            // Given a game object....
            // -----------------------------------------------------------------

            // Remove proxy sprite node from SpriteBatch manager
            Debug.Assert(this.pProxySprite != null);
            SpriteNode pSpriteNode = this.pProxySprite.GetSpriteNode();

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

            // Remove collision sprite node from spriteBatch manager
            Debug.Assert(this.poColObj != null);
            Debug.Assert(this.poColObj.pColSprite != null);
            pSpriteNode = this.poColObj.pColSprite.GetSpriteNode();

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

            // Remove game object node from GameObjectMan
            //Remove from parent composite in derived class remove() instead
            //never need to remove composites from GameObject Manager...right?

            //GameObjectManager.Remove(this);
        }
Esempio n. 3
0
        public SpriteNode Attach(SpriteBase pBase)
        {
            Debug.Assert(this.pNodeMan != null);
            SpriteNode pNode = this.pNodeMan.Attach(pBase);

            return(pNode);
        }
Esempio n. 4
0
        public void Detach(SpriteBase pBase)
        {
            SpriteNode        pNode         = pBase.GetBackSpriteNode();
            SpriteNodeManager pMySBNManager = this.GetSpriteNodeManager();

            pMySBNManager.Remove(pNode);
        }
        override protected void DerivedWashNode(DLink pLink)
        {
            Debug.Assert(pLink != null);
            SpriteNode pNode = (SpriteNode)pLink;

            pNode.Wash();
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
        protected override void derivedWash(DLink pLink)
        {
            Debug.Assert(pLink != null);
            SpriteNode pSpriteNode = (SpriteNode)pLink;

            pSpriteNode.Wash();
        }
Esempio n. 8
0
        public void Dump()
        {
            // Dump - Print contents to the debug output window
            //        Using HASH code as its unique identifier
            Debug.WriteLine("   Name: {0} ({1})", this.pSpriteBase.GetName(), this.GetHashCode());

            if (this.pNext == null)
            {
                Debug.WriteLine("              next: null");
            }
            else
            {
                SpriteNode pTmp = (SpriteNode)this.pNext;
                Debug.WriteLine("              next: {0} ({1})", pTmp.pSpriteBase.GetName(), pTmp.GetHashCode());
            }

            if (this.pPrev == null)
            {
                Debug.WriteLine("              prev: null");
            }
            else
            {
                SpriteNode pTmp = (SpriteNode)this.pPrev;
                Debug.WriteLine("              prev: {0} ({1})", pTmp.pSpriteBase.GetName(), pTmp.GetHashCode());
            }
        }
Esempio n. 9
0
        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);
        }
        override protected void derivedDumpNode(DLink pLink)
        {
            Debug.Assert(pLink != null);
            SpriteNode pData = (SpriteNode)pLink;

            pData.Dump();
        }
Esempio n. 11
0
        protected override void derivedPrint(DLink pLink)
        {
            Debug.Assert(pLink != null);
            SpriteNode pSpriteNode = (SpriteNode)pLink;

            Debug.WriteLine("Sprite-obj-ref : ({0})", pSpriteNode.GetHashCode());
        }
        public static void Remove(SpriteNode pSpriteBatchNode)
        {
            Debug.Assert(pSpriteBatchNode != null);
            SpriteNodeManager pSpriteNodeMan = pSpriteBatchNode.GetSBNodeManager();

            Debug.Assert(pSpriteNodeMan != null);
            pSpriteNodeMan.Remove(pSpriteBatchNode);
        }
        //----------------------------------------------------------------------
        // Override Abstract methods
        //----------------------------------------------------------------------
        override protected DLink DerivedCreateNode()
        {
            DLink pNode = new SpriteNode();

            Debug.Assert(pNode != null);

            return(pNode);
        }
        //----------------------------------------------------------------------
        // Constructor
        //----------------------------------------------------------------------
        public SpriteNodeManager(int reserveNum = 3, int reserveGrow = 1)
            : base() // <--- Kick the can (delegate)
        {
            // At this point SBMan is created, now initialize the reserve
            this.BaseInitialize(reserveNum, reserveGrow);
            this.pBackSpriteBatch = null;

            // initialize derived data here
            this.poNodeCompare = new SpriteNode();
        }
Esempio n. 15
0
        //----------------------------------------------------------------------------------
        // Constructor
        //----------------------------------------------------------------------------------

        public SpriteNodeManager(int initReserve = 3, int growthRate = 1) : base()
        {
            // Delegates inital construction to the manager class, then does the following.

            //round 1 : unsure why this exists at the moment.  I thought : base() covered this territory.
            this.baseInitialize(initReserve, growthRate);

            //round 2 : a compare object attached to a class since there will be multiple batches
            this.poNodeCompare    = new SpriteNode();
            this.pBackSpriteBatch = null;
        }
Esempio n. 16
0
        public SpriteNode Attach(SpriteBase pBase)
        {
            SpriteNode pNode = (SpriteNode)this.baseAdd();

            Debug.Assert(pNode != null);

            // Initialize SpriteBatchNode
            pNode.Set(pBase);

            return(pNode);
        }
        public SpriteNode Attach(SpriteBase pNode)
        {
            // Go to Man, get a node from reserve, add to active, return it
            SpriteNode pSBNode = (SpriteNode)this.BaseAdd();

            Debug.Assert(pSBNode != null);

            // Initialize SpriteBatchNode
            pSBNode.Set(pNode, this);

            return(pSBNode);
        }
        public void Draw()
        {
            // walk through the list and render
            SpriteNode pNode = (SpriteNode)this.BaseGetActive();

            while (pNode != null)
            {
                // Assumes someone before here called update() on each sprite
                // Draw me.
                pNode.GetSpriteBase().Render();

                pNode = (SpriteNode)pNode.pNext;
            }
        }
        public void Attach(SpriteBase pNode)
        {
            Debug.Assert(pNode != null);

            // Go to Man, get a node from reserve, add to active, return it
            SpriteNode pSpriteNode = (SpriteNode)this.poSpriteNodeMan.Attach(pNode);

            Debug.Assert(pSpriteNode != null);

            // Initialize SpriteBatchNode
            pSpriteNode.Set(pNode, this.poSpriteNodeMan);

            // Back pointer
            this.poSpriteNodeMan.SetSpriteBatch(this);
        }
Esempio n. 20
0
        //----------------------------------------------------------------------------------
        // Methods
        //----------------------------------------------------------------------------------

        public void Attach(SpriteBase pBase)
        {
            Debug.Assert(this.poSpriteNodeManager != null);
            Debug.Assert(pBase != null);

            SpriteNode pSBNode = (SpriteNode)this.poSpriteNodeManager.Attach(pBase);

            Debug.Assert(pSBNode != null);

            // Initialize SpriteBatchNode
            pSBNode.Set(pBase, this.poSpriteNodeManager);

            // Back pointer
            this.poSpriteNodeManager.SetSpriteBatch(this);
        }
Esempio n. 21
0
        public void Draw()
        {
            //grab the active list head pointer
            SpriteNode pNode = (SpriteNode)this.baseGetActive();

            //while-loop through, render each, set pointer to next
            while (pNode != null)
            {
                // render
                pNode.GetSprite().Render();

                //move to next
                pNode = (SpriteNode)pNode.pNext;
            }
        }
Esempio n. 22
0
        protected override bool derivedCompare(DLink pLinkA, DLink pLinkB)
        {
            //This is called by baseFind

            Debug.Assert(pLinkA != null);
            Debug.Assert(pLinkB != null);

            //Cast to type
            SpriteNode pSNA = (SpriteNode)pLinkA;
            SpriteNode pSNB = (SpriteNode)pLinkB;

            // result of comparison, expression results a bool
            // check pointer equality, if true, then the contents are the same
            return(pSNA == pSNB);
        }
        override protected bool derivedCompare(DLink pLinkA, DLink pLinkB)
        {
            Debug.Assert(pLinkA != null);
            Debug.Assert(pLinkB != null);

            SpriteNode pDataA = (SpriteNode)pLinkA;
            SpriteNode pDataB = (SpriteNode)pLinkB;

            bool status = false;

            if (pLinkB == pLinkA)
            {
                status = false;
            }
            else
            {
                status = false;
            }

            return(status);
        }
        override protected bool DerivedCompareNode(DLink pLinkA, DLink pLinkB)
        {
            // This is used in baseFind()
            Debug.Assert(pLinkA != null);
            Debug.Assert(pLinkB != null);

            SpriteNode pDataA = (SpriteNode)pLinkA;
            SpriteNode pDataB = (SpriteNode)pLinkB;

            bool status = false;

            // Stubbed this function out
            if (pLinkB == pLinkA)
            {
                status = false;
            }
            else
            {
                status = false;
            }

            return(status);
        }
 public void Remove(SpriteNode pNode)
 {
     Debug.Assert(pNode != null);
     this.BaseRemove(pNode);
 }
Esempio n. 26
0
 //----------------------------------------------------------------------------------
 // Constructor
 //----------------------------------------------------------------------------------
 public SpriteBase() : base()
 {
     this.pBackSpriteNode = null;
 }
Esempio n. 27
0
 public void SetSpriteNode(SpriteNode pSpriteBatchNode)
 {
     Debug.Assert(pSpriteBatchNode != null);
     this.pBackSpriteNode = pSpriteBatchNode;
 }
Esempio n. 28
0
        public SpriteNode Attach(GameSprite.Name name)
        {
            SpriteNode pNode = this.pNodeMan.Attach(name);

            return(pNode);
        }