Esempio n. 1
0
        public SpriteBaseNode Find(SpriteBase spBase)
        {
            compareItem.SpriteItem = spBase;
            SpriteBaseNode resultItem = (SpriteBaseNode)BaseFind(compareItem);

            return(resultItem);
        }
Esempio n. 2
0
        public SpriteBaseNode Add(SpriteBase baseSprite)
        {
            SpriteBaseNode item = new SpriteBaseNode(baseSprite);

            AddToFront(item);
            return(item);
        }
Esempio n. 3
0
        // TODO probably remove this method because no longer used. Update handled in game objects
        public static void Update()
        {
            SpriteBatchManager pMan = SpriteBatchManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            // walk through the list and render
            SpriteBatch pSpriteBatch = (SpriteBatch)pMan.BaseGetActive();

            while (pSpriteBatch != null)
            {
                SpriteBaseNodeManager pSBNodeMan = pSpriteBatch.GetSBNodeManager();
                Debug.Assert(pSBNodeMan != null);

                SpriteBaseNode pNode = (SpriteBaseNode)pSBNodeMan.BaseGetActive();

                while (pNode != null)
                {
                    pNode.pSpriteBase.Update();

                    pNode = (SpriteBaseNode)pNode.GetNext();
                }

                pSpriteBatch = (SpriteBatch)pSpriteBatch.GetNext();
            }
        }
Esempio n. 4
0
        public static void Remove(SpriteBaseNode pSpriteBatchNode)
        {
            Debug.Assert(pSpriteBatchNode != null);
            SpriteBaseNodeManager pSBNodeMan = pSpriteBatchNode.GetSBNodeMan();

            Debug.Assert(pSBNodeMan != null);
            pSBNodeMan.Remove(pSpriteBatchNode);
        }
Esempio n. 5
0
        protected override DLink CreateNode()
        {
            DLink pNode = new SpriteBaseNode();

            Debug.Assert(pNode != null);

            return(pNode);
        }
Esempio n. 6
0
        public override bool Compare(DLinkedNode temp)
        {
            SpriteBaseNode iTemp = (SpriteBaseNode)temp;

            if (iTemp.SpriteItem == compareItem.SpriteItem)
            {
                return(true);
            }
            return(false);
        }
        public static void DeactivateGrid(InvaderGrid pGrid)
        {
            Debug.Assert(pGrid != null);

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

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

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

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

            GameObjectManager.NonTreeRemove(pGrid);



            ForwardIterator pFwdItor = new ForwardIterator(pGrid);

            GameObject pGameObj = (GameObject)pFwdItor.Next();

            while (!pFwdItor.IsDone())
            {
                // Remove from SpriteBatch
                // Find the SBNode
                Debug.Assert(pGameObj.pProxySprite != null);
                pSBNode = pGameObj.pProxySprite.GetSBNode();

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

                // Remove collision sprite from spriteBatch

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

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

                GameObjectManager.NonTreeRemove(pGameObj);

                pGameObj = (GameObject)pFwdItor.Next();
            }
        }
Esempio n. 8
0
        public SpriteBaseNode Attach(SpriteBase pNode)
        {
            // Go to Man, get a node from reserve, add to active, return it
            SpriteBaseNode pSBNode = (SpriteBaseNode)this.BaseAdd();

            Debug.Assert(pSBNode != null);

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

            return(pSBNode);
        }
Esempio n. 9
0
        public void Draw()
        {
            // walk through the list and render
            SpriteBaseNode pNode = (SpriteBaseNode)this.BaseGetActive();

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

                pNode = (SpriteBaseNode)pNode.GetNext();
            }
        }
Esempio n. 10
0
        public SpriteBaseNode Attach(SpriteBase pNode)
        {
            Debug.Assert(pNode != null);
            Debug.Assert(this.poSBNodeMan != null);

            SpriteBaseNode pSBNode = this.poSBNodeMan.Attach(pNode);

            Debug.Assert(pSBNode != null);

            // set Back pointer
            this.poSBNodeMan.SetSpriteBatch(this);

            return(pSBNode);
        }
Esempio n. 11
0
        public static void Remove(Font pNode)
        {
            FontManager pMan = FontManager.PrivGetInstance();

            Debug.Assert(pMan != null);

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

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

            Debug.Assert(pNode != null);
            pMan.BaseRemove(pNode);
        }
Esempio n. 12
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
        }
Esempio n. 13
0
        public void Remove(SpriteBase baseSprite)
        {
            SpriteBaseNode iTemp = Find(baseSprite);

            Remove(iTemp);
        }
Esempio n. 14
0
 public void Remove(SpriteBaseNode pNode)
 {
     Debug.Assert(pNode != null);
     this.BaseRemove(pNode);
 }
Esempio n. 15
0
 public SpriteBaseNodeManager(int numNodes = 3, int growthSize = 1)
     : base(numNodes, growthSize)
 {
     poCompareNode = new SpriteBaseNode();
     Debug.Assert(poCompareNode != null);
 }
Esempio n. 16
0
 public void SetSBNode(SpriteBaseNode pSpriteBatchNode)
 {
     Debug.Assert(pSpriteBatchNode != null);
     this.pBackSBNode = pSpriteBatchNode;
 }