Exemple #1
0
        public void FireHellHandleLoop(IPlayer mario, FireHell fireHell)
        {
            Rectangle marioBox        = mario.Rectangle;
            Rectangle intersectionBox = Rectangle.Intersect(marioBox, fireHell.Rectangle);

            if (!intersectionBox.IsEmpty)
            {
                Direction direction = AllCollisionHandler.GetCollisionDirection(intersectionBox, mario.Rectangle, fireHell.Rectangle);
                HandleCollision(mario, fireHell, direction);
            }
        }
Exemple #2
0
 public void CheckMarioEnemyCollision(Rectangle marioBox, IWorld Level)
 {
     foreach (IEnemy enemy in Level.Enemies)
     {
         Rectangle enemyBox        = enemy.Rectangle;
         Rectangle intersectionBox = Rectangle.Intersect(enemyBox, marioBox);
         if (!intersectionBox.IsEmpty)
         {
             Direction direction = AllCollisionHandler.GetCollisionDirection(intersectionBox, marioBox, enemyBox);
             MarioEnemyHandler.HandleCollision(Level.Mario, enemy, direction);
         }
     }
 }
 public void CheckMarioFlagCollision(Rectangle marioBox, IWorld Level, GameStateManager gameState)
 {
     foreach (FlagStuff flag in Level.FlagStuffs)
     {
         Rectangle flagBox         = flag.Rectangle;
         Rectangle intersectionBox = Rectangle.Intersect(flagBox, marioBox);
         if (!intersectionBox.IsEmpty)
         {
             Direction direction = AllCollisionHandler.GetCollisionDirection(intersectionBox, marioBox, flagBox);
             MarioFlagStuffHandler.HandleCollision(Level.Mario, flag, direction, gameState);
         }
     }
 }
Exemple #4
0
 public void CheckMarioBossCollision(Rectangle marioBox, IWorld Level)
 {
     foreach (IBoss boss in Level.Bosses)
     {
         Rectangle bossBox         = boss.Rectangle;
         Rectangle intersectionBox = Rectangle.Intersect(bossBox, marioBox);
         if (!intersectionBox.IsEmpty)
         {
             Direction direction = AllCollisionHandler.GetCollisionDirection(intersectionBox, marioBox, bossBox);
             HandleCollision(Level.Mario, boss, direction);
         }
     }
 }
Exemple #5
0
 public void CheckItemBlockCollisionLoop(IList <IBlock> BlocksAround, Rectangle itemBox, IItem item)
 {
     foreach (IBlock block in BlocksAround)
     {
         if (block != null)
         {
             Rectangle blockBox        = block.Rectangle;
             Rectangle intersectionBox = Rectangle.Intersect(blockBox, itemBox);
             if (!intersectionBox.IsEmpty)
             {
                 Direction direction = AllCollisionHandler.GetCollisionDirection(intersectionBox, itemBox, blockBox);
                 ItemBlockHandler.HandleCollision(item, block, direction);
             }
         }
     }
 }
Exemple #6
0
 public void FireBallHandleLoop(IList <IBlock> BlocksAround, Fireball fireball)
 {
     foreach (IBlock block in BlocksAround)
     {
         if (block != null)
         {
             Rectangle blockBox        = block.Rectangle;
             Rectangle intersectionBox = Rectangle.Intersect(blockBox, fireball.Rectangle);
             if (!intersectionBox.IsEmpty)
             {
                 Direction direction = AllCollisionHandler.GetCollisionDirection(intersectionBox, fireball.Rectangle, blockBox);
                 HandleCollision(fireball, block, direction);
             }
         }
     }
 }
Exemple #7
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 void CheckMarioBlockCollisionLoop(IPlayer mario, IList <IBlock> BlocksAround, IWorld Level, GameStateManager gameState)
 {
     foreach (IBlock block in BlocksAround)
     {
         if (block != null)
         {
             Rectangle blockBox        = block.Rectangle;
             Rectangle intersectionBox = Rectangle.Intersect(blockBox, mario.Rectangle);
             if (!intersectionBox.IsEmpty)
             {
                 Direction direction = AllCollisionHandler.GetCollisionDirection(intersectionBox, mario.Rectangle, blockBox);
                 HandleCollision(Level, Level.Mario, block, direction);
                 ChangeWorld(block, direction, Level, gameState);
             }
         }
     }
 }
Exemple #9
0
 public void CheckMarioCastleCollision(Rectangle marioBox, IWorld Level, GameStateManager gameState)
 {
     foreach (FlagStuff flag in Level.FlagStuffs)
     {
         foreach (Castle castle in Level.Castles)
         {
             Rectangle castleBox       = castle.Rectangle;
             Rectangle intersectionBox = Rectangle.Intersect(castleBox, marioBox);
             if (!intersectionBox.IsEmpty)
             {
                 Direction direction = AllCollisionHandler.GetCollisionDirection(intersectionBox, marioBox, castleBox);
                 if (flag.FinishFlagStuff)
                 {
                     MarioCastleCollisionHandler.HandleCollision(gameState, castle, direction);
                 }
             }
         }
     }
 }