public void CheckShellBossCollision(IWorld Level, GameStateManager gameState) { foreach (IEnemy enemy in Level.Enemies) { if (enemy.State is KoopaStompedKickedState) { Rectangle enemyBox = enemy.Rectangle; foreach (IBoss boss in Level.Bosses) { if (boss != enemy) { Rectangle bossBox = boss.Rectangle; Rectangle intersectionBox = Rectangle.Intersect(enemyBox, bossBox); if (!intersectionBox.IsEmpty) { ShellBossHandler.HandleCollision(gameState.world.Mario, enemy, boss); } } } } } }
public AllCollisionHandler(GameStateManager gameState) { this.gameState = gameState; Level = gameState.world; mario = gameState.world.Mario; MBHandler = new MarioBlockHandler(); MOHandler = new MarioBossHandler(); MEHandler = new MarioEnemyHandler(); MFHandler = new MarioFlagStuffHandler(); MIHandler = new MarioItemHandler(); MCHandler = new MarioCastleCollisionHandler(); IBHandler = new ItemBlockHandler(); EBHandler = new EnemyBlockHandler(); BBHandler = new BossBlockHandler(); SEHandler = new ShellEnemyHandler(); SBHandler = new ShellBossHandler(); FBHandler = new FireBallBlockHandler(); FEHandler = new FireBallEnemyHandler(); FOHandler = new FireBallBossHandler(); FSBHandler = new FireShotBlockHandler(); FSMHandler = new FireShotMarioHandler(); FHMHandler = new FireHellMarioHandler(); }