Exemplo n.º 1
0
 public void linkObtainedItemDetection(ILink link, List <IItem> ObtainedItemList)
 {
     this.link             = link;
     this.ObtainedItemList = ObtainedItemList;
     foreach (IItem item in ObtainedItemList)
     {
         Rectangle  linkRectangle             = link.GetRectangle();
         Rectangle  ItemRectangle             = item.GetRectangle();
         ICollision side                      = new GeneralDetection(linkRectangle, ItemRectangle).ifCollision();
         IHandler   LinkObtainedItemCollision = new LinkObtainedItemCollisionHandler(link, item, side);
         LinkObtainedItemCollision.Execute();
     }
 }
Exemplo n.º 2
0
 public void linkBlockDetection(ILink link, List <IBlock> BlockList)
 {
     this.link      = link;
     this.BlockList = BlockList;
     foreach (IBlock block in BlockList)
     {
         Rectangle  linkRectangle      = link.GetRectangle();
         Rectangle  BlockRectangle     = block.GetRectangle();
         Rectangle  intersectRectangle = new GeneralDeterctionIntersect(linkRectangle, BlockRectangle).GetRectangle();
         ICollision side = new GeneralDetection(linkRectangle, BlockRectangle).ifCollision();
         IHandler   LinkBlockCollisionHandler = new LinkBlockCollisionHandler(link, block, side, intersectRectangle);
         LinkBlockCollisionHandler.Execute();
     }
 }
Exemplo n.º 3
0
        public void LinkEnemyDetection(ILink link, List <IEnemy> EnemyList)
        {
            this.link      = link;
            this.EnemyList = EnemyList;
            if (link.timer == 0)
            {
                foreach (IEnemy enemy in EnemyList)
                {
                    if (enemy.exist)
                    {
                        Rectangle linkRectangle      = link.GetRectangle();
                        Rectangle EnemyRectangle     = enemy.GetRectangle();
                        Rectangle intersectRectangle = new GeneralDeterctionIntersect(linkRectangle, EnemyRectangle).GetRectangle();

                        ICollision side = new GeneralDetection(linkRectangle, EnemyRectangle).ifCollision();
                        IHandler   LinkEnemyCollisionHandler = new LinkEnemyCollisionHandler(enemy, link, side, intersectRectangle);
                        LinkEnemyCollisionHandler.Execute();
                    }
                }
            }
        }
Exemplo n.º 4
0
        public void EnemyProjectileDetection(List <IEnemy> EnemyList, IProjectileFactory projectileFactory)
        {
            this.EnemyList         = EnemyList;
            this.projectileFactory = projectileFactory;
            List <IProjectile> projectileList = projectileFactory.ProjectileList;

            foreach (IEnemy enemy in EnemyList)
            {
                if (enemy.exist)
                {
                    foreach (IProjectile projectile in projectileList)
                    {
                        Rectangle  EnemyRectangle      = enemy.GetRectangle();
                        Rectangle  projectileRectangle = projectile.GetRectangle();
                        ICollision side = new GeneralDetection(EnemyRectangle, projectileRectangle).ifCollision();
                        IHandler   EnemyProjectileCollision = new EnemyProjectileCollisonHandler(enemy, projectile, side);
                        EnemyProjectileCollision.Execute();
                    }
                }
            }
        }
Exemplo n.º 5
0
        public void EnemyBlockDetection(List <IEnemy> EnemyList, List <IBlock> BlockList)
        {
            this.EnemyList = EnemyList;
            this.BlockList = BlockList;
            ICollision side = ICollision.Null;

            foreach (IEnemy enemy in EnemyList)
            {
                if (enemy.exist)
                {
                    foreach (IBlock block in BlockList)
                    {
                        Rectangle EnemyRectangle     = enemy.GetRectangle();
                        Rectangle BlockRectangle     = block.GetRectangle();
                        Rectangle intersectRectangle = new GeneralDeterctionIntersect(EnemyRectangle, BlockRectangle).GetRectangle();
                        side = new GeneralDetection(EnemyRectangle, BlockRectangle).ifCollision();
                        IHandler EnemyBlockCollisionHandler = new EnemyBlockCollisionHandler(enemy, block, side, intersectRectangle);
                        EnemyBlockCollisionHandler.Execute();
                    }
                }
            }
        }