예제 #1
0
 public virtual void VisitShieldColumn(ShieldColumn s)
 {
     //shouldn't call this
     //need to implement in concrete class
     Debug.WriteLine("Visit by ShieldColumn not implemented");
     Debug.Assert(false);
 }
예제 #2
0
        public override void VisitShieldColumn(ShieldColumn pShieldColumn)
        {
            //Debug.WriteLine("in Grid, visit from shieldColumn");
            GameObject pGameObj = (GameObject)pShieldColumn.GetFirstChild();

            ColPair.FwdCollide(this, pGameObj);
        }
예제 #3
0
        public override void VisitShieldColumn(ShieldColumn pShieldColumn)
        {
            //Debug.WriteLine("in Missile, visit from shieldColumn");
            GameObject pGameObj = (GameObject)pShieldColumn.GetLastChild();

            ColPair.RevCollide(this, pGameObj);
        }
예제 #4
0
        public GameObject Create(ShieldCategory.Type type, GameObject.Name gameName, GameObject pContainer = null, float posX = 0.0f, float posY = 0.0f)
        {
            GameObject pShield = null;

            switch (type)
            {
            case ShieldCategory.Type.Brick:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick, posX, posY);
                break;

            case ShieldCategory.Type.LeftTop1:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_LeftTop1, posX, posY);
                break;

            case ShieldCategory.Type.LeftTop0:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_LeftTop0, posX, posY);
                break;

            case ShieldCategory.Type.LeftBottom:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_LeftBottom, posX, posY);
                break;

            case ShieldCategory.Type.RightTop1:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_RightTop1, posX, posY);
                break;

            case ShieldCategory.Type.RightTop0:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_RightTop0, posX, posY);
                break;

            case ShieldCategory.Type.RightBottom:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_RightBottom, posX, posY);
                break;

            case ShieldCategory.Type.Root:
                pShield = new ShieldRoot(gameName, GameSprite.Name.NullObject, posX, posY);
                pShield.SetCollisionColor(0.0f, 0.0f, 1.0f);
                //Debug.Assert(false);
                break;

            case ShieldCategory.Type.Grid:
                pShield = new ShieldGrid(gameName, GameSprite.Name.NullObject, posX, posY);
                pShield.SetCollisionColor(0.0f, 1.0f, 0.0f);
                break;

            case ShieldCategory.Type.Column:
                pShield = new ShieldColumn(gameName, GameSprite.Name.NullObject, posX, posY);
                pShield.SetCollisionColor(1.0f, 0.0f, 0.0f);
                break;

            default:
                // something is wrong
                Debug.Assert(false);
                break;
            }

            this.AttachTo(pShield, pContainer);
            return(pShield);
        }
예제 #5
0
        public GameObject Create(ShieldCategory.Type type, GameObject.Name gameName, float posX = 0.0f, float posY = 0.0f)
        {
            GameObject pShield = null;

            switch (type)
            {
            case ShieldCategory.Type.Brick:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick, posX, posY);
                break;

            case ShieldCategory.Type.LeftTop1:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_LeftTop1, posX, posY);
                break;

            case ShieldCategory.Type.LeftTop0:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_LeftTop0, posX, posY);
                break;

            case ShieldCategory.Type.LeftBottom:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_LeftBottom, posX, posY);
                break;

            case ShieldCategory.Type.RightTop1:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_RightTop1, posX, posY);
                break;

            case ShieldCategory.Type.RightTop0:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_RightTop0, posX, posY);
                break;

            case ShieldCategory.Type.RightBottom:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_RightBottom, posX, posY);
                break;

            case ShieldCategory.Type.Root:
                pShield = new ShieldRoot(gameName, GameSprite.Name.NullObject, posX, posY);
                pShield.SetCollisionColor(0.0f, 0.0f, 1.0f);
                break;

            case ShieldCategory.Type.Column:
                pShield = new ShieldColumn(gameName, GameSprite.Name.NullObject, posX, posY);
                pShield.SetCollisionColor(1.0f, 0.0f, 0.0f);
                break;

            default:
                // something is wrong
                Debug.Assert(false);
                break;
            }

            // add to the tree
            this.pTree.Add(pShield);

            // Attached to Group
            pShield.ActivateGameSprite(this.pSpriteBatch);
            pShield.ActivateCollisionSprite(this.pCollisionSpriteBatch);

            return(pShield);
        }
        public override void VisitShieldColumn(ShieldColumn m)
        {
            // BirdGroup vs MissileGroup
            //Debug.WriteLine("         collide:  {0} <-> {1}", m.name, this.name);

            // MissileGroup vs Columns
            GameObject pGameObj = (GameObject)Iterator.GetChild(m);

            CollisionPair.Collide(pGameObj, this);
        }
