Beispiel #1
0
        protected void BaseUpdateBoundingBox(Component pStart)
        {
            GameObject pNode = (GameObject)pStart;

            // point to ColTotal
            CollisionRect ColTotal = this.poCollisionObject.poCollisionRect;

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

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

                // loop through sliblings
                while (pNode != null)
                {
                    ColTotal.union(pNode.poCollisionObject.poCollisionRect);

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

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

                //  Debug.WriteLine("x:{0} y:{1} w:{2} h:{3}", ColTotal.x, ColTotal.y, ColTotal.width, ColTotal.height);
            }
        }
Beispiel #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);
        }
Beispiel #3
0
        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;
        }
Beispiel #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;
        }