public static void HandleKoopaCollision(IPlayer player, Koopa koopa, CollisionSide side) { if (player.IsInvincible) { koopa.BeFlipped(); ScoreManager.CollectEnemyScore(koopa, false); SoundFactory.Instance.PlayKickEnemySound(); } else { if (koopa.State is KoopaStompedIdleState || koopa.State is KoopaRevivingState) { switch (side) { case CollisionSide.Top: if (koopa.Physics.Location.X <= player.MovementState.Location.X) { koopa.EnemyPhysics.FaceLeft(); } else { koopa.EnemyPhysics.FaceRight(); } player.MovementState.Bounce(); ScoreManager.CollectEnemyScore(koopa, true); break; case CollisionSide.Left: koopa.EnemyPhysics.FaceRight(); break; case CollisionSide.Right: koopa.EnemyPhysics.FaceLeft(); break; default: break; } koopa.BeKicked(); } else { if (side == CollisionSide.Top) { koopa.BeStomped(); ScoreManager.CollectEnemyScore(koopa, true); player.MovementState.Bounce(); } else { player.TakeDamage(); } } } }
public static void HandleKoopaCollision(Koopa koopa, IBlock block, CollisionSide side) { Physics.GeneralPhysics.RepelObject(block, koopa, side); if (block.BlockPhysics.BlockBumped) { koopa.BeFlipped(); SoundFactory.Instance.PlayKickEnemySound(); } else { if (IsHorizontalCollision(side)) { koopa.ChangeDirection(side); if (koopa.IsKicked) { SoundFactory.Instance.PlayBumpBlockSound(); } } } }
public void TakeDamage() { koopa.BeFlipped(); }