예제 #7
0
        internal static void DestroyShields(ShieldGroup pShieldGroup)
        {
            // Iterate through shields
            ShieldRoot pShieldRoot = (ShieldRoot)pShieldGroup.GetFirstChild();

            while (pShieldRoot != null)
            {
                // Iterate through shield columns
                ShieldColumn pShieldCol = (ShieldColumn)pShieldRoot.GetFirstChild();
                while (pShieldCol != null)
                {
                    // Iterate through shield bricks
                    ShieldBrick pShieldBrick = (ShieldBrick)pShieldCol.GetFirstChild();
                    while (pShieldBrick != null)
                    {
                        // Remove ShieldBrick from composite
                        pShieldCol.Remove(pShieldBrick);

                        // Kill ShieldRoot
                        pShieldBrick.Remove(SpriteBatch.Name.Shield, SpriteBatch.Name.CollisionBox);

                        // Get next ShieldColumn
                        pShieldBrick = (ShieldBrick)pShieldCol.GetFirstChild();
                    }

                    // Remove ShieldColumn from composite
                    pShieldRoot.Remove(pShieldCol);

                    // Kill ShieldRoot
                    pShieldCol.Remove(SpriteBatch.Name.Shield, SpriteBatch.Name.CollisionBox);

                    // Get next ShieldColumn
                    pShieldCol = (ShieldColumn)pShieldRoot.GetFirstChild();
                }


                // Remove ShieldRoot from composite
                pShieldGroup.Remove(pShieldRoot);

                // Kill ShieldRoot
                pShieldRoot.Remove(SpriteBatch.Name.Shield, SpriteBatch.Name.CollisionBox);

                // Get next ShieldRoot
                pShieldRoot = (ShieldRoot)pShieldGroup.GetFirstChild();
            }
        }
        public override void notify()
        {
            Shield shield = (Shield)this.colSubject.gameObjB;

            ShieldColumn col  = (ShieldColumn)shield.pParent;
            ShieldUnit   unit = (ShieldUnit)col.pParent;

            shield.remove();
            if (col.pChild == null)
            {
                col.remove();
            }
            if (unit.pChild == null)
            {
                unit.remove();
            }
        }
예제 #9
0
        public GameObject Create(Type type, float posX, float posY)
        {
            GameObject pGameObj = null;

            switch (type)
            {
            case Type.Brick:
                pGameObj = new ShieldBrick(GameObject.Name.ShieldBrick, Sprite.Name.ShieldBrick, BoxSprite.Name.ShieldBrickBox, posX, posY);
                break;

            case Type.Column:
                pGameObj = new ShieldColumn(GameObject.Name.ShieldColumn, BoxSprite.Name.ShieldColumnBox);
                break;

            case Type.Shield:
                pGameObj = new Shield(GameObject.Name.Shield, BoxSprite.Name.ShieldBox);
                break;

            case Type.Zone:
                pGameObj = new ShieldZone(GameObject.Name.ShieldZone, BoxSprite.Name.ShieldZoneBox);
                break;

            default:
                // something is wrong
                Debug.Assert(false, "GameObject type not supported by this factory");
                break;
            }

            // add it to the gameObjectManager
            Debug.Assert(pGameObj != null);
            GameObjectManager.Attach(pGameObj);

            if (pGOComposite != null)
            {
                // add to grouping
                pGOComposite.Add(pGameObj);
            }

            // Attached to Batches
            this.pBoxSpriteBatch.Attach(pGameObj.poColObj.pColSprite);
            this.pSpriteBatch.Attach(pGameObj.pProxySprite);
            return(pGameObj);
        }
