コード例 #1
0
ファイル: DetectCollision.cs プロジェクト: Kuqki/3902_ZJZH
 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();
     }
 }
コード例 #2
0
ファイル: DetectCollision.cs プロジェクト: Kuqki/3902_ZJZH
        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();
                    }
                }
            }
        }
コード例 #3
0
ファイル: DetectCollision.cs プロジェクト: Kuqki/3902_ZJZH
        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();
                    }
                }
            }
        }