상속: AcademyPopcorn.MovingObject
예제 #1
0
 public GiftBlock(MatrixCoords topLeft, Gift gift)
     : base(topLeft)
 {
     this.CurrentGift = gift;
     this.CurrentGift.SetTopLeft(topLeft);
     this.body = new char[,] { { GiftBlock.Symbol } };
 }
예제 #2
0
 public override IEnumerable<GameObject> ProduceObjects()
 {
     List<Gift> gifts = new List<Gift>();
     if (this.IsDestroyed)
     {
         Gift gift = new Gift(this.topLeft);
         gifts.Add(gift);
     }
     return gifts;
 }
예제 #3
0
 public override IEnumerable<GameObject> ProduceObjects()
 {
     List<GameObject> obj = new List<GameObject>();
     if (this.IsDestroyed==true)
     {
         Gift gift = new Gift(new MatrixCoords(this.GetTopLeft().Row, this.GetTopLeft().Col));
         obj.Add(gift);
     }
     return obj;
 }
예제 #4
0
        public override IEnumerable<GameObject> ProduceObjects()
        {
            if (this.IsDestroyed)
            {
                Gift gift = new Gift(base.topLeft, new char[,] { { '^' }, { '|' } });

                return new GameObject[] { gift };
            }

            return base.ProduceObjects();
        }
 public override IEnumerable<GameObject> ProduceObjects()
 {
     List<Gift> array = new List<Gift>();
     if (this.IsDestroyed)
     {
         Gift gift =
         new Gift(this.topLeft, new MatrixCoords(1, 0));
         array.Add(gift);
     }
     return array;
 }
예제 #6
0
        //Methods
        public override IEnumerable<GameObject> ProduceObjects()
        {
            if (this.IsDestroyed == true)
            {
                gifts[0] = new Gift(this.TopLeft);

                return this.gifts;
            }

            return new List<GameObject>();
        }
예제 #7
0
 public override IEnumerable<GameObject> ProduceObjects()
 {
     List<GameObject> produceObject = new List<GameObject>();
     if (this.IsDestroyed)
     {
         Gift newGift = new Gift(this.topLeft, new char[,] { { 'G' } });
         produceObject.Add(newGift);
     }
     
     return produceObject;
 }
예제 #8
0
        public override IEnumerable<GameObject> ProduceObjects()
        {
            if (this.IsDestroyed == true)
            {
                var giftlist = new List<Gift>();
                var gift = new Gift(this.GetTopLeft(), new MatrixCoords(-1, 0));
                giftlist.Add(gift);

                return giftlist;
            }
            return base.ProduceObjects();
        }
예제 #9
0
 public override IEnumerable<GameObject> ProduceObjects()
 {
     if (this.IsDestroyed)
     {
         Gift gift = new Gift(this.TopLeft, new MatrixCoords(1, 0));
         List<Gift> gifts = new List<Gift>();
         gifts.Add(gift);
         return gifts;
     }
     else
     {
         return new List<GameObject>();
     }
 }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            engine.AddObject(new TailObject(new MatrixCoords(10, 5), new char[1,1] {{'%'}}, 5));

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock2 = new Block(new MatrixCoords(startRow + 1, i));
                engine.AddObject(currBlock2);
                ExplodingBlock currBlock3 = new ExplodingBlock(new MatrixCoords(startRow + 2, i));
                engine.AddObject(currBlock3);
                GiftBlock currBlock4 = new GiftBlock(new MatrixCoords(startRow + 3, i));
                engine.AddObject(currBlock4);

            }

            for (int i = startCol - 1; i <= endCol; i++)
            {
                IndestructibleBlock currBlock = new IndestructibleBlock(new MatrixCoords(startRow, i));
                engine.AddObject(currBlock);
            }

            for (int i = startRow; i <= WorldRows; i++)
            {
                IndestructibleBlock currBlock1 = new IndestructibleBlock(new MatrixCoords(i, startCol - 1));
                IndestructibleBlock currBlock2 = new IndestructibleBlock(new MatrixCoords(i, endCol      ));
                engine.AddObject(currBlock1);
                engine.AddObject(currBlock2);
            }

            //MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));
            Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));


            engine.AddObject(theBall);

            Gift gift = new Gift(new MatrixCoords(8, 20));
            engine.AddObject(gift);

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

            engine.AddObject(theRacket);
        }