예제 #10
0
        public Shield createShield(Shield.ShieldType mShieldType, GameObject.GameObjectName gameName, int index = 0, float mX = 0.0f, float mY = 0.0f)
        {
            Shield shield = null;

            switch (mShieldType)
            {
            case Shield.ShieldType.ShieldBrick:
                shield = new ShieldBrick(gameName, Sprite.SpriteName.ShieldBrick, index, mX, mY);
                break;

            case Shield.ShieldType.ShieldColumn:
                shield = new ShieldColumn(gameName, Sprite.SpriteName.NullObject, index, mX, mY);
                break;

            case Shield.ShieldType.ShieldUnit:
                shield = new ShieldUnit(gameName, Sprite.SpriteName.NullObject, index, mX, mY);
                break;

            case Shield.ShieldType.ShieldGrid:
                shield = new ShieldGrid(gameName, index, Sprite.SpriteName.NullObject);
                GameObjectNodeManager.add(shield, cPCSTree);
                break;

            case Shield.ShieldType.Uninitilized:
                Debug.WriteLine("Shield Type is Uninitilized");
                break;
            }

            this.cPCSTree.Insert(shield, this.cParent);
            // cSpriteBatch.addToBatch(shield.getProxySprite());
            // cSpriteBatch.addToBatch(shield.getCollisionObj().cSpriteBox);

            shield.addSpriteToBatch(this.cSpriteBatch);
            shield.addCollisionToBatch(SpriteBatchManager.find(SpriteBatch.SpriteBatchName.Boxes));
            return(shield);
        }
예제 #11
0
 //-------------------------------------
 public virtual void VisitShieldColumn(ShieldColumn s)
 {
     Debug.WriteLine("Visit by ShieldColumn not implemented");
     Debug.Assert(false);
 }
예제 #12
0
        public static GameObject Create(ShieldCategory.Type type, int _Index, float posX = 0.0f, float posY = 0.0f)
        {
            ShieldFactory pFactory = ShieldFactory.PrivGetInstance();

            Debug.Assert(pFactory != null);

            GameObject pGameObj = null;

            switch (type)
            {
            case ShieldCategory.Type.Brick:
                pGameObj = new ShieldBrick(GameObject.Name.ShieldBrick, GameSprite.Name.Brick, _Index, posX, posY);
                break;

            case ShieldCategory.Type.LeftBottom:
                pGameObj = new ShieldBrick(GameObject.Name.ShieldBrick, GameSprite.Name.BrickLeft_Bottom, _Index, posX, posY);
                break;

            case ShieldCategory.Type.LeftTop0:
                pGameObj = new ShieldBrick(GameObject.Name.ShieldBrick, GameSprite.Name.BrickLeft_Top0, _Index, posX, posY);
                break;

            case ShieldCategory.Type.LeftTop1:
                pGameObj = new ShieldBrick(GameObject.Name.ShieldBrick, GameSprite.Name.BrickLeft_Top1, _Index, posX, posY);
                break;

            case ShieldCategory.Type.RightBottom:
                pGameObj = new ShieldBrick(GameObject.Name.ShieldBrick, GameSprite.Name.BrickRight_Bottom, _Index, posX, posY);
                break;

            case ShieldCategory.Type.RightTop0:
                pGameObj = new ShieldBrick(GameObject.Name.ShieldBrick, GameSprite.Name.BrickRight_Top0, _Index, posX, posY);
                break;

            case ShieldCategory.Type.RightTop1:
                pGameObj = new ShieldBrick(GameObject.Name.ShieldBrick, GameSprite.Name.BrickRight_Top1, _Index, posX, posY);
                break;

            case ShieldCategory.Type.Column:
                pGameObj = new ShieldColumn(GameObject.Name.ShieldColumn, GameSprite.Name.NullObject, _Index, posX, posY);
                break;

            case ShieldCategory.Type.Group:
                pGameObj = new ShieldGroup(GameObject.Name.ShieldRoot, GameSprite.Name.NullObject, _Index, posX, posY);
                break;

            default:
                Debug.Assert(false);
                break;
            }
            Debug.Assert(pGameObj != null);


            // Attach to SpriteBatch
            if (pGameObj.type == Component.Container.LEAF)
            {
                pFactory.pParent.Add(pGameObj);
                pGameObj.ActivateGameSprite(pFactory.pShieldSpriteBatch);
            }
            pGameObj.ActivateCollisionSprite(pFactory.pBoxSpriteBatch);
            return(pGameObj);
        }
