예제 #1
0
        public static void HandleGoombaCollision(Goomba goomba, IEnemy collidedEnemy, CollisionSide side)
        {
            Physics.GeneralPhysics.RepelObject(collidedEnemy, goomba, side);

            if (!IsHorizontalCollision(side))
            {
                return;
            }

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

            case Koopa collidedKoopa:
                if (collidedKoopa.IsKicked)
                {
                    goomba.TakeDamage();
                    SoundFactory.Instance.PlayKickEnemySound();
                }
                else
                {
                    collidedKoopa.ChangeDirection(GetOppositeSide(side));
                }
                break;
            }
            goomba.ChangeDirection(side);
        }
예제 #2
0
        public static void HandleGoombaCollision(Goomba goomba, IBlock block, CollisionSide side)
        {
            Physics.GeneralPhysics.RepelObject(block, goomba, side);

            if (block.BlockPhysics.BlockBumped)
            {
                goomba.BeFlipped();
                SoundFactory.Instance.PlayKickEnemySound();
            }
            else
            {
                if (IsHorizontalCollision(side))
                {
                    goomba.ChangeDirection(side);
                }
            }
        }