예제 #11
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));
                ExplodingBlock expBlock = new ExplodingBlock(new MatrixCoords(startRow + 2,i));
                Block someMoreBlock = new Block(new MatrixCoords(startRow + 1, i));
                engine.AddObject(currBlock);
                engine.AddObject(expBlock);
                engine.AddObject(someMoreBlock);
            }

            MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1),3);

            engine.AddObject(theBall);

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

            engine.AddObject(theRacket);

            //add sides
            for (int row = 0; row < WorldRows; row++)
            {
                IndestructibleBlock leftIndestructibleBlock = new IndestructibleBlock(new MatrixCoords(row,0));
                engine.AddObject(leftIndestructibleBlock);
                IndestructibleBlock rightIndestructibleBlock = new IndestructibleBlock(new MatrixCoords(row, WorldCols-1));
                engine.AddObject(rightIndestructibleBlock);
            }
            //add roof
            for (int col = 0; col < WorldCols; col++)
            {
                IndestructibleBlock topIndestructibleBlock = new IndestructibleBlock(new MatrixCoords(0,col));
                engine.AddObject(topIndestructibleBlock);
            }

            Gift gift = new Gift(new MatrixCoords(0,10));
            engine.AddObject(gift);

            GiftBlock giftBlock = new GiftBlock(new MatrixCoords(7,33));
            engine.AddObject(giftBlock);
        }
예제 #12
0
파일: GiftBlock.cs 프로젝트: ddichov/CSharp
        public override IEnumerable<GameObject> ProduceObjects()
        {
            if (this.IsDestroyed)
            {

                int row = this.TopLeft.Row;
                int col = this.TopLeft.Col;
                List<GameObject> gifts = new List<GameObject>();
                Gift gift1 = new Gift(new MatrixCoords(row, col));
                gifts.Add(gift1);
                return gifts;
            }
            else
            {
                return base.ProduceObjects();
            }
        }
예제 #13
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            #region Add some layers of ordinary blocks and a layer of exploding block in the middle

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock1 = new Block(new MatrixCoords(startRow, i));
                Block currBlock2 = new Block(new MatrixCoords(startRow + 1, i));
                Block currBlock3 = new Block(new MatrixCoords(startRow + 2, i));

                engine.AddObject(currBlock1);
                engine.AddObject(currBlock2);
                engine.AddObject(currBlock3);
            }

            for (int i = startCol; i < endCol; i++)
            {
                ExplodingBlock currBlock = new ExplodingBlock(new MatrixCoords(startRow + 3, i));

                engine.AddObject(currBlock);
            }

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock1 = new Block(new MatrixCoords(startRow + 4, i));
                Block currBlock2 = new Block(new MatrixCoords(startRow + 5, i));
                Block currBlock3 = new Block(new MatrixCoords(startRow + 6, i));

                engine.AddObject(currBlock1);
                engine.AddObject(currBlock2);
                engine.AddObject(currBlock3);
            }

            #endregion

            #region Add a layer of gift objects

            //for (int i = startCol; i < endCol; i++)
            //{
            //    GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow, i));

            //    engine.AddObject(currBlock);
            //}

            #endregion

            #region Create side walls and a ceiling

            // create side walls
            for (int i = 0; i < WorldRows; i++)
            {
                // create a block for the left wall
                IndestructibleBlock leftWallBlock = new IndestructibleBlock(new MatrixCoords(i, 0));
                // create a block for the right wall
                IndestructibleBlock rightWallBlock = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));

                engine.AddObject(leftWallBlock);
                engine.AddObject(rightWallBlock);
            }

            for (int i = 0; i < WorldCols; i++)
            {
                // create a block for the ceiling
                IndestructibleBlock ceilingBlock = new IndestructibleBlock(new MatrixCoords(0, i));

                engine.AddObject(ceilingBlock);
            }

            #endregion

            #region Add an impassable wall

            //for (int i = startRow + 1; i < WorldRows; i++)
            //{
            //    // create an impassable block
            //    ImpassableBlock impassableBlock = new ImpassableBlock(new MatrixCoords(i, 2 * WorldCols / 3 + 2));

            //    engine.AddObject(impassableBlock);
            //}

            #endregion

            #region Create an ordinary ball

            //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));

            #endregion

            #region Replace the ordinary ball with a MeteoriteBall object

            //MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1), 3);

            #endregion

            #region Replace the ordinary ball with an UnstoppableBall object

            UnstoppableBall theBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));

            #endregion

            engine.AddObject(theBall);

            #region Add the racket

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

            engine.AddObject(theRacket);

            #endregion

            #region Add an instance of the TrailObject class

            //TrailObject ephemera = new TrailObject(
            //    new MatrixCoords(WorldRows / 3, WorldCols / 3), new char[,] { { '@' } }, 10);

            //engine.AddObject(ephemera);

            #endregion

            #region Add a single gift

            Gift gift = new Gift(new MatrixCoords(WorldRows / 3, WorldCols / 3), new char[,] { { '@' } });

            engine.AddObject(gift);

            #endregion
        }
