コード例 #1
0
        override public void Move()
        {
            DLink pNode = this.poHead;

            while (pNode != null)
            {
                Component pComponent = (Component)pNode;
                pComponent.Move();

                pNode = pNode.pNext;
            }
        }
コード例 #2
0
ファイル: Composite.cs プロジェクト: beelandc/SpaceInvaders
        public override void Move(float xDelta, float yDelta)
        {
            DLink pNode = this.pHead;

            while (pNode != null)
            {
                // Get component
                Component pComponent = (Component)pNode;

                // Move component
                pComponent.Move(xDelta, yDelta);

                // Increment pointer along list
                pNode = pNode.GetNext();
            }
        }
コード例 #3
0
        public override void Execute(AlienGroup pGrid)
        {
            this.pIter.TakeHierachy(pGrid);
            Component pComponent = this.pIter.First();

            if (pComponent == null)
            {
                return;
                // TODO
                // Player killed all aliens. Should start second stage.
            }
            // TODO
            // UPDATE ITERATOR -> IT SHOULDN"T CHECK PCOMPONENT != THIS
            while (this.pIter.IsDone() || pComponent != pGrid)
            {
                pComponent.Move(0, -Constant.ALIEN_VERTICAL_STEP);
                pComponent = this.pIter.Next();
            }
            this.Handle(pGrid);
        }
コード例 #4
0
ファイル: AlienGrid.cs プロジェクト: beelandc/SpaceInvaders
        public override void Move(float dummyX, float dummyY)
        {
            DLink pNode = this.pHead;

            // #1 - Initial movement since wall collision - Move down
            if (switchXDirection && !directionChangePending)
            {
                this.SetXDelta(0.0f);
                this.SetYDelta(-25.0f);
                this.directionChangePending = true;
            }

            while (pNode != null)
            {
                // Get component
                Component pComponent = (Component)pNode;

                // Move component
                pComponent.Move(this.xDelta, this.yDelta);

                pNode = pNode.GetNext();
            }

            // #3 - Finally, Grid has moved off wall, reset direction change flag
            if (directionChangePending && !switchXDirection)
            {
                this.directionChangePending = false;
            }

            // #2 - Movement down complete, switch X direction
            if (switchXDirection == true)
            {
                // Reset deltas to horizontal movement in opposite direction
                this.yDelta           = 0.0f;
                this.xDelta           = (this.prevXDelta * -1.0f);
                this.switchXDirection = false;
            }
        }