public static void HandleKoopaCollision(Koopa koopa, IEnemy collidedEnemy, CollisionSide side)
        {
            Physics.GeneralPhysics.RepelObject(collidedEnemy, koopa, side);

            if (koopa.IsKicked)
            {
                collidedEnemy.TakeDamage();
                SoundFactory.Instance.PlayKickEnemySound();
            }
            else
            {
                if (!IsHorizontalCollision(side))
                {
                    return;
                }

                switch (collidedEnemy)
                {
                case Goomba collidedGoomba:
                    collidedGoomba.ChangeDirection(GetOppositeSide(side));
                    break;

                case Koopa collidedKoopa:
                    if (collidedKoopa.IsKicked)
                    {
                        koopa.TakeDamage();
                        SoundFactory.Instance.PlayKickEnemySound();
                    }
                    else
                    {
                        collidedKoopa.ChangeDirection(GetOppositeSide(side));
                    }
                    break;
                }

                koopa.ChangeDirection(side);
            }
        }
Esempio n. 2
0
 public void Execute()
 {
     koopa.TakeDamage();
 }