예제 #14
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol   = WorldCols - 2;

            #region Add some layers of ordinary blocks and a layer of exploding block in the middle

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock1 = new Block(new MatrixCoords(startRow, i));
                Block currBlock2 = new Block(new MatrixCoords(startRow + 1, i));
                Block currBlock3 = new Block(new MatrixCoords(startRow + 2, i));

                engine.AddObject(currBlock1);
                engine.AddObject(currBlock2);
                engine.AddObject(currBlock3);
            }

            for (int i = startCol; i < endCol; i++)
            {
                ExplodingBlock currBlock = new ExplodingBlock(new MatrixCoords(startRow + 3, i));

                engine.AddObject(currBlock);
            }

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock1 = new Block(new MatrixCoords(startRow + 4, i));
                Block currBlock2 = new Block(new MatrixCoords(startRow + 5, i));
                Block currBlock3 = new Block(new MatrixCoords(startRow + 6, i));

                engine.AddObject(currBlock1);
                engine.AddObject(currBlock2);
                engine.AddObject(currBlock3);
            }

            #endregion

            #region Add a layer of gift objects

            //for (int i = startCol; i < endCol; i++)
            //{
            //    GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow, i));

            //    engine.AddObject(currBlock);
            //}

            #endregion

            #region Create side walls and a ceiling

            // create side walls
            for (int i = 0; i < WorldRows; i++)
            {
                // create a block for the left wall
                IndestructibleBlock leftWallBlock = new IndestructibleBlock(new MatrixCoords(i, 0));
                // create a block for the right wall
                IndestructibleBlock rightWallBlock = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));

                engine.AddObject(leftWallBlock);
                engine.AddObject(rightWallBlock);
            }

            for (int i = 0; i < WorldCols; i++)
            {
                // create a block for the ceiling
                IndestructibleBlock ceilingBlock = new IndestructibleBlock(new MatrixCoords(0, i));

                engine.AddObject(ceilingBlock);
            }

            #endregion

            #region Add an impassable wall

            //for (int i = startRow + 1; i < WorldRows; i++)
            //{
            //    // create an impassable block
            //    ImpassableBlock impassableBlock = new ImpassableBlock(new MatrixCoords(i, 2 * WorldCols / 3 + 2));

            //    engine.AddObject(impassableBlock);
            //}

            #endregion

            #region Create an ordinary ball

            //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));

            #endregion

            #region Replace the ordinary ball with a MeteoriteBall object

            //MeteoriteBall theBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1), 3);

            #endregion

            #region Replace the ordinary ball with an UnstoppableBall object

            UnstoppableBall theBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));

            #endregion

            engine.AddObject(theBall);

            #region Add the racket

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

            engine.AddObject(theRacket);

            #endregion

            #region Add an instance of the TrailObject class

            //TrailObject ephemera = new TrailObject(
            //    new MatrixCoords(WorldRows / 3, WorldCols / 3), new char[,] { { '@' } }, 10);

            //engine.AddObject(ephemera);

            #endregion

            #region Add a single gift

            Gift gift = new Gift(new MatrixCoords(WorldRows / 3, WorldCols / 3), new char[, ] {
                { '@' }
            });

            engine.AddObject(gift);

            #endregion
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            for (int i = startCol - 1; i < endCol + 1; i++)
            {
                IndestructibleBlock wallBlock = new IndestructibleBlock(new MatrixCoords(startRow - 1, i));
                engine.AddObject(wallBlock);
            }
            for (int i = startRow; i < WorldRows; i++)
            {
                IndestructibleBlock wallBlock = new IndestructibleBlock(new MatrixCoords(i, startCol - 1));
                IndestructibleBlock wallBlock2 = new IndestructibleBlock(new MatrixCoords(i, endCol));
                engine.AddObject(wallBlock);
                engine.AddObject(wallBlock2);
            }

            //create a row of GiftBlocks
            for (int i = startCol; i < endCol; i++)
            {
                GiftBlock currBlock = new GiftBlock(new MatrixCoords(startRow+4, i));

                engine.AddObject(currBlock);
            }

            //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));

            //replace the normal ball with Meteorite ball
            //MeteoriteBall theMeteoriteBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            //engine.AddObject(theMeteoriteBall);

            //replace the MeteroriteBall with Unstoppable Ball
            Ball theUnstopableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0), new MatrixCoords(-1, 1));
            engine.AddObject(theUnstopableBall);

            //put some unpassable blocks
            for (int i = 2; i < WorldCols; i += 5)
            {
                engine.AddObject(new UnpassableBlock(new MatrixCoords(4, i)));
            }

            //create a sample Gift for testing
            Gift gift = new Gift(new MatrixCoords(1, WorldCols / 2));

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

            TrailObject newTestTrailObject = new TrailObject(new MatrixCoords(startRow  + 10, startCol + 10), new char[,] { { 'V' } }, 20);
            engine.AddObject(newTestTrailObject);

            engine.AddObject(theRacket);
        }