예제 #13
0
 public virtual void VisitShieldColumn(ShieldColumn pShieldColumn)
 {
     // no differed to subcass
     Debug.WriteLine("Visit by ShieldColumn not implemented");
     Debug.Assert(false);
 }
예제 #14
0
        public ShieldCategory Create(ShieldCategory.Type type, GameObject.Name gameObjName, int index = 0, float posX = 0.0f, float posY = 0.0f)
        {
            ShieldCategory pShield = null;

            switch (type)
            {
            case ShieldCategory.Type.Root:
                pShield = new ShieldRoot(gameObjName, GameSprite.Name.NullObject, index, posX, posY);
                //pShield.SetCollisionColor(0.0f, 0.0f, 1.0f);
                //GameObjectManager.AttachTree(pShield, this.pTree);
                //pShield.ActivateCollisionSprite(this.pCollisionSpriteBatch);
                break;

            case ShieldCategory.Type.ShieldGrid:
                pShield = new ShieldGrid(gameObjName, GameSprite.Name.NullObject, index, posX, posY);
                //pShield.SetCollisionColor(1.0f, 0.0f, 0.0f);
                pShield.ActivateCollisionSprite(this.pCollisionSpriteBatch);
                break;

            case ShieldCategory.Type.ShieldColumn:
                pShield = new ShieldColumn(gameObjName, GameSprite.Name.NullObject, index, posX, posY);
                //pShield.SetCollisionColor(1.0f, 0.0f, 0.0f);
                pShield.ActivateCollisionSprite(this.pCollisionSpriteBatch);
                break;


            case ShieldCategory.Type.ShieldBrick:
                pShield = new ShieldBrick(gameObjName, GameSprite.Name.ShieldBrick, index, posX, posY);
                break;

            case ShieldCategory.Type.ShieldBrickLeft_Top:
                pShield = new ShieldBrick(gameObjName, GameSprite.Name.ShieldBrickLeft_Top, index, posX, posY);
                break;


            case ShieldCategory.Type.ShieldBrickRight_Top:
                pShield = new ShieldBrick(gameObjName, GameSprite.Name.ShieldBrickRight_Top, index, posX, posY);
                break;


            case ShieldCategory.Type.ShieldBrickMidLeft_Bottom:
                pShield = new ShieldBrick(gameObjName, GameSprite.Name.ShieldBrickMidLeft_Bottom, index, posX, posY);
                break;

            case ShieldCategory.Type.ShieldBrickMid_Bottom:
                pShield = new ShieldBrick(gameObjName, GameSprite.Name.ShieldBrickMid_Bottom, index, posX, posY);
                break;

            case ShieldCategory.Type.ShieldBrickMidRight_Bottom:
                pShield = new ShieldBrick(gameObjName, GameSprite.Name.ShieldBrickMidRight_Bottom, index, posX, posY);
                break;

            default:
                // something is wrong
                Debug.Assert(false);
                break;
            }

            // add to the tree
            this.pTree.Insert(pShield, this.pParent);

            // Attached to Group
            pShield.ActivateGameSprite(this.pSpriteBatch);
            pShield.ActivateCollisionSprite(this.pCollisionSpriteBatch);

            return(pShield);
        }
예제 #15
0
        public override void VisitShieldColumn(ShieldColumn sc)
        {
            GameObject pGameObj = Iterator.GetChildGameObject(sc);

            CollisionPair.Collide(pGameObj, this);
        }
예제 #16
0
 public virtual void VisitShieldColumn(ShieldColumn sc)
 {
     Debug.Assert(false);
 }
