コード例 #1
0
        public void FireBallHandleLoop(IList <IBlock> BlocksAround, Fireball fireball, Rectangle fireballBox, IWorld Level, IPlayer mario)
        {
            foreach (IEnemy enemy in Level.Enemies)
            {
                Rectangle enemyBox        = enemy.Rectangle;
                Rectangle intersectionBox = Rectangle.Intersect(fireballBox, enemyBox);

                if (!(enemy.State is KoopaFlippedState))
                {
                    if (!intersectionBox.IsEmpty)
                    {
                        FireBallEnemyHandler.HandleCollision(fireball, enemy);
                        mario.ScoreObjects.Add(new Score.ScoreObject(Util.Instance.EnemyScore, enemy.Location, true));
                    }
                }
            }
        }
コード例 #2
0
 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();
 }