示例#1
0
        public SpriteBaseRef Attach(SpriteProxy pNode)
        {
            Debug.Assert(this.pSBRefManager != null);
            SpriteBaseRef pSBRef = this.pSBRefManager.Attach(pNode);

            return(pSBRef);
        }
        //----------------------------------------------------------------------
        // Override Abstract methods
        //----------------------------------------------------------------------
        override protected DLink DerivedCreateNode()
        {
            DLink pNode = new SpriteProxy();

            Debug.Assert(pNode != null);

            return(pNode);
        }
示例#3
0
        //----------------------------------------------------------------------
        // Constructors / Destructor
        //----------------------------------------------------------------------

        protected GameObject(GameObject.Name gameName, Sprite.Name spriteName)
        {
            this.name             = gameName;
            this.x                = 0.0f;
            this.y                = 0.0f;
            this.pSpriteProxy     = new SpriteProxy(spriteName);
            this.pCollisionObject = new CollisionObject(this.pSpriteProxy);
        }
        public void Detach(SpriteProxy pNode)
        {
            Debug.Assert(pNode != null);
            this.pSpriteBaseRefCompare.SetSpriteBase(pNode);
            DLink pFoundNode = this.BaseFind(this.pSpriteBaseRefCompare);

            Debug.Assert(pFoundNode != null);
            this.BaseRemove(pFoundNode);
        }
        public SpriteBaseRef Attach(SpriteProxy pNode)
        {
            SpriteBaseRef pSBNode = (SpriteBaseRef)this.BaseAdd();

            Debug.Assert(pSBNode != null);

            // Initialize SpriteBaseRef
            pSBNode.Set(pNode);

            return(pSBNode);
        }
        public static SpriteProxy Find(SpriteProxy.Name name)
        {
            SpriteProxyManager pInstance = SpriteProxyManager.PrivGetInstance();

            Debug.Assert(pInstance != null);

            // Use compare node to compare to search nodes
            pInstance.pSpriteProxyCompare.SetName(name);

            SpriteProxy pData = (SpriteProxy)pInstance.BaseFind(pInstance.pSpriteProxyCompare);

            return(pData);
        }
        public static SpriteProxy Add(SpriteProxy.Name proxyName, Sprite.Name spriteName)
        {
            SpriteProxyManager pInstance = SpriteProxyManager.PrivGetInstance();

            Debug.Assert(pInstance != null);

            SpriteProxy pNode = (SpriteProxy)pInstance.BaseAdd();

            Debug.Assert(pNode != null);

            pNode.Set(proxyName, spriteName);

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

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

            Boolean status = false;

            if (pDataA.GetName() == pDataB.GetName())
            {
                status = true;
            }

            return(status);
        }
示例#9
0
        public CollisionObject(SpriteProxy pSpriteProxy)
        {
            Debug.Assert(pSpriteProxy != null);

            // Create Collision Rect
            // Use the reference sprite to set size and shape
            Sprite pSprite = pSpriteProxy.GetSprite();

            Debug.Assert(pSprite != null);

            // Origin is in the UPPER RIGHT
            this.pCollisionRect = new CollisionRect(pSprite.GetScreenRect());
            Debug.Assert(this.pCollisionRect != null);

            // Create the sprite
            this.pCollisionSprite = SpriteBoxManager.Add(SpriteBox.Name.Box, this.pCollisionRect.x, this.pCollisionRect.y, this.pCollisionRect.width, this.pCollisionRect.height);
            Debug.Assert(this.pCollisionSprite != null);
            this.pCollisionSprite.SetLineColor(1.0f, 0.0f, 0.0f);
        }
        protected override void DerivedDestroyNode(DLink pLink)
        {
            SpriteProxy pSpriteProxy = (SpriteProxy)pLink;

            pSpriteProxy.SetSprite(null);
        }
 //---------------------------------------------------------------------------------------------------------
 // Constructors / Destructor
 //---------------------------------------------------------------------------------------------------------
 private SpriteProxyManager(int reserveNum = 3, int reserveGrow = 1)
     : base(reserveNum, reserveGrow)
 {
     this.pSpriteProxyCompare = new SpriteProxy();
 }
示例#12
0
 public void Detach(SpriteProxy pNode)
 {
     Debug.Assert(pNode != null);
     this.pSBRefManager.Detach(pNode);
 }