예제 #17
0
        public GameObject Create(ShieldCategory.Type type, GameObject.Name gameName, float posX = 0.0f, float posY = 0.0f)
        {
            GameObject pShield = null;

            switch (type)
            {
            case ShieldCategory.Type.Brick:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick, posX, posY);
                break;

            case ShieldCategory.Type.LeftTop1:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_LeftTop1, posX, posY);
                break;

            case ShieldCategory.Type.LeftTop2:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_LeftTop2, posX, posY);
                break;

            case ShieldCategory.Type.LeftBottom:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_LeftBottom, posX, posY);
                break;

            case ShieldCategory.Type.RightTop1:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_RightTop1, posX, posY);
                break;

            case ShieldCategory.Type.RightTop2:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_RightTop2, posX, posY);
                break;

            case ShieldCategory.Type.RightBottom:
                pShield = new ShieldBrick(gameName, GameSprite.Name.Brick_RightBottom, posX, posY);
                break;


            case ShieldCategory.Type.Root:
                pShield = new ShieldRoot(gameName, GameSprite.Name.NullObject, posX, posY);
                pShield.SetCollisionColor(0.0f, 0.0f, 1.0f);
                Debug.Assert(false);
                break;

            case ShieldCategory.Type.Grid:
                pShield = new ShieldGrid(gameName, GameSprite.Name.NullObject, posX, posY);
                pShield.SetCollisionColor(0.0f, 0.0f, 1.0f);
                break;

            case ShieldCategory.Type.Column:
                pShield = new ShieldColumn(gameName, GameSprite.Name.NullObject, posX, posY);
                pShield.SetCollisionColor(1.0f, 0.0f, 0.0f);
                break;

            default:
                Debug.Assert(false);
                break;
            }

            this.pTree.Add(pShield);

            pShield.ActivateGameSprite(this.pSpriteBatch);
            pShield.ActivateCollisionSprite(this.pColSpriteBatch);

            return(pShield);
        }
