Ejemplo n.º 1
0
        protected void BaseUpdateBoundingBox(Component pStart)
        {
            GameObject pNode = (GameObject)pStart;

            // point to ColTotal
            ColRect 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);
            }
        }
Ejemplo n.º 2
0
        protected void BaseUpdateBoundingBox(Component pStart)
        {
            GameObject pNode = (GameObject)pStart;

            // point to ColTotal
            ColRect 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.x = this.poColObj.poColRect.x;
                this.y = this.poColObj.poColRect.y;
            }
        }
Ejemplo n.º 3
0
        // method for classes that inherit from Game Object
        // updates x, y, height, and width for the collision rectangle that encapsulates the child collission rectangles
        protected void BaseUpdateBoundingBox(Component pStart)
        {
            GameObject pNode = (GameObject)pStart;

            //get collision retangle so we can update in a loop of it's children
            ColRect ColTotal = this.poColObj.poColRect;

            //Get its first child so we can do a loop
            pNode = (GameObject)Iterator.GetChild(pNode);

            if (pNode != null)
            {
                //make "this" parent collision rectangle start off
                //as the size of its first child
                ColTotal.Set(pNode.poColObj.poColRect);

                //Now we loop through children
                //and make parent collision box bigger via a union method
                while (pNode != null)
                {
                    ColTotal.Union(pNode.poColObj.poColRect);

                    pNode = (GameObject)Iterator.GetSibling(pNode);
                }


                this.x = this.poColObj.poColRect.x;
                this.y = this.poColObj.poColRect.y;
            }
        }
Ejemplo n.º 4
0
        protected void BaseUpdateBoundingBox(Component pStart)
        {
            GameObject pNode    = (GameObject)pStart;
            ColRect    ColTotal = this.poColObj.poColRect;

            pNode = (GameObject)Iterator.GetChild(pNode);

            if (pNode != null)
            {
                ColTotal.Set(pNode.poColObj.poColRect);
                while (pNode != null)
                {
                    ColTotal.Union(pNode.poColObj.poColRect);
                    pNode = (GameObject)Iterator.GetSibling(pNode);
                }

                this.x = this.poColObj.poColRect.x;
                this.y = this.poColObj.poColRect.y;
            }
        }
Ejemplo n.º 5
0
        public override void Update()
        {
            //privMoveGrid

            // Go to first child
            PCSNode pNode = (PCSNode)this;

            pNode = pNode.pChild;

            // Set ColTotal to first child
            GameObject pGameObj = (GameObject)pNode;

            //todo add an AlienRoot to continue game after all aliens are destroyed
            //without a semi-permenant alien root, system breaks after last alien/column is destroyed,
            //thus destroying the grid and returning a null game object here;
            ColRect ColTotal = this.poColObj.poColRect;

            ColTotal.Set(pGameObj.GetColObject().poColRect);

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

                // go to next sibling
                pNode = pNode.pSibling;
            }

            //this.pColObj.pColRect.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);

            base.baseUpdateBoundingBox();
            base.Update();
        }
Ejemplo n.º 6
0
        protected void baseUpdateBoundingBox()
        {
            //go to the first child in the PCS tree;
            PCSNode pcsNode = (PCSNode)this;

            pcsNode = pcsNode.pChild;

            //cast the pcsNode as a GameObject
            GameObject gameObject = (GameObject)pcsNode;

            //check to see if pcsNode is null (has it been removed?)
            if (pcsNode != null)
            {
                Debug.Assert(this.poColObj != null);
                Debug.Assert(this.poColObj.poColRect != null);
                ColRect collisionTotal = this.poColObj.poColRect;

                Debug.Assert(this.poColObj != null);
                Debug.Assert(this.poColObj.poColRect != null);
                collisionTotal.Set(gameObject.poColObj.poColRect);

                //loop through the siblings to get the total collisionRectSize;
                while (pcsNode != null)
                {
                    //cast each sibling pcsNode as a GameObject for consistency;
                    gameObject = (GameObject)pcsNode;
                    //total will be the size of the Union / combination of all the collisionRect sizes of the siblings;
                    collisionTotal.Union(gameObject.poColObj.poColRect);

                    //point to the next sibling;
                    //if the next sibling is null, then the loop will break out automatically;
                    pcsNode = pcsNode.pSibling;
                }

                this.x = this.poColObj.poColRect.x;
                this.y = this.poColObj.poColRect.y;
            }
        }