コード例 #1
0
        protected void BaseUpdateBoundingBox(Component pStart)
        {
            GameObject pNode = (GameObject)pStart;

            // point to ColTotal
            CollisionRect ColTotal = this.poColObj.poColRect;

            // Get the first child
            pNode = (GameObject)Iterator.GetChild(pNode);

            if (pNode != null)
            {
                // Initialized the union to the first block
                ColTotal.Set(pNode.poColObj.poColRect);

                // loop through sliblings
                while (pNode != null)
                {
                    ColTotal.Union(pNode.poColObj.poColRect);

                    // go to next sibling
                    pNode = (GameObject)Iterator.GetSibling(pNode);
                }

                //this.poColObj.poColRect.Set(201, 201, 201, 201);
                this.x = this.poColObj.poColRect.x;
                this.y = this.poColObj.poColRect.y;

                //  Debug.WriteLine("x:{0} y:{1} w:{2} h:{3}", ColTotal.x, ColTotal.y, ColTotal.width, ColTotal.height);
            }
        }
コード例 #2
0
        protected void BaseUpdateBoundingBox()
        {
            // Go to first child
            Component  pComponent = (Component)this;
            GameObject pNode      = (GameObject)ForwardIterator.GetChild(pComponent);

            Debug.Assert(pNode != null);

            CollisionRect ColTotal = this.pCollisionObject.GetCollisionRect();

            ColTotal.Set(pNode.GetCollisionObject().GetCollisionRect());

            // loop through sliblings
            while (pNode != null)
            {
                ColTotal.Union(pNode.GetCollisionObject().GetCollisionRect());

                // go to next sibling
                pComponent = ForwardIterator.GetSibling(pNode);

                if (pComponent != null)
                {
                    pNode = (GameObject)pComponent;
                }
                else
                {
                    pNode = null;
                }
            }

            this.x = this.GetCollisionObject().GetCollisionRect().x;
            this.y = this.GetCollisionObject().GetCollisionRect().y;

            //Debug.WriteLine("x:{0} y:{1} w:{2} h:{3}", ColTotal.x, ColTotal.y, ColTotal.width, ColTotal.height);
        }
コード例 #3
0
ファイル: GameObject.cs プロジェクト: wangjo22/Final
        protected void BaseUpdateBoundingBox()
        {
            GameObject pNode = (GameObject)ForwardIterator.GetChild(this);
            CollisionRect pBigRect = this.pColObject.pColRect;
            if (pNode != null)
            {
                pBigRect.Set(pNode.pColObject.pColRect);
            }
            while (pNode != null)
            {
                pBigRect.Union(pNode.pColObject.pColRect);
                pNode = (GameObject)ForwardIterator.GetSibling(pNode);
            }

            this.x = this.pColObject.pColRect.x;
            this.y = this.pColObject.pColRect.y;
        }
コード例 #4
0
        protected void UpdateBoundingBox()
        {
            PCSNode node = (PCSNode)this;

            node = node.pChild;

            GameObject go = (GameObject)node;

            CollisionRect collisionTotal = this.pCollisionObject.pCollisionRect;

            collisionTotal.Set(go.pCollisionObject.pCollisionRect);

            while (node != null)
            {
                go = (GameObject)node;
                collisionTotal.Union(go.pCollisionObject.pCollisionRect);
                node = node.pSibling;
            }
            this.x = this.pCollisionObject.pCollisionRect.x;
            this.y = this.pCollisionObject.pCollisionRect.y;
        }