private void DetectProjBlockCol(Fireball fBalls) { foreach (IBlock block in blockList) { Rectangle blockRec = block.DestinationRectangle(); if (block.visible && projRec.Intersects(blockRec)) { projBlock.CollidesFrom(projRec, blockRec); projBlockColHandler = new ProjectileBlockCollisionHandler(myGame); projBlockColHandler.vColFrom = projBlock.vColFrom; projBlockColHandler.HandleCollision(fBalls); } } }
private void DetectMarioEnemyCol() { foreach (IEnemy enemy in enemyList) { Rectangle enemyRec = enemy.DestinationRectangle(); if (enemy.visible && marioRec.Intersects(enemyRec)) { marioEnemy.CollidesFrom(marioRec, enemyRec); MarioEnemyCollisionHandler enemyColHandler = new MarioEnemyCollisionHandler(myGame); enemyColHandler.hColFrom = marioEnemy.hColFrom; enemyColHandler.vColFrom = marioEnemy.vColFrom; enemyColHandler.HandleCollision(myGame.mario, enemy); } } }
private void DetectMarioBlockCol() { foreach (IBlock block in blockList) { Rectangle blockRec = block.DestinationRectangle(); if (marioRec.Intersects(blockRec)) { marioBlock.CollidesFrom(marioRec, blockRec); MarioBlockCollisionHandler blockColHandler = new MarioBlockCollisionHandler(myGame); blockColHandler.hColFrom = marioBlock.hColFrom; blockColHandler.vColFrom = marioBlock.vColFrom; blockColHandler.intersecRec = Rectangle.Intersect(marioRec, blockRec); blockColHandler.HandleCollision(myGame.mario, block); } } }
public void Update() { enemyList = myGame.enemyCamList; blockList = myGame.blockCamList; foreach (IEnemy enemy in enemyList) { Rectangle enemyRec = enemy.DestinationRectangle(); foreach (IBlock block in blockList) { Rectangle blockRec = block.DestinationRectangle(); if (block.visible && enemyRec.Intersects(blockRec)) { enemyBlock.CollidesFrom(enemyRec, blockRec); EnemyCollisionHandler enemyColHandler = new EnemyCollisionHandler(myGame); enemyColHandler.hColFrom = enemyBlock.hColFrom; enemyColHandler.vColFrom = enemyBlock.vColFrom; enemyColHandler.HandleCollision(enemy); } } } }
public void Update() { itemList = myGame.itemCamList; blockList = myGame.blockCamList; foreach (IItem item in itemList) { Rectangle itemRec = item.DestinationRectangle(); foreach (IBlock block in blockList) { Rectangle blockRec = block.DestinationRectangle(); if (block.visible && itemRec.Intersects(blockRec)) { itemBlock.CollidesFrom(itemRec, blockRec); itemColHandler = new ItemCollisionHandler(myGame); itemColHandler.hColFrom = itemBlock.hColFrom; itemColHandler.vColFrom = itemBlock.vColFrom; itemColHandler.HandleCollision(item); } } } }