private void HandleCollision(IPlayer mario, FireHell fireHell, Direction direction) { fireHell.IsRemove = true; if (!(mario.CurrentPowerState is MarioStarBigState || mario.CurrentPowerState is MarioStarSmallState)) { mario.TakeDamage(); } }
public void FireHellHandleLoop(IPlayer mario, FireHell fireHell) { Rectangle marioBox = mario.Rectangle; Rectangle intersectionBox = Rectangle.Intersect(marioBox, fireHell.Rectangle); if (!intersectionBox.IsEmpty) { Direction direction = AllCollisionHandler.GetCollisionDirection(intersectionBox, mario.Rectangle, fireHell.Rectangle); HandleCollision(mario, fireHell, direction); } }