Exemplo n.º 1
0
        private void BoundaryCollision()
        {
            foreach (Rectangle wall in Game.CurrDungeon.Walls)
            {
                if (wall.Intersects(Game.Link.Hitbox))
                {
                    CollisionHandler.LinkHitBlock(Game.Link, wall);
                }

                foreach (IAttack attack in Game.CurrDungeon.Attacks.ToArray())
                {
                    if (attack.Hitbox.Intersects(wall))
                    {
                        attack.OnHit();
                    }
                }
                foreach (IItem item in Game.CurrDungeon.Items)
                {
                    if (item.Hitbox.Intersects(wall))
                    {
                        CollisionHandler.ItemHitWall(item, wall);
                    }
                }

                foreach (Monster monster in Game.CurrDungeon.Monsters)
                {
                    if (wall.Intersects(monster.Hitbox))
                    {
                        CollisionHandler.MonsterHitWall(monster, wall);
                    }
                }

                foreach (ITrap trap in Game.CurrDungeon.Traps)
                {
                    if (wall.Intersects(trap.Hitbox))
                    {
                        CollisionHandler.TrapHitWall(trap, wall);
                    }
                }
            }
        }