public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.goombaList.Count; ++i)
            {
                if (Game.goombaList[i].ShouldUpdate)
                {
                    for (int j = 0; j < Game.blocks.Count; ++j)
                    {
                        if (!Game.goombaList.ElementAt(i).ShouldCollide)
                        {
                            continue;
                        }
                        side = CollisionDetector.detectCollision(Game.goombaList[i], Game.blocks[j]);
                        if (!(side is NullCollision))
                        {
                            ICollisionHandler GoombaBlock = new GoombaBlockCollisionHandler(
                                side, Game.goombaList[i], Game);
                            GoombaBlock.handleCollision();
                        }
                    }
                }
            }
        }
        public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.goombaList.Count; ++i)
            {
                if (Game.goombaList[i].ShouldUpdate)
                {
                    // GoombaGoombaCollision
                    for (int j = i + 1; j < Game.goombaList.Count; ++j)
                    {
                        if (!Game.goombaList.ElementAt(i).ShouldCollide ||
                            !Game.goombaList.ElementAt(j).ShouldCollide)
                        {
                            continue;
                        }
                        side = CollisionDetector.detectCollision(Game.goombaList[i], Game.goombaList[j]);
                        if (!(side is NullCollision))
                        {
                            ICollisionHandler GoombaGoomba = new GoombaGoombaCollisionHandler(side);
                            GoombaGoomba.handleCollision();
                        }
                    }
                    // GoombaKoopaCollision
                    for (int k = 0; k < Game.koopaList.Count; ++k)
                    {
                        if (!Game.koopaList[k].shouldCollide)
                        {
                            continue;
                        }
                        side = CollisionDetector.detectCollision(Game.goombaList[i], Game.koopaList[k]);
                        if (!(side is NullCollision))
                        {
                            ICollisionHandler GoombaKoopa = new KoopaGoombaCollisionHandler(side, Game);
                            GoombaKoopa.handleCollision();
                        }
                    }
                }
            }
            for (int k = 0; k < Game.koopaList.Count; ++k)
            {
                if (Game.koopaList[k].ShouldUpdate)
                {
                    // KoopaKoopaCollision
                    for (int l = k + 1; l < Game.koopaList.Count; ++l)
                    {
                        if (!Game.koopaList[k].shouldCollide || !Game.koopaList[l].shouldCollide)
                        {
                            continue;
                        }
                        side = CollisionDetector.detectCollision(Game.koopaList[k], Game.koopaList[l]);
                        if (!(side is NullCollision))
                        {
                            ICollisionHandler KoopaKoopa = new KoopaKoopaCollisionHandler(side, Game);
                            KoopaKoopa.handleCollision();
                        }
                    }
                }
            }
        }
        public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.items.Count; ++i)
            {
                for (int k = 0; k < Game.objects.Count; ++k)
                {
                    side = CollisionDetector.detectCollision(Game.items[i], Game.objects[k]);
                    if (!(side is NullCollision) && (Game.objects[k] is SmallPipe || Game.objects[k] is MedPipe || Game.objects[k] is TallPipe))
                    {
                        ICollisionHandler itemPipe = new ItemPipeCollisionHandler(side);
                        itemPipe.handleCollision();
                    }
                }
            }
        }
Exemple #4
0
        public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.bowserList.Count; ++i)
            {
                for (int j = 0; j < Game.blocks.Count; ++j)
                {
                    side = CollisionDetector.detectCollision(Game.bowserList[i], Game.blocks[j]);
                    if (!(side is NullCollision))
                    {
                        ICollisionHandler BowserBlock = new BowserBlockCollisionHandler(Game.bowserList[i]);
                        BowserBlock.handleCollision();
                    }
                }
            }
        }