예제 #18
0
        public static Shield CreateShield(float xOrigin, float yOrigin, GameObjectComposite pGOComposite = null)
        {
            // 21 x 18
            ShieldFactory pShieldSF = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pGOComposite);
            Shield        pShield   = (Shield)pShieldSF.Create(ShieldFactory.Type.Shield, 0, 0);

            ShieldFactory pColumnSF = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShield);

            ShieldColumn pShieldColumn0 = (ShieldColumn)pColumnSF.Create(ShieldFactory.Type.Column, 0, 0);
            ShieldColumn pShieldColumn1 = (ShieldColumn)pColumnSF.Create(ShieldFactory.Type.Column, 0, 0);
            ShieldColumn pShieldColumn2 = (ShieldColumn)pColumnSF.Create(ShieldFactory.Type.Column, 0, 0);
            ShieldColumn pShieldColumn3 = (ShieldColumn)pColumnSF.Create(ShieldFactory.Type.Column, 0, 0);
            ShieldColumn pShieldColumn4 = (ShieldColumn)pColumnSF.Create(ShieldFactory.Type.Column, 0, 0);
            ShieldColumn pShieldColumn5 = (ShieldColumn)pColumnSF.Create(ShieldFactory.Type.Column, 0, 0);
            ShieldColumn pShieldColumn6 = (ShieldColumn)pColumnSF.Create(ShieldFactory.Type.Column, 0, 0);
            // Columns 7 through 13 are produced in a loop below.
            ShieldColumn pShieldColumn14 = (ShieldColumn)pColumnSF.Create(ShieldFactory.Type.Column, 0, 0);
            ShieldColumn pShieldColumn15 = (ShieldColumn)pColumnSF.Create(ShieldFactory.Type.Column, 0, 0);
            ShieldColumn pShieldColumn16 = (ShieldColumn)pColumnSF.Create(ShieldFactory.Type.Column, 0, 0);
            ShieldColumn pShieldColumn17 = (ShieldColumn)pColumnSF.Create(ShieldFactory.Type.Column, 0, 0);
            ShieldColumn pShieldColumn18 = (ShieldColumn)pColumnSF.Create(ShieldFactory.Type.Column, 0, 0);
            ShieldColumn pShieldColumn19 = (ShieldColumn)pColumnSF.Create(ShieldFactory.Type.Column, 0, 0);
            ShieldColumn pShieldColumn20 = (ShieldColumn)pColumnSF.Create(ShieldFactory.Type.Column, 0, 0);

            // make shield columns 0 and 20
            for (int i = 0; i < 12; i++)
            {
                ShieldFactory pShieldBrickFactory = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShieldColumn0);
                ShieldBrick   shieldBrick         = (ShieldBrick)pShieldBrickFactory.Create(ShieldFactory.Type.Brick, xOrigin, yOrigin + i * Constants.shieldBrickHeight);

                ShieldFactory pShieldBrickFactory20 = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShieldColumn20);
                pShieldBrickFactory20.Create(ShieldFactory.Type.Brick, xOrigin + 20 * Constants.shieldBrickHeight, yOrigin + i * Constants.shieldBrickHeight);
            }

            // make shield columns 1 and 19
            for (int i = 0; i < 13; i++)
            {
                ShieldFactory pShieldBrickFactory = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShieldColumn1);
                ShieldBrick   shieldBrick         = (ShieldBrick)pShieldBrickFactory.Create(ShieldFactory.Type.Brick, xOrigin + 1 * Constants.shieldBrickHeight, yOrigin + i * Constants.shieldBrickHeight);

                ShieldFactory pShieldBrickFactory19 = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShieldColumn19);
                pShieldBrickFactory19.Create(ShieldFactory.Type.Brick, xOrigin + 19 * Constants.shieldBrickHeight, yOrigin + i * Constants.shieldBrickHeight);
            }

            // make shield columns 2 and 18
            for (int i = 0; i < 14; i++)
            {
                ShieldFactory pShieldBrickFactory = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShieldColumn2);
                ShieldBrick   shieldBrick         = (ShieldBrick)pShieldBrickFactory.Create(ShieldFactory.Type.Brick, xOrigin + 2 * Constants.shieldBrickHeight, yOrigin + i * Constants.shieldBrickHeight);

                ShieldFactory pShieldBrickFactory18 = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShieldColumn18);
                pShieldBrickFactory18.Create(ShieldFactory.Type.Brick, xOrigin + 18 * Constants.shieldBrickHeight, yOrigin + i * Constants.shieldBrickHeight);
            }

            // make shield columns 3 and 17
            for (int i = 0; i < 15; i++)
            {
                ShieldFactory pShieldBrickFactory3 = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShieldColumn3);
                pShieldBrickFactory3.Create(ShieldFactory.Type.Brick, xOrigin + 3 * Constants.shieldBrickHeight, yOrigin + i * Constants.shieldBrickHeight);

                ShieldFactory pShieldBrickFactory17 = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShieldColumn17);
                pShieldBrickFactory17.Create(ShieldFactory.Type.Brick, xOrigin + 17 * Constants.shieldBrickHeight, yOrigin + i * Constants.shieldBrickHeight);
            }

            // make shield columns 4 and 16
            for (int i = 0; i < 16; i++)
            {
                ShieldFactory pShieldBrickFactory4 = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShieldColumn4);
                pShieldBrickFactory4.Create(ShieldFactory.Type.Brick, xOrigin + 4 * Constants.shieldBrickHeight, yOrigin + i * Constants.shieldBrickHeight);

                ShieldFactory pShieldBrickFactory16 = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShieldColumn16);
                pShieldBrickFactory16.Create(ShieldFactory.Type.Brick, xOrigin + 16 * Constants.shieldBrickHeight, yOrigin + i * Constants.shieldBrickHeight);
            }

            // make shield columns 5 and 15
            for (int i = 0; i < 14; i++)
            {
                ShieldFactory pShieldBrickFactor5 = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShieldColumn5);
                pShieldBrickFactor5.Create(ShieldFactory.Type.Brick, xOrigin + 5 * Constants.shieldBrickHeight, yOrigin + 2 * Constants.shieldBrickHeight + i * Constants.shieldBrickHeight);

                ShieldFactory pShieldBrickFactor15 = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShieldColumn15);
                pShieldBrickFactor15.Create(ShieldFactory.Type.Brick, xOrigin + 15 * Constants.shieldBrickHeight, yOrigin + 2 * Constants.shieldBrickHeight + i * Constants.shieldBrickHeight);
            }

            // make shield  columns 6 and 14
            for (int i = 0; i < 13; i++)
            {
                ShieldFactory pShieldBrickFactory6 = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShieldColumn6);
                pShieldBrickFactory6.Create(ShieldFactory.Type.Brick, xOrigin + 6 * Constants.shieldBrickHeight, yOrigin + 3 * Constants.shieldBrickHeight + i * Constants.shieldBrickHeight);

                ShieldFactory pShieldBrickFactory14 = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShieldColumn14);
                pShieldBrickFactory14.Create(ShieldFactory.Type.Brick, xOrigin + 14 * Constants.shieldBrickHeight, yOrigin + 3 * Constants.shieldBrickHeight + i * Constants.shieldBrickHeight);
            }

            // make shield  columns 7 thru 13
            for (int i = 0; i < 7; i++)
            {
                float         x                   = xOrigin + 7 * Constants.shieldBrickHeight + i * Constants.shieldBrickHeight;
                ShieldColumn  pShieldColumn       = (ShieldColumn)pColumnSF.Create(ShieldFactory.Type.Column, 0, 0);
                ShieldFactory pShieldBrickFactory = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, pShieldColumn);
                for (int j = 0; j < 12; j++)
                {
                    float y = yOrigin + 4 * Constants.shieldBrickHeight + j * Constants.shieldBrickHeight;
                    pShieldBrickFactory.Create(ShieldFactory.Type.Brick, x, y);
                }
            }

            return(pShield);
        }
 public virtual void visitShieldColumn(ShieldColumn s)
 {
 }
