Exemplo n.º 1
0
        //---------------------------------------------------------------------------------------------------------
        // Methods
        //---------------------------------------------------------------------------------------------------------
        public void MoveGrid()
        {
            ForwardIterator pFor      = new ForwardIterator(this);
            float           currSpeed = this.deltaX;

            if (this.moveForward == false)
            {
                currSpeed *= -1;
            }

            Component pNode = pFor.first();

            if (this.goingDown)
            {
                while (!pFor.isDone())
                {
                    GameObject pGameObj = (GameObject)pNode;
                    pGameObj.x += currSpeed;
                    pGameObj.y += this.deltaY;

                    pNode = pFor.next();
                }
                this.goingDown = false;
            }
            else
            {
                while (!pFor.isDone())
                {
                    GameObject pGameObj = (GameObject)pNode;
                    pGameObj.x += currSpeed;

                    pNode = pFor.next();
                }
            }
        }
Exemplo n.º 2
0
        //-------------------------------------------------------------------------------
        // Constructor
        //-------------------------------------------------------------------------------
        public ReverseIterator(Component pStart)
        {
            Debug.Assert(pStart != null);
            Debug.Assert(pStart.holder == Component.Container.Composite);

            ForwardIterator pForward = new ForwardIterator(pStart);

            this.pRoot = pStart;
            this.pCurr = this.pRoot;
            this.pPrev = null;

            // initialize reverse pointer
            Component pPrevNode = this.pRoot;
            Component pNode     = pForward.first();

            while (!pForward.isDone())
            {
                pPrevNode = pNode;

                // go to next node
                pNode = pForward.next();

                if (pNode != null)
                {
                    pNode.pReverse = pPrevNode;
                }
            }

            pRoot.pReverse = pPrevNode;
        }