Exemple #5
0
        public void findCollision()
        {
            ICollision side = new NullCollision();

            foreach (PiranaPlant minion in Game.piranaPlantList)
            {
                if (!Game.Mario.ShouldCollide)
                {
                    break;
                }
                side = CollisionDetector.detectCollision(Game.Mario, minion);
                if (!(side is NullCollision))
                {
                    ICollisionHandler MarioPirana = new MarioPiranaCollisionHandler(side, Game);
                    MarioPirana.handleCollision();
                }
            }
        }
        public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.objects.Count; ++i)
            {
                if (!Game.Mario.ShouldCollide)
                {
                    break;
                }
                side = CollisionDetector.detectCollision(Game.Mario, Game.objects[i]);
                if (!(side is NullCollision) && !(Game.objects[i] is FlagPole) && !(Game.objects[i] is Fireball) &&
                    !(Game.objects[i] is BowserFire) && !(Game.objects[i] is Axe))
                {
                    ICollisionHandler MarioObject = new MarioObjectCollisionHandler(side, Game);
                    MarioObject.handleCollision();
                }
            }
        }
        public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.piranaPlantList.Count; i++)
            {
                if (Game.piranaPlantList[i].ShouldUpdate)
                {
                    for (int j = 0; j < Game.objects.Count; j++)
                    {
                        side = CollisionDetector.detectCollision(Game.piranaPlantList[i], Game.objects[j]);
                        if (!(side is NullCollision) && (Game.objects[j] is Fireball))
                        {
                            ICollisionHandler PiranaObject = new PiranaObjectCollisionHandler(side, Game.piranaPlantList[i], Game);
                            PiranaObject.handleCollision();
                        }
                    }
                }
            }
        }
        public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.objects.Count; ++i)
            {
                if (Game.objects[i].ShouldUpdate)
                {
                    for (int j = 0; j < Game.blocks.Count; ++j)
                    {
                        side = CollisionDetector.detectCollision(Game.objects[i], Game.blocks[j]);
                        if (!(side is NullCollision) && !(Game.blocks[j].State is HiddenBlockState))
                        {
                            ICollisionHandler ObjectBlock = new ObjectBlockCollisionHandler(side);
                            ObjectBlock.handleCollision();
                            //j = Game.blocks.Count;
                        }
                    }
                }
            }
        }
        public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.blocks.Count; ++i)
            {
                if (!Game.Mario.ShouldCollide)
                {
                    break;
                }
                if (Game.blocks[i].ShouldUpdate)
                {
                    side = CollisionDetector.detectCollision(Game.Mario, Game.blocks[i]);
                    if (!(side is NullCollision))
                    {
                        ICollisionHandler MarioBlock = new MarioBlockCollisionHandler(side, Game);
                        MarioBlock.handleCollision();
                    }
                }
            }
        }
Exemple #10
0
        public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.items.Count; ++i)
            {
                if (!Game.Mario.ShouldCollide)
                {
                    break;
                }
                if (Game.items[i].IsCollidable)
                {
                    side = CollisionDetector.detectCollision(Game.Mario, Game.items[i]);
                    if (!(side is NullCollision))
                    {
                        ICollisionHandler MarioItem = new MarioItemCollisionHandler(side, Game);
                        MarioItem.handleCollision();
                    }
                }
            }
        }
Exemple #11
0
        public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.objects.Count; i++)
            {
                for (int j = 0; j < Game.objects.Count; j++)
                {
                    if (Game.objects[i].Equals(Game.objects[j]))
                    {
                        continue;
                    }
                    side = CollisionDetector.detectCollision(Game.objects[i], Game.objects[j]);
                    if (!(side is NullCollision) && !(Game.objects[j] is Fireball))
                    {
                        ICollisionHandler ObjectPipe = new ObjectPipeCollisionHandler(side);
                        ObjectPipe.handleCollision();
                        //j = Game.objects.Count;
                    }
                }
            }
        }
        public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.koopaList.Count; ++i)
            {
                if (!Game.Mario.ShouldCollide)
                {
                    break;
                }
                if (!Game.koopaList[i].shouldCollide)
                {
                    continue;
                }
                side = CollisionDetector.detectCollision(Game.Mario, Game.koopaList[i]);
                if (!(side is NullCollision))
                {
                    ICollisionHandler MarioKoopa = new MarioKoopaCollisionHandler(side, Game);
                    MarioKoopa.handleCollision();
                }
            }
        }
        public void findCollision()
        {
            ICollision side = new NullCollision();

            foreach (Goomba minion in Game.goombaList)
            {
                if (!minion.ShouldCollide)
                {
                    continue;
                }
                if (!Game.Mario.ShouldCollide)
                {
                    break;
                }
                side = CollisionDetector.detectCollision(Game.Mario, minion);
                if (!(side is NullCollision))
                {
                    ICollisionHandler MarioGoomba = new MarioGoombaCollisionHandler(side, Game);
                    MarioGoomba.handleCollision();
                }
            }
        }
