Ejemplo n.º 1
0
        private void AddRacket(GameObject obj)
        {
            if (this.playerRacket != null)
            {
                this.allObjects.Remove(this.playerRacket);
                this.staticObjects.Remove(this.playerRacket);
            }

            this.playerRacket = obj as Racket;
            this.AddStaticObject(obj);
        }
Ejemplo n.º 2
0
        private static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            //Normal blocks
            for (int i = startCol - 1; i < WorldCols - 1; i++)
            {
                Block firstBlock = new Block(new MatrixCoords(startRow, i));
                Block secondBlock = new Block(new MatrixCoords(startRow - 1, i));
                Block thirdBlock = new Block(new MatrixCoords(startRow - 2, i));
                engine.AddObject(firstBlock);
                engine.AddObject(secondBlock);
                engine.AddObject(thirdBlock);
            }

            //Task 01. Indestructible ceiling and walls
            for (int i = 0; i < WorldRows; i++)
            {
                IndestructibleBlock borderBlockLeft = new IndestructibleBlock(new MatrixCoords(i, 0));
                IndestructibleBlock borderBlockRight = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));
                engine.AddObject(borderBlockLeft);
                engine.AddObject(borderBlockRight);
            }

            for (int i = 0; i < WorldCols; i++)
            {
                IndestructibleBlock borderCeiling = new IndestructibleBlock(new MatrixCoords(0, i));
                engine.AddObject(borderCeiling);
            }

            //Tasks 08-09. Test Impassable Block line and Unstoppable Ball
            //for (int i = startCol - 1; i < WorldCols - 1; i++)
            //{
            //    ImpassableBlock impassableBlock = new ImpassableBlock(new MatrixCoords(startRow + 5, i));
            //    engine.AddObject(impassableBlock);
            //}
            ////Making borders also impassable for testing purposes
            //for (int i = WorldRows/2 - 3 ; i < WorldRows; i++)
            //{
            //    ImpassableBlock impassableLeftBorder = new ImpassableBlock(new MatrixCoords(i, 0));
            //    ImpassableBlock impassableRightBorder = new ImpassableBlock(new MatrixCoords(i, WorldCols - 1));
            //    engine.AddObject(impassableLeftBorder);
            //    engine.AddObject(impassableRightBorder);
            //}

            //UnstoppableBall unstoppable = new UnstoppableBall(new MatrixCoords(WorldRows/2, 2), new MatrixCoords(-1, 2));
            //engine.AddObject(unstoppable);

            //Task 10. Explosive block implementation test
            for (int i = startCol - 1; i < WorldCols - 1; i++)
            {
                ExplodingBlock xBlock = new ExplodingBlock((new MatrixCoords(startRow + 1, i)));
                engine.AddObject(xBlock);
            }

            //Task 11. Gift Class test implementation
            //Gift gift = new Gift(new MatrixCoords(WorldRows/2 - 5, WorldCols/2 - 5));
            //engine.AddObject(gift);

            //Task 12. Test GiftBlock implementation
            //for (int i = startCol - 1; i < WorldCols - 1; i++)
            //{
            //    GiftBlock giftBlock = new GiftBlock((new MatrixCoords(startRow + 2, i)));
            //    engine.AddObject(giftBlock);
            //}

            //Tasks 06-07. MeteoriteBall
            MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 1), new MatrixCoords(-1, 1));
            engine.AddObject(theBall);

            //Test Task 05. TrailObject
            //TrailObject trailObject = new TrailObject(new MatrixCoords(WorldRows /2 - 1, 1), 3);
            //engine.AddObject(trailObject);

            Racket theRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);
            //Test Task 03. Single racket test:
            //Racket newRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);
            //engine.AddObject(newRacket);
        }
Ejemplo n.º 3
0
        private void AddRacket(GameObject obj)
        {
            if (this.playerRacket != null)
            {
                this.allObjects.Remove(this.playerRacket);
                this.staticObjects.Remove(this.playerRacket);
            }

            this.playerRacket = obj as Racket;
            this.AddStaticObject(obj);
        }
Ejemplo n.º 4
0
        private static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol   = WorldCols - 2;

            //Normal blocks
            for (int i = startCol - 1; i < WorldCols - 1; i++)
            {
                Block firstBlock  = new Block(new MatrixCoords(startRow, i));
                Block secondBlock = new Block(new MatrixCoords(startRow - 1, i));
                Block thirdBlock  = new Block(new MatrixCoords(startRow - 2, i));
                engine.AddObject(firstBlock);
                engine.AddObject(secondBlock);
                engine.AddObject(thirdBlock);
            }

            //Task 01. Indestructible ceiling and walls
            for (int i = 0; i < WorldRows; i++)
            {
                IndestructibleBlock borderBlockLeft  = new IndestructibleBlock(new MatrixCoords(i, 0));
                IndestructibleBlock borderBlockRight = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));
                engine.AddObject(borderBlockLeft);
                engine.AddObject(borderBlockRight);
            }

            for (int i = 0; i < WorldCols; i++)
            {
                IndestructibleBlock borderCeiling = new IndestructibleBlock(new MatrixCoords(0, i));
                engine.AddObject(borderCeiling);
            }

            //Tasks 08-09. Test Impassable Block line and Unstoppable Ball
            //for (int i = startCol - 1; i < WorldCols - 1; i++)
            //{
            //    ImpassableBlock impassableBlock = new ImpassableBlock(new MatrixCoords(startRow + 5, i));
            //    engine.AddObject(impassableBlock);
            //}
            ////Making borders also impassable for testing purposes
            //for (int i = WorldRows/2 - 3 ; i < WorldRows; i++)
            //{
            //    ImpassableBlock impassableLeftBorder = new ImpassableBlock(new MatrixCoords(i, 0));
            //    ImpassableBlock impassableRightBorder = new ImpassableBlock(new MatrixCoords(i, WorldCols - 1));
            //    engine.AddObject(impassableLeftBorder);
            //    engine.AddObject(impassableRightBorder);
            //}

            //UnstoppableBall unstoppable = new UnstoppableBall(new MatrixCoords(WorldRows/2, 2), new MatrixCoords(-1, 2));
            //engine.AddObject(unstoppable);

            //Task 10. Explosive block implementation test
            for (int i = startCol - 1; i < WorldCols - 1; i++)
            {
                ExplodingBlock xBlock = new ExplodingBlock((new MatrixCoords(startRow + 1, i)));
                engine.AddObject(xBlock);
            }

            //Task 11. Gift Class test implementation
            //Gift gift = new Gift(new MatrixCoords(WorldRows/2 - 5, WorldCols/2 - 5));
            //engine.AddObject(gift);

            //Task 12. Test GiftBlock implementation
            //for (int i = startCol - 1; i < WorldCols - 1; i++)
            //{
            //    GiftBlock giftBlock = new GiftBlock((new MatrixCoords(startRow + 2, i)));
            //    engine.AddObject(giftBlock);
            //}

            //Tasks 06-07. MeteoriteBall
            MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 1), new MatrixCoords(-1, 1));

            engine.AddObject(theBall);

            //Test Task 05. TrailObject
            //TrailObject trailObject = new TrailObject(new MatrixCoords(WorldRows /2 - 1, 1), 3);
            //engine.AddObject(trailObject);

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

            //Test Task 03. Single racket test:
            //Racket newRacket = new Racket(new MatrixCoords(WorldRows - 1, WorldCols / 2), RacketLength);

            engine.AddObject(theRacket);
            //engine.AddObject(newRacket);
        }