예제 #16
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            // Task 1 - first the left wall
            for (int i = 0; i < WorldRows; i++)
            {
                IndestructibleBlock indBlock = new IndestructibleBlock(new MatrixCoords(i, 0));
                engine.AddObject(indBlock);
            }

            // Then the right wall
            for (int i = 0; i < WorldRows; i++)
            {
                IndestructibleBlock indBlock = new IndestructibleBlock(new MatrixCoords(i, WorldCols-1));
                engine.AddObject(indBlock);
            }

            // Then the ceiling. 
            // For task 9 I have put Unpassable blocks on the ceiling.
            for (int i = 0; i < WorldCols; i++)
            {
                IndestructibleBlock indBlock = new UnpassableBlock(new MatrixCoords(0, i));
                engine.AddObject(indBlock);
            }

            // Testing Task 7 by replacing the normal ball with a Meteorite Ball
            Ball theBall = new MeteoriteBall(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);

            // Testing Task 5
            TrailObject trail = new TrailObject(new MatrixCoords(10, 10), 5);
            engine.AddObject(trail);

            // Task 9 - creating an additional unstopable ball
            Ball theGreatBall = new UnstopableBall(new MatrixCoords(WorldRows / 3, 0),
                new MatrixCoords(-1, 1));
            engine.AddObject(theGreatBall);

            // Task 12 - testing by adding a Gift and a GiftBlock
            Gift theGift = new Gift(new MatrixCoords(10, 10));
            engine.AddObject(theGift);

            GiftBlock theGiftBlock = new GiftBlock(new MatrixCoords(10, 15));
            engine.AddObject(theGiftBlock);
        }
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock0 = new Block(new MatrixCoords(startRow-1, i));
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
                engine.AddObject(currBlock0);
            }

               //ExplodingBlock makes trails
             ExplodingBlock explodingBlock = new ExplodingBlock(new MatrixCoords(4,7));
             engine.AddObject(explodingBlock);

            //Ordinary ball
            //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));
            //engine.AddObject(theBall);

            //Meteorite Ball makes trails when it moves
            //MeteoriteBall meteroitBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));
            // engine.AddObject(meteroitBall);

            //Unstoppable Ball, can be stopped only by Unpassable Block
            UnstoppableBall unstoppableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0),
                new MatrixCoords(-1, 1));
            engine.AddObject(unstoppableBall);

            //Falling gift
            Gift giftObject = new Gift(new MatrixCoords(5, 15),
                new MatrixCoords(-1, 0));

            engine.AddObject(giftObject);

            //Gift Block
            GiftBlock giftBlock = new GiftBlock(new MatrixCoords(10, 10));
            engine.AddObject(giftBlock);

            //UnpassableBlock
            UnpassableBlock unpassableBlock = new UnpassableBlock(new MatrixCoords(15, 15));
            engine.AddObject(unpassableBlock);
            UnpassableBlock unpassableBlock1 = new UnpassableBlock(new MatrixCoords(15, 16));
            engine.AddObject(unpassableBlock1);
            UnpassableBlock unpassableBlock2 = new UnpassableBlock(new MatrixCoords(15, 17));
            engine.AddObject(unpassableBlock2);

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

            engine.AddObject(theRacket);

               //Creating second Racket
               //When you add second racket by addObject method, it checks whether the game has already a racket
               //If it does, we are removing the previous, and adding the new one.
               //Racket secondRacket = new Racket(new MatrixCoords(WorldRows -10, WorldCols / 2), RacketLength);
               //engine.AddObject(secondRacket);

            TrailObject trailObject = new TrailObject(new MatrixCoords(1, 1), 20);

            engine.AddObject(trailObject);

            for (int i = 0; i < WorldRows; i++)
            {
                IndestructibleBlock indestructibleBlockLeft = new IndestructibleBlock(new MatrixCoords(i,0));
                IndestructibleBlock indestructibleBlockRight = new IndestructibleBlock(new MatrixCoords(i, WorldCols-1));
                engine.AddObject(indestructibleBlockLeft);
                engine.AddObject(indestructibleBlockRight);
            }

            for (int i = 0; i < WorldCols; i++)
            {
                IndestructibleBlock indestructibleBlockCeiling = new IndestructibleBlock(new MatrixCoords(0, i));
                engine.AddObject(indestructibleBlockCeiling);
            }
        }