Exemple #14
0
        public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.items.Count; i++)
            {
                if (Game.items[i].ShouldUpdate)
                {
                    if (Game.items[i].IsCollidable)
                    {
                        for (int k = 0; k < Game.blocks.Count; k++)
                        {
                            side = CollisionDetector.detectCollision(Game.items[i], Game.blocks[k]);
                            if (!(side is NullCollision))
                            {
                                ICollisionHandler itemBlock = new ItemBlockCollisionHandler(side);
                                itemBlock.handleCollision();
                            }
                        }
                    }
                }
            }
        }
        public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.goombaList.Count; i++)
            {
                if (Game.goombaList[i].ShouldUpdate)
                {
                    for (int j = 0; j < Game.objects.Count; j++)
                    {
                        if (!Game.goombaList.ElementAt(i).ShouldCollide)
                        {
                            continue;
                        }
                        side = CollisionDetector.detectCollision(Game.goombaList[i], Game.objects[j]);
                        if (!(side is NullCollision) && !(Game.objects[j] is FlagPole))
                        {
                            ICollisionHandler GoombaObject = new GoombaObjectCollisionHandler(side, Game.goombaList[i], Game);
                            GoombaObject.handleCollision();
                        }
                    }
                }
            }
        }
        public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.koopaList.Count; i++)
            {
                if (Game.koopaList[i].ShouldUpdate)
                {
                    if (!Game.koopaList[i].shouldCollide)
                    {
                        continue;
                    }
                    for (int j = 0; j < Game.objects.Count; j++)
                    {
                        side = CollisionDetector.detectCollision(Game.koopaList[i], Game.objects[j]);
                        if (!(side is NullCollision) && !(Game.objects[j] is FlagPole))
                        {
                            ICollisionHandler KoopaObject = new KoopaObjectCollisionHandler(side, Game.koopaList[i], Game);
                            KoopaObject.handleCollision();
                        }
                    }
                }
            }
        }
        public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.koopaList.Count; ++i)
            {
                if (Game.koopaList[i].ShouldUpdate)
                {
                    if (!Game.koopaList[i].shouldCollide)
                    {
                        continue;
                    }
                    for (int j = 0; j < Game.blocks.Count; ++j)
                    {
                        side = CollisionDetector.detectCollision(Game.koopaList[i], Game.blocks[j]);
                        if (!(side is NullCollision))
                        {
                            ICollisionHandler KoopaBlock = new KoopaBlockCollisionHandler(side, Game.koopaList[i], Game);
                            KoopaBlock.handleCollision();
                        }
                    }
                }
            }
        }
