public void CheckShellEnemyCollision(IWorld Level, GameStateManager gameState) { foreach (IEnemy enemy1 in Level.Enemies) { if (enemy1.State is KoopaStompedKickedState) { Rectangle enemy1Box = enemy1.Rectangle; foreach (IEnemy enemy2 in Level.Enemies) { if (enemy2 != enemy1) { Rectangle enemy2Box = enemy2.Rectangle; Rectangle intersectionBox = Rectangle.Intersect(enemy1Box, enemy2Box); if (!intersectionBox.IsEmpty) { ShellEnemyHandler.HandleCollision(gameState.world.Mario, enemy1, enemy2); } } } } } }
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(); }