예제 #18
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol   = WorldCols - 2;

            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock0 = new Block(new MatrixCoords(startRow - 1, i));
                Block currBlock  = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
                engine.AddObject(currBlock0);
            }

            //ExplodingBlock makes trails
            ExplodingBlock explodingBlock = new ExplodingBlock(new MatrixCoords(4, 7));

            engine.AddObject(explodingBlock);

            //Ordinary ball
            //Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));
            //engine.AddObject(theBall);

            //Meteorite Ball makes trails when it moves
            //MeteoriteBall meteroitBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2, 0),
            //    new MatrixCoords(-1, 1));
            // engine.AddObject(meteroitBall);

            //Unstoppable Ball, can be stopped only by Unpassable Block
            UnstoppableBall unstoppableBall = new UnstoppableBall(new MatrixCoords(WorldRows / 2, 0),
                                                                  new MatrixCoords(-1, 1));

            engine.AddObject(unstoppableBall);

            //Falling gift
            Gift giftObject = new Gift(new MatrixCoords(5, 15),
                                       new MatrixCoords(-1, 0));

            engine.AddObject(giftObject);

            //Gift Block
            GiftBlock giftBlock = new GiftBlock(new MatrixCoords(10, 10));

            engine.AddObject(giftBlock);

            //UnpassableBlock
            UnpassableBlock unpassableBlock = new UnpassableBlock(new MatrixCoords(15, 15));

            engine.AddObject(unpassableBlock);
            UnpassableBlock unpassableBlock1 = new UnpassableBlock(new MatrixCoords(15, 16));

            engine.AddObject(unpassableBlock1);
            UnpassableBlock unpassableBlock2 = new UnpassableBlock(new MatrixCoords(15, 17));

            engine.AddObject(unpassableBlock2);

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

            engine.AddObject(theRacket);

            //Creating second Racket
            //When you add second racket by addObject method, it checks whether the game has already a racket
            //If it does, we are removing the previous, and adding the new one.
            //Racket secondRacket = new Racket(new MatrixCoords(WorldRows -10, WorldCols / 2), RacketLength);
            //engine.AddObject(secondRacket);

            TrailObject trailObject = new TrailObject(new MatrixCoords(1, 1), 20);

            engine.AddObject(trailObject);

            for (int i = 0; i < WorldRows; i++)
            {
                IndestructibleBlock indestructibleBlockLeft  = new IndestructibleBlock(new MatrixCoords(i, 0));
                IndestructibleBlock indestructibleBlockRight = new IndestructibleBlock(new MatrixCoords(i, WorldCols - 1));
                engine.AddObject(indestructibleBlockLeft);
                engine.AddObject(indestructibleBlockRight);
            }

            for (int i = 0; i < WorldCols; i++)
            {
                IndestructibleBlock indestructibleBlockCeiling = new IndestructibleBlock(new MatrixCoords(0, i));
                engine.AddObject(indestructibleBlockCeiling);
            }
        }