Exemple #18
0
        protected override void Update(GameTime gameTime)
        {
            level.Update(gameTime);
            CollisionDetector c = new CollisionDetector(((Level1)level).entities, (Level1)level);

            c.Update();



            ////Update enemy sprites
            //redGoombaSprite.Update(gameTime);
            //redKoopaSprite.Update(gameTime);
            //greenKoopaSprite.Update(gameTime);

            ////Update item sprites
            //blockCoinSprite.Update(gameTime);
            //staticCoinSprite.Update(gameTime);
            //fireFlowerSprite.Update(gameTime);
            //_1UpMushroomSprite.Update(gameTime);
            //superMushroomSprite.Update(gameTime);
            //starmanSprite.Update(gameTime);

            //Update states of controllers
            keyboardController.Update();
            foreach (GamepadController controller in controllerArray)
            {
                controller.Update();
            }

            //Temporary block command keys

            if (keyboardController.previousKeyboardState.IsKeyDown(Keys.X))
            {
                Levels.Level1 levelController = (Levels.Level1)level;

                levelController.TestMarioLocation();
            }

            //if (keyboardController.CurrentKeys.Contains(Keys.B))
            //{

            //    grid.Remove(player);
            //    grid.Add(player);
            //    for (int i = 0; i < bunchOBlocks.Length; i++)
            //    {
            //        if (bunchOBlocks[i].GetBlockType().Equals(BlockContext.Blocks.BRICK))
            //        {
            //            bunchOBlocks[i].HitFromBottom(playerController);
            //        }
            //    }
            //}

            //if (keyboardController.CurrentKeys.Contains(Keys.H))
            //{
            //    for (int i = 0; i < bunchOBlocks.Length; i++)
            //    {
            //        if (bunchOBlocks[i].GetBlockType().Equals(BlockContext.Blocks.HIDDEN))
            //        {
            //            bunchOBlocks[i].HitFromBottom(playerController);
            //        }
            //    }
            //}

            ////Update block states
            //for(int i = 0; i<bunchOBlocks.Length; i++)
            //{
            //    bunchOBlocks[i].Update(gameTime);
            //}

            ////Update player state
            //playerController.Update(gameTime);



            base.Update(gameTime);
        }
Exemple #19
0
        public void findCollision()
        {
            ICollision side = new NullCollision();

            for (int i = 0; i < Game.goombaList.Count; ++i)
            {
                side = CollisionDetector.detectCollision(Game.MainCameraObject, Game.goombaList[i]);
                if (!(side is NullCollision))
                {
                    ICollisionHandler cameraUpdate = new CameraUpdateCollisionHandler(side);
                    cameraUpdate.handleCollision();
                }
                else
                {
                    ICollisionHandler cameraUpdate = new CameraUpdateNullCollisionHandler(side);
                    cameraUpdate.handleCollision();
                }
            }
            for (int i = 0; i < Game.koopaList.Count; ++i)
            {
                side = CollisionDetector.detectCollision(Game.MainCameraObject, Game.koopaList[i]);
                if (!(side is NullCollision))
                {
                    ICollisionHandler cameraUpdate = new CameraUpdateCollisionHandler(side);
                    cameraUpdate.handleCollision();
                }
                else
                {
                    ICollisionHandler cameraUpdate = new CameraUpdateNullCollisionHandler(side);
                    cameraUpdate.handleCollision();
                }
            }
            for (int i = 0; i < Game.piranaPlantList.Count; ++i)
            {
                side = CollisionDetector.detectCollision(Game.MainCameraObject, Game.piranaPlantList[i]);
                if (!(side is NullCollision))
                {
                    ICollisionHandler cameraUpdate = new CameraUpdateCollisionHandler(side);
                    cameraUpdate.handleCollision();
                }
                else
                {
                    ICollisionHandler cameraUpdate = new CameraUpdateNullCollisionHandler(side);
                    cameraUpdate.handleCollision();
                }
            }
            for (int i = 0; i < Game.items.Count; ++i)
            {
                side = CollisionDetector.detectCollision(Game.MainCameraObject, Game.items[i]);
                if (!(side is NullCollision))
                {
                    ICollisionHandler cameraUpdate = new CameraUpdateCollisionHandler(side);
                    cameraUpdate.handleCollision();
                }
            }
            for (int i = 0; i < Game.blocks.Count; ++i)
            {
                side = CollisionDetector.detectCollision(Game.MainCameraObject, Game.blocks[i]);
                if (!(side is NullCollision))
                {
                    ICollisionHandler cameraUpdate = new CameraUpdateCollisionHandler(side);
                    cameraUpdate.handleCollision();
                }
                else
                {
                    ICollisionHandler cameraUpdate = new CameraUpdateNullCollisionHandler(side);
                    cameraUpdate.handleCollision();
                }
            }
        }