AcademyPopcorn.AcademyPopcornMain.Initialize C# (CSharp) Метод

Initialize() статический приватный Метод

static private Initialize ( Engine engine ) : void
engine Engine
Результат void
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                if (i == 11) // Testing the explosion object
                {
                    engine.AddObject(new Block(new MatrixCoords(startRow, i)));
                    engine.AddObject(new Block(new MatrixCoords(startRow + 1, i)));
                    engine.AddObject(new ExplodingBlock(new MatrixCoords(startRow + 2, i)));
                }
                else if (i == 35) // Testing the gift Object
                {
                    engine.AddObject(new Block(new MatrixCoords(startRow, i)));
                    engine.AddObject(new Block(new MatrixCoords(startRow + 1, i)));
                    engine.AddObject(new GiftBlock(new MatrixCoords(startRow + 2, i)));
                }
                else
                {
                    engine.AddObject(new Block(new MatrixCoords(startRow, i)));
                    engine.AddObject(new Block(new MatrixCoords(startRow + 1, i)));
                    engine.AddObject(new Block(new MatrixCoords(startRow + 2, i)));
                }
            }

            // 09. Adding Unpassable wall
            for (int i = endCol / 2; i < endCol / 2 + 4; i++)
            {
                engine.AddObject(new UnpassableBlock(new MatrixCoords(startRow + 3, i)));
            }

            // 01. Adding the ceiling
            // Adding the top wall
            startCol -= 2;
            startRow -= 2;
            for (int i = startCol; i < WorldCols; i++)
            {
                IndestructibleBlock topWall = new IndestructibleBlock(new MatrixCoords(startRow, i));
                engine.AddObject(topWall);
            }

            // Adding the left wall
            startRow = 2;
            startCol = 0;
            for (int i = startRow; i < WorldRows; i++)
            {
                IndestructibleBlock currWall = new IndestructibleBlock(new MatrixCoords(i, startCol));
                engine.AddObject(currWall);
            }

            // Adding the right wall
            startRow = 2;
            startCol = WorldCols - 1;
            for (int i = startRow; i < WorldRows; i++)
            {
                IndestructibleBlock currWall = new IndestructibleBlock(new MatrixCoords(i, startCol));
                engine.AddObject(currWall);
            }

            // 07. Testing the metheorite ball
            Ball theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));

            // 09. Testing the unstappable ball
            //UnstoppableBall theBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));

            engine.AddObject(theBall);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);

            // 05. Initialize Trailing object
            //TrailObject simpleTrailObject = new TrailObject(new MatrixCoords(10, 10), new char[,] {{'o'}}, 10);
            //engine.AddObject(simpleTrailObject);

            // 11. Testing the gift Object
            //Gift testGift = new Gift(new MatrixCoords(WorldRows / 2, 10), new char[,] {{'8'}}, new MatrixCoords(1, 0));
            //engine.AddObject(testGift);
        }
AcademyPopcornMain