Exemplo n.º 1
0
 public void CheckEnemyBlockCollisionLoop(IList <IBlock> BlocksAround, IEnemy enemy)
 {
     foreach (IBlock block in BlocksAround)
     {
         if (block != null)
         {
             Rectangle blockBox        = block.Rectangle;
             Rectangle intersectionBox = Rectangle.Intersect(blockBox, enemy.Rectangle);
             if (!intersectionBox.IsEmpty)
             {
                 Direction direction = AllCollisionHandler.GetCollisionDirection(intersectionBox, enemy.Rectangle, blockBox);
                 EnemyBlockHandler.HandleCollision(enemy, block, direction);
             }
         }
     }
 }
 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();
 }