예제 #19
0
        static void Initialize(Engine engine)
        {
            int startRow = 3;
            int startCol = 2;
            int endCol   = WorldCols - 2;

            // "paint" blocks
            for (int i = startCol; i < endCol; i++)
            {
                Block currBlock = new Block(new MatrixCoords(startRow, i));

                engine.AddObject(currBlock);
            }

            Ball theBall = new Ball(new MatrixCoords(WorldRows / 2, 2),
                                    new MatrixCoords(-1, 1));

            engine.AddObject(theBall);

            //TrailObject trailObject = new TrailObject(new MatrixCoords(4, 4), 3);
            //engine.AddObject(trailObject);

            // Таск 7
            // Test the MeteoriteBall by replacing the normal ball in the AcademyPopcornMain.cs file.

            //MeteoriteBall mBall = new MeteoriteBall(new MatrixCoords(WorldRows / 2 + 1, 1), new MatrixCoords(-1, 1), 3);
            //engine.AddObject(mBall);

            // task 9
            // Test the UnpassableBlock and the UnstoppableBall by adding them
            // to the engine in AcademyPopcornMain.cs file

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

            // "paint" unpassable blocks
            //for (int i = startCol; i < endCol; i++)
            //{
            //    UnpassableBlock currBlockTwo = new UnpassableBlock(new MatrixCoords(startRow + 2, i));

            //    engine.AddObject(currBlockTwo);
            //}

            // task 10
            //for (int i = startCol; i < endCol; i++)
            //{
            //    ExplodingBlock exBlock = new ExplodingBlock(new MatrixCoords(startRow + 2, i));
            //    engine.AddObject(exBlock);
            //}

            // task 11
            Gift gift = new Gift(new MatrixCoords(7, 15), new MatrixCoords(1, 0));

            engine.AddObject(gift);

            // task 12
            GiftBlock giftBlock = new GiftBlock(new MatrixCoords(5, 8));

            engine.AddObject(giftBlock);

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

            engine.AddObject(theRacket);

            // task 1
            // The AcademyPopcorn class contains an IndestructibleBlock class.
            // Use it to create side and ceiling walls to the game.
            // You can ONLY edit the AcademyPopcornMain.cs file.
            for (int row = 0; row < WorldRows; row++)
            {
                IndestructibleBlock borderBlockLeft = new IndestructibleBlock(new MatrixCoords(row, 0));
                engine.AddObject(borderBlockLeft);
            }

            for (int row = 0; row < WorldRows; row++)
            {
                IndestructibleBlock borderBlockRight = new IndestructibleBlock(new MatrixCoords(row, WorldCols - 1));
                engine.AddObject(borderBlockRight);
            }

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