예제 #1
0
        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);
            }
        }
예제 #2
0
 public void Execute()
 {
     koopa.TakeDamage();
 }