예제 #20
0
        public ShieldCategory Create(ShieldType type, GameObjectName goName, float x = 0.0f, float y = 0.0f, int idx = 0)
        {
            ShieldCategory pShield = null;

            switch (type)
            {
            case ShieldType.Brick:
                pShield = new ShieldBrick(goName, SpriteBaseName.Brick, x, y, idx);
                break;

            case ShieldType.LeftTop0:
                pShield = new ShieldBrick(goName, SpriteBaseName.BrickLeftTop0, x, y, idx);
                break;

            case ShieldType.LeftTop1:
                pShield = new ShieldBrick(goName, SpriteBaseName.BrickLeftTop1, x, y, idx);
                break;

            case ShieldType.LeftBottom:
                pShield = new ShieldBrick(goName, SpriteBaseName.BrickLeftBottom, x, y, idx);
                break;

            case ShieldType.RightTop0:
                pShield = new ShieldBrick(goName, SpriteBaseName.BrickRightTop0, x, y, idx);
                break;

            case ShieldType.RightTop1:
                pShield = new ShieldBrick(goName, SpriteBaseName.BrickRightTop1, x, y, idx);
                break;

            case ShieldType.RightBottom:
                pShield = new ShieldBrick(goName, SpriteBaseName.BrickRightBottom, x, y, idx);
                break;

            case ShieldType.Root:
                pShield = new ShieldRoot(goName, SpriteBaseName.Null, x, y, idx);
                pShield.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Blue).pAzulColor;
                Debug.Assert(false);
                break;

            case ShieldType.Grid:
                pShield = new ShieldGrid(goName, SpriteBaseName.Null, x, y, idx);
                pShield.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Blue).pAzulColor;
                break;

            case ShieldType.Column:
                pShield = new ShieldColumn(goName, SpriteBaseName.Null, x, y, idx);
                pShield.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Red).pAzulColor;
                break;

            default:
                Debug.Assert(false);
                break;
            }
            this.pTree.Insert(pShield, this.pParent);
            pShield.ActivateGameSprite(this.pSpriteBatch);
            if (GameManager.GetCollisionBoxes())
            {
                pShield.ActivateCollisionSprite(this.pCollisionSpriteBatch);
            }
            return(pShield);
        }