예제 #1
0
        private int LoadLevel1Pattern()
        {
            _y = 100;
            var specialCount = 0;

            for (var i = 0; i < BrickPatternMatrix.GetLength(0); i++)
            {
                for (var f = 0; f < BrickPatternMatrix.GetLength(1); f++)
                {
                    if (specialCount == 10) // Every 10 bricks is a brick that drops a special power
                    {
                        BrickPatternMatrix[i, f] = new SpecialBrick(_x, _y);
                        specialCount             = 0;
                    }
                    else
                    {
                        BrickPatternMatrix[i, f] = new Brick(_x, _y);
                    }
                    _x += 75;
                    specialCount++;
                }
                _x  = 95;
                _y += 50;
            }

            return(specialCount);
        }
예제 #2
0
        private int LoadLevel2Pattern()
        {
            _y = 100;
            var brickInLine  = 3;
            var specialCount = 0;

            for (var i = 0; i < BrickPatternMatrix.GetLength(0); i++)
            {
                for (var f = 0; f < BrickPatternMatrix.GetLength(1); f++)
                {
                    var canBuild = (15 - brickInLine) / 2;
                    if (f >= canBuild && f < canBuild + brickInLine)
                    {
                        if (specialCount == 13) // Every 13 bricks is a brick that drops a special power
                        {
                            BrickPatternMatrix[i, f] = new SpecialBrick(_x, _y);
                            specialCount             = 0;
                        }
                        else if (i == 1 || i == 3) // In Line 1 and 3 indestructable bricks are spawned that can not be destroyed
                        {
                            BrickPatternMatrix[i, f] = new IndestructibleBrick(_x, _y);
                        }
                        else
                        {
                            BrickPatternMatrix[i, f] = new Brick(_x, _y);
                        }
                        specialCount++;
                    }
                    _x += 75;
                }
                brickInLine += 2;
                _x           = 95;
                _y          += 50;
            }

            return(specialCount);
        }