public void BigMarioFlowerLeftSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);
            testMario.Mushroom();
            expectedMario.Mushroom();
            expectedMario.Flower();

            Flower testFlower = new Flower(game);
            Flower expectedFlower = new Flower(game);
            expectedFlower.Disappear();

            ICollisionSide side = new LeftSideCollision();
            CollisionData collision = new CollisionData(testMario, testFlower, side);
            MarioItemCollisionHandler collisionHandler = new MarioItemCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is FireRightIdleState;
            bool expectedState = expectedMario.MarioState is FireRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
        public void FireMarioRedMushroomTopSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);
            expectedMario.Flower();
            testMario.Flower();

            RedMushroom testRedMushroom = new RedMushroom(game);
            RedMushroom expectedRedMushroom = new RedMushroom(game);
            expectedRedMushroom.Disappear();

            ICollisionSide side = new TopSideCollision();
            CollisionData collision = new CollisionData(testMario, testRedMushroom, side);
            MarioItemCollisionHandler collisionHandler = new MarioItemCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is FireRightIdleState;
            bool expectedState = expectedMario.MarioState is FireRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
        public void SmallMarioStarRightSideCollisionTest()
        {
            WorldManager.LoadListFromFile("World1-1", game);
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);
            expectedMario.Star();

            Star testStar = new Star(game);
            Star expectedStar = new Star(game);
            expectedStar.Disappear();

            ICollisionSide side = new RightSideCollision();
            CollisionData collision = new CollisionData(testMario, testStar, side);
            MarioItemCollisionHandler collisionHandler = new MarioItemCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is SmallRightIdleState;
            bool expectedState = expectedMario.MarioState is SmallRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
        public void BigMarioGreenMushroomRightSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);
            testMario.Mushroom();
            expectedMario.Mushroom();

            GreenMushroom testGreenMushroom = new GreenMushroom(game);
            GreenMushroom expectedGreenMushroom = new GreenMushroom(game);
            expectedGreenMushroom.Disappear();

            ICollisionSide side = new RightSideCollision();
            CollisionData collision = new CollisionData(testMario, testGreenMushroom, side);
            MarioItemCollisionHandler collisionHandler = new MarioItemCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is NormalRightIdleState;
            bool expectedState = expectedMario.MarioState is NormalRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
        public void FireMarioGoombaRightSideCollisionTest()
        {
            IMario testMario = new MarioInstance(game);
            testMario.VectorCoordinates = new Vector2(14, 0);
            IMario expectedMario = new MarioInstance(game);
            expectedMario.VectorCoordinates = new Vector2(16, 0);

            testMario.MarioState = new FireRightIdleState(testMario);
            expectedMario.MarioState = new FireRightIdleState(expectedMario);

            expectedMario.Damage();

            Goomba testGoomba = new Goomba(game);

            ICollisionSide side = new RightSideCollision();
            CollisionData collision = new CollisionData(testMario, testGoomba, side);
            MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is NormalRightIdleState;
            bool expectedState = expectedMario.MarioState is NormalRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
        public void NormalMarioKoopaLeftSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);
            expectedMario.VectorCoordinates = new Vector2(-1, 0);

            testMario.MarioState = new NormalRightIdleState(testMario);
            expectedMario.MarioState = new NormalRightIdleState(expectedMario);

            expectedMario.Damage();

            GreenKoopa testGreenKoopa = new GreenKoopa(game);
            testGreenKoopa.VectorCoordinates = new Vector2(14, 0);

            ICollisionSide side = new LeftSideCollision();
            CollisionData collision = new CollisionData(testMario, testGreenKoopa, side);
            MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is SmallRightIdleState;
            bool expectedState = expectedMario.MarioState is SmallRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
 public ProjectileTileCollisionHandler(CollisionData collision)
 {
     if (collision.GameObjectA is IProjectile)
     {
         projectile = (IProjectile)collision.GameObjectA;
     }
     else
     {
         projectile = (IProjectile)collision.GameObjectB;
     }
 }
 public WolverinePipeCollisionHandler(CollisionData collision)
 {
     this.collision = collision;
     collisionSide = (ICollisionSide)collision.CollisionSide;
     if (collision.GameObjectA is IWolverine)
     {
         enemy = (IWolverine)collision.GameObjectA;
     }
     else
     {
         enemy = (IWolverine)collision.GameObjectB;
         collisionSide = collisionSide.FlipSide();
     }
 }
 public PaddleBlockCollisionHandler(CollisionData collision)
 {
     this.collision = collision;
     collisionSide = (ICollisionSide)collision.CollisionSide;
     if (collision.GameObjectA is IPaddle)
     {
         paddle = (IPaddle)collision.GameObjectA;
     }
     else
     {
         paddle = (IPaddle)collision.GameObjectB;
         collisionSide = collisionSide.FlipSide();
     }
 }
 public BuckeyeTileCollisionHandler(CollisionData collision)
 {
     this.collision = collision;
     collisionSide = (ICollisionSide)collision.CollisionSide;
     if (collision.GameObjectA is IBuckeyePlayer)
     {
         player = (IBuckeyePlayer)collision.GameObjectA;
     }
     else
     {
         player = (IBuckeyePlayer)collision.GameObjectB;
         collisionSide = collisionSide.FlipSide();
     }
 }
 public PaddleBallItemCollisionHandler(CollisionData collision, IGameState gameState)
 {
     brickBreakerGameState = gameState;
     collisionSide = (ICollisionSide)collision.CollisionSide;
     if (collision.GameObjectA is IPaddle)
     {
         paddleBall = (IPaddleBall)collision.GameObjectA;
         collidingItem = (IItem)collision.GameObjectB;
     }
     else
     {
         paddleBall = (IPaddleBall)collision.GameObjectB;
         collidingItem = (IItem)collision.GameObjectA;
         collisionSide = collisionSide.FlipSide();
     }
 }
        public BuckeyeWolverineCollisionHandler(CollisionData collision)
        {
            this.collision = collision;

            side = collision.CollisionSide;
            if (collision.GameObjectA is IBuckeyePlayer)
            {
                player = (IBuckeyePlayer)collision.GameObjectA;
                enemy = (IWolverine)collision.GameObjectB;
            }
            else
            {
                player = (IBuckeyePlayer)collision.GameObjectB;
                enemy = (IWolverine)collision.GameObjectA;
                side = side.FlipSide();
            }
        }
 public PaddleBallBlockCollisionHandler(CollisionData collision, IGameState gameState)
 {
     this.collision = collision;
     brickBreakerGameState = gameState;
     collisionSide = (ICollisionSide)collision.CollisionSide;
     if (collision.GameObjectA is IPaddleBall)
     {
         collidingBall = (IPaddleBall)collision.GameObjectA;
         collidingBlock = (IBlock)collision.GameObjectB;
     }
     else
     {
         collidingBall = (IPaddleBall)collision.GameObjectB;
         collidingBlock = (IBlock)collision.GameObjectA;
         collisionSide = collisionSide.FlipSide();
     }
 }
        public BuckeyePipeCollisionHandler(CollisionData collision, IGameState gameState)
        {
            this.collision = collision;
            this.gameState = gameState;

            side = collision.CollisionSide;
            if (collision.GameObjectA is IBuckeyePlayer)
            {
                player = (IBuckeyePlayer)collision.GameObjectA;
                pipe = (IPipe)collision.GameObjectB;
            }
            else
            {
                player = (IBuckeyePlayer)collision.GameObjectB;
                pipe = (IPipe)collision.GameObjectA;
                side = side.FlipSide();
            }
        }
        public void FireMarioHiddenBlockTopSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);

            Block testBlock = new Block(Block.Type.HiddenBlock, game);
            Block expectedBlock = new Block(Block.Type.HiddenBlock, game);

            ICollisionSide side = new TopSideCollision();
            CollisionData collision = new CollisionData(testMario, testBlock, side);
            MarioBlockCollisionHandler collisionHandler = new MarioBlockCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is FireRightIdleState;
            bool expectedState = expectedMario.MarioState is FireRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
        public void SmallMarioCoinTopSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);

            Coin testCoin = new Coin(game);
            Coin expectedCoin = new Coin(game);
            expectedCoin.Disappear();

            ICollisionSide side = new TopSideCollision();
            CollisionData collision = new CollisionData(testMario, testCoin, side);
            MarioItemCollisionHandler collisionHandler = new MarioItemCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is SmallRightIdleState;
            bool expectedState = expectedMario.MarioState is SmallRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
        public void BigMarioQuestionBlockRightSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);

            Block testBlock = new Block(Block.Type.QuestionBlock, game);
            Block expectedBlock = new Block(Block.Type.QuestionBlock, game);
            expectedMario.VectorCoordinates = new Vector2(12, 0);

            ICollisionSide side = new RightSideCollision();
            CollisionData collision = new CollisionData(testMario, testBlock, side);
            MarioBlockCollisionHandler collisionHandler = new MarioBlockCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is NormalRightIdleState;
            bool expectedState = expectedMario.MarioState is NormalRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
        public void SmallMarioGoombaBottomSideCollisionTest()
        {
            IMario testMario = new MarioInstance(game);
            testMario.VectorCoordinates = new Vector2(0, 14);
            IMario expectedMario = new MarioInstance(game);
            expectedMario.VectorCoordinates = new Vector2(0, 16);
            expectedMario.Damage();

            Goomba testGoomba = new Goomba(game);

            ICollisionSide side = new BottomSideCollision();
            CollisionData collision = new CollisionData(testMario, testGoomba, side);
            MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is DeadMarioState;
            bool expectedState = expectedMario.MarioState is DeadMarioState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
        public void SmallMarioGoombaTopSideCollisionTest()
        {
            IMario testMario = new MarioInstance(game);

            Goomba testGoomba = new Goomba(game);
            testGoomba.VectorCoordinates = new Vector2(0, 14);
            Goomba expectedGoomba = new Goomba(game);
            expectedGoomba.Hit();

            ICollisionSide side = new TopSideCollision();
            CollisionData collision = new CollisionData(testMario, testGoomba, side);
            MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testGoomba.state is GoombaSmashedState;
            bool expectedState = expectedGoomba.state is GoombaSmashedState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = new Vector2(0, -1);

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
        public void StarSmallMarioGoombaTopCollisionTest()
        {
            WorldManager.LoadListFromFile("World1-1", game);
            IMario testMario = WorldManager.GetMario();
            testMario.Star();
            testMario = WorldManager.GetMario();
            testMario.VectorCoordinates = new Vector2(0, 0);

            Goomba testGoomba = new Goomba(game);
            testGoomba.VectorCoordinates = new Vector2(0, 14);
            Goomba expectedGoomba = new Goomba(game);
            expectedGoomba.Flipped();

            ICollisionSide side = new TopSideCollision();
            CollisionData collision = new CollisionData(testMario, testGoomba, side);
            MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testGoomba.state is GoombaFlippedState;
            bool expectedState = expectedGoomba.state is GoombaFlippedState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = new Vector2(0, -1);

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
        public void StarNormalMarioKoopaTopCollisionTest()
        {
            WorldManager.LoadListFromFile("World1-1", game);
            IMario testMario = WorldManager.GetMario();
            testMario.Mushroom();
            testMario.Star();
            testMario = WorldManager.GetMario();
            testMario.VectorCoordinates = new Vector2(0, 0);

            GreenKoopa testGreenKoopa = new GreenKoopa(game);
            testGreenKoopa.VectorCoordinates = new Vector2(0, 30);
            GreenKoopa expectedGreenKoopa = new GreenKoopa(game);
            expectedGreenKoopa.Flipped();

            ICollisionSide side = new TopSideCollision();
            CollisionData collision = new CollisionData(testMario, testGreenKoopa, side);
            MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testGreenKoopa.state is GreenKoopaFlippedInShellState;
            bool expectedState = expectedGreenKoopa.state is GreenKoopaFlippedInShellState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = new Vector2(0, -1);

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
 public static void HandleCollision(CollisionData collision, IGameState gameState)
 {
     if ((collision.GameObjectA is IMario && collision.GameObjectB is IEnemy) || (collision.GameObjectA is IEnemy && collision.GameObjectB is IMario))
     {
         MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IMario && collision.GameObjectB is IBlock) || (collision.GameObjectA is IBlock && collision.GameObjectB is IMario))
     {
         MarioBlockCollisionHandler collisionHandler = new MarioBlockCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IMario && collision.GameObjectB is IItem) || (collision.GameObjectA is IItem && collision.GameObjectB is IMario))
     {
         MarioItemCollisionHandler collisionHandler = new MarioItemCollisionHandler(collision, gameState);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IMario && collision.GameObjectB is IPipe) || (collision.GameObjectA is IPipe && collision.GameObjectB is IMario))
     {
         MarioPipeCollisionHandler collisionHandler = new MarioPipeCollisionHandler(collision, gameState);
         collisionHandler.HandleCollision();
     }
     else if (collision.GameObjectA is IEnemy && collision.GameObjectB is IEnemy)
     {
         EnemyEnemyCollisionHandler collisionHandler = new EnemyEnemyCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IEnemy && collision.GameObjectB is IBlock) || (collision.GameObjectA is IBlock && collision.GameObjectB is IEnemy))
     {
         EnemyBlockCollisionHandler collisionHandler = new EnemyBlockCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IEnemy && collision.GameObjectB is IPipe) || (collision.GameObjectA is IPipe && collision.GameObjectB is IEnemy))
     {
         EnemyPipeCollisionHandler collisionHandler = new EnemyPipeCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IEnemy && collision.GameObjectB is IProjectile) || (collision.GameObjectA is IProjectile && collision.GameObjectB is IEnemy))
     {
         EnemyFireballCollisionHandler collisionHandler = new EnemyFireballCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IItem && collision.GameObjectB is IBlock) || (collision.GameObjectA is IBlock && collision.GameObjectB is IItem))
     {
         ItemBlockCollisionHandler collisionHandler = new ItemBlockCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IItem && collision.GameObjectB is IPipe) || (collision.GameObjectA is IPipe && collision.GameObjectB is IItem))
     {
         ItemPipeCollisionHandler collisionHandler = new ItemPipeCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IBlock && collision.GameObjectB is IProjectile) || (collision.GameObjectA is IProjectile && collision.GameObjectB is IBlock))
     {
         BlockFireballCollisionHandler collisionHandler = new BlockFireballCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IPipe && collision.GameObjectB is IProjectile) || (collision.GameObjectA is IProjectile && collision.GameObjectB is IPipe))
     {
         PipeFireballCollisionHandler collisionHandler = new PipeFireballCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IMario && collision.GameObjectB is IFlagPole) || (collision.GameObjectA is IFlagPole && collision.GameObjectB is IMario))
     {
         MarioFlagPoleCollisionHandler collisionHandler = new MarioFlagPoleCollisionHandler(collision, gameState);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IBuckeyePlayer && collision.GameObjectB is IBuckeyeTile) || (collision.GameObjectA is IBuckeyeTile && collision.GameObjectB is IBuckeyePlayer))
     {
         BuckeyeTileCollisionHandler collisionHandler = new BuckeyeTileCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IBuckeyePlayer && collision.GameObjectB is IProjectile) || (collision.GameObjectA is IProjectile && collision.GameObjectB is IBuckeyePlayer))
     {
         BuckeyeProjectileCollisionHandler collisionHandler = new BuckeyeProjectileCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IWolverine && collision.GameObjectB is IBuckeyeTile) || (collision.GameObjectA is IBuckeyeTile && collision.GameObjectB is IWolverine))
     {
         WolverineTileCollisionHandler collisionHandler = new WolverineTileCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IWolverine && collision.GameObjectB is IPipe) || (collision.GameObjectA is IPipe && collision.GameObjectB is IWolverine))
     {
         WolverinePipeCollisionHandler collisionHandler = new WolverinePipeCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IWolverine && collision.GameObjectB is IProjectile) || (collision.GameObjectA is IProjectile && collision.GameObjectB is IWolverine))
     {
         WolverineProjectileCollisionHandler collisionHandler = new WolverineProjectileCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IBuckeyePlayer && collision.GameObjectB is IWolverine) || (collision.GameObjectA is IWolverine && collision.GameObjectB is IBuckeyePlayer))
     {
         BuckeyeWolverineCollisionHandler collisionHandler = new BuckeyeWolverineCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IBuckeyePlayer && collision.GameObjectB is IPipe) || (collision.GameObjectA is IPipe && collision.GameObjectB is IBuckeyePlayer))
     {
         BuckeyePipeCollisionHandler collisionHandler = new BuckeyePipeCollisionHandler(collision, gameState);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IProjectile && collision.GameObjectB is IProjectile) || (collision.GameObjectA is IProjectile && collision.GameObjectB is IProjectile))
     {
         ProjectileProjectileCollisionHandler collisionHandler = new ProjectileProjectileCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IProjectile && collision.GameObjectB is IBuckeyeTile) || (collision.GameObjectA is IBuckeyeTile && collision.GameObjectB is IProjectile))
     {
         ProjectileTileCollisionHandler collisionHandler = new ProjectileTileCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IEnemy && collision.GameObjectB is Elevator) || (collision.GameObjectA is Elevator && collision.GameObjectB is IEnemy))
     {
         EnemyElevatorCollisionHandler collisionHandler = new EnemyElevatorCollisionHandler(collision, gameState);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IEnemy && collision.GameObjectB is Endblock) || (collision.GameObjectA is Endblock && collision.GameObjectB is IEnemy))
     {
         EnemyEndblockCollisionHandler collisionHandler = new EnemyEndblockCollisionHandler(gameState);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IItem && collision.GameObjectB is IPaddleBall) || (collision.GameObjectA is IPaddleBall && collision.GameObjectB is IItem))
     {
         PaddleBallItemCollisionHandler collisionHandler = new PaddleBallItemCollisionHandler(collision, gameState);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IBlock && collision.GameObjectB is IPaddle) || (collision.GameObjectA is IPaddle && collision.GameObjectB is IBlock))
     {
         PaddleBlockCollisionHandler collisionHandler = new PaddleBlockCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IPaddleBall && collision.GameObjectB is IPaddle) || (collision.GameObjectA is IPaddle && collision.GameObjectB is IPaddleBall))
     {
         PaddlePaddleBallCollisionHandler collisionHandler = new PaddlePaddleBallCollisionHandler(collision);
         collisionHandler.HandleCollision();
     }
     else if ((collision.GameObjectA is IPaddleBall && collision.GameObjectB is IBlock) || (collision.GameObjectA is IBlock && collision.GameObjectB is IPaddleBall))
     {
         PaddleBallBlockCollisionHandler collisionHandler = new PaddleBallBlockCollisionHandler(collision, gameState);
         collisionHandler.HandleCollision();
     }
 }
        public void FireMarioKoopaBottomSideCollisionTest()
        {
            IMario testMario = new MarioInstance(game);
            testMario.VectorCoordinates = new Vector2(0, 19);
            IMario expectedMario = new MarioInstance(game);
            expectedMario.VectorCoordinates = new Vector2(0, 21);
            expectedMario.Damage();

            GreenKoopa testGreenKoopa = new GreenKoopa(game);

            ICollisionSide side = new BottomSideCollision();
            CollisionData collision = new CollisionData(testMario, testGreenKoopa, side);
            MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is FireRightIdleState;
            bool expectedState = expectedMario.MarioState is FireRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
        public void NormalMarioKoopaTopSideCollisionTest()
        {
            IMario testMario = new MarioInstance(game);
            testMario.MarioState = new NormalRightIdleState(testMario);

            GreenKoopa testGreenKoopa = new GreenKoopa(game);
            testGreenKoopa.VectorCoordinates = new Vector2(0, 30);
            GreenKoopa expectedGreenKoopa = new GreenKoopa(game);
            expectedGreenKoopa.Hit();

            ICollisionSide side = new TopSideCollision();
            CollisionData collision = new CollisionData(testMario, testGreenKoopa, side);
            MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testGreenKoopa.state is GreenKoopaHidingInShellState;
            bool expectedState = expectedGreenKoopa.state is GreenKoopaHidingInShellState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = new Vector2(0, -1);

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
        public void SmallMarioBreakingBlockBottomSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);
            expectedMario.VectorCoordinates = new Vector2(0, 15);
            Block testBlock = new Block(Block.Type.BreakingBlock, game);
            Block expectedBlock = new Block(Block.Type.BreakingBlock, game);

            ICollisionSide side = new BottomSideCollision();
            CollisionData collision = new CollisionData(testMario, testBlock, side);
            MarioBlockCollisionHandler collisionHandler = new MarioBlockCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is SmallRightIdleState;
            bool expectedState = expectedMario.MarioState is SmallRightIdleState;
            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
        public static void HandleCollision(CollisionData collision, IGameState gameState){

            if ((collision.GameObjectA is IMario && collision.GameObjectB is IEnemy) || (collision.GameObjectA is IEnemy && collision.GameObjectB is IMario))
            {
                MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IMario && collision.GameObjectB is IBlock) || (collision.GameObjectA is IBlock && collision.GameObjectB is IMario))
            {
                MarioBlockCollisionHandler collisionHandler = new MarioBlockCollisionHandler(collision);
                collisionHandler.HandleCollision();   
            }
            else if ((collision.GameObjectA is IMario && collision.GameObjectB is IItem) || (collision.GameObjectA is IItem && collision.GameObjectB is IMario))
            {
                MarioItemCollisionHandler collisionHandler = new MarioItemCollisionHandler(collision, gameState);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IMario && collision.GameObjectB is IPipe) || (collision.GameObjectA is IPipe && collision.GameObjectB is IMario))
            {
                MarioPipeCollisionHandler collisionHandler = new MarioPipeCollisionHandler(collision, gameState);
                collisionHandler.HandleCollision();
            }
            else if (collision.GameObjectA is IEnemy && collision.GameObjectB is IEnemy)
            {
                EnemyEnemyCollisionHandler collisionHandler = new EnemyEnemyCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IEnemy && collision.GameObjectB is IBlock) || (collision.GameObjectA is IBlock && collision.GameObjectB is IEnemy))
            {
                EnemyBlockCollisionHandler collisionHandler = new EnemyBlockCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IEnemy && collision.GameObjectB is IPipe) || (collision.GameObjectA is IPipe && collision.GameObjectB is IEnemy))
            {
                EnemyPipeCollisionHandler collisionHandler = new EnemyPipeCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IEnemy && collision.GameObjectB is IProjectile) || (collision.GameObjectA is IProjectile && collision.GameObjectB is IEnemy))
            {
                EnemyFireballCollisionHandler collisionHandler = new EnemyFireballCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IItem && collision.GameObjectB is IBlock) || (collision.GameObjectA is IBlock && collision.GameObjectB is IItem))
            {
                ItemBlockCollisionHandler collisionHandler = new ItemBlockCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IItem && collision.GameObjectB is IPipe) || (collision.GameObjectA is IPipe && collision.GameObjectB is IItem))
            {
                ItemPipeCollisionHandler collisionHandler = new ItemPipeCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IBlock && collision.GameObjectB is IProjectile) || (collision.GameObjectA is IProjectile && collision.GameObjectB is IBlock))
            {
                BlockFireballCollisionHandler collisionHandler = new BlockFireballCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IPipe && collision.GameObjectB is IProjectile) || (collision.GameObjectA is IProjectile && collision.GameObjectB is IPipe))
            {
                PipeFireballCollisionHandler collisionHandler = new PipeFireballCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IMario && collision.GameObjectB is IFlagPole) || (collision.GameObjectA is IFlagPole && collision.GameObjectB is IMario))
            {
                MarioFlagPoleCollisionHandler collisionHandler = new MarioFlagPoleCollisionHandler(collision, gameState);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IBuckeyePlayer && collision.GameObjectB is IBuckeyeTile) || (collision.GameObjectA is IBuckeyeTile && collision.GameObjectB is IBuckeyePlayer))
            {
                BuckeyeTileCollisionHandler collisionHandler = new BuckeyeTileCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IBuckeyePlayer && collision.GameObjectB is IProjectile) || (collision.GameObjectA is IProjectile && collision.GameObjectB is IBuckeyePlayer))
            {
                BuckeyeProjectileCollisionHandler collisionHandler = new BuckeyeProjectileCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IWolverine && collision.GameObjectB is IBuckeyeTile) || (collision.GameObjectA is IBuckeyeTile && collision.GameObjectB is IWolverine))
            {
                WolverineTileCollisionHandler collisionHandler = new WolverineTileCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IWolverine && collision.GameObjectB is IPipe) || (collision.GameObjectA is IPipe && collision.GameObjectB is IWolverine))
            {
                WolverinePipeCollisionHandler collisionHandler = new WolverinePipeCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IWolverine && collision.GameObjectB is IProjectile) || (collision.GameObjectA is IProjectile && collision.GameObjectB is IWolverine))
            {
                WolverineProjectileCollisionHandler collisionHandler = new WolverineProjectileCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IBuckeyePlayer && collision.GameObjectB is IWolverine) || (collision.GameObjectA is IWolverine && collision.GameObjectB is IBuckeyePlayer))
            {
                BuckeyeWolverineCollisionHandler collisionHandler = new BuckeyeWolverineCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IBuckeyePlayer && collision.GameObjectB is IPipe) || (collision.GameObjectA is IPipe && collision.GameObjectB is IBuckeyePlayer))
            {
                BuckeyePipeCollisionHandler collisionHandler = new BuckeyePipeCollisionHandler(collision, gameState);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IProjectile && collision.GameObjectB is IProjectile) || (collision.GameObjectA is IProjectile && collision.GameObjectB is IProjectile))
            {
                ProjectileProjectileCollisionHandler collisionHandler = new ProjectileProjectileCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IProjectile && collision.GameObjectB is IBuckeyeTile) || (collision.GameObjectA is IBuckeyeTile && collision.GameObjectB is IProjectile))
            {
                ProjectileTileCollisionHandler collisionHandler = new ProjectileTileCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IEnemy && collision.GameObjectB is Elevator) || (collision.GameObjectA is Elevator && collision.GameObjectB is IEnemy))
            {
                EnemyElevatorCollisionHandler collisionHandler = new EnemyElevatorCollisionHandler(collision, gameState);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IEnemy && collision.GameObjectB is Endblock) || (collision.GameObjectA is Endblock && collision.GameObjectB is IEnemy))
            {
                EnemyEndblockCollisionHandler collisionHandler = new EnemyEndblockCollisionHandler(gameState);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IItem && collision.GameObjectB is IPaddleBall) || (collision.GameObjectA is IPaddleBall && collision.GameObjectB is IItem))
            {
                PaddleBallItemCollisionHandler collisionHandler = new PaddleBallItemCollisionHandler(collision, gameState);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IBlock && collision.GameObjectB is IPaddle) || (collision.GameObjectA is IPaddle && collision.GameObjectB is IBlock))
            {
                PaddleBlockCollisionHandler collisionHandler = new PaddleBlockCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IPaddleBall && collision.GameObjectB is IPaddle) || (collision.GameObjectA is IPaddle && collision.GameObjectB is IPaddleBall))
            {
                PaddlePaddleBallCollisionHandler collisionHandler = new PaddlePaddleBallCollisionHandler(collision);
                collisionHandler.HandleCollision();
            }
            else if ((collision.GameObjectA is IPaddleBall && collision.GameObjectB is IBlock) || (collision.GameObjectA is IBlock && collision.GameObjectB is IPaddleBall))
            {
                PaddleBallBlockCollisionHandler collisionHandler = new PaddleBallBlockCollisionHandler(collision, gameState);
                collisionHandler.HandleCollision();
            }
        }
 public ProjectileProjectileCollisionHandler(CollisionData collision)
 {
     this.collision = collision;
 }