public void onHit(Vector2 knockback)
        {
            if (_dying || ImmunityTime > 0.0f || battleEntity != null && !battleEntity.canTakeDamage)
            {
                return;
            }

            knockback *= Vector2.UnitX;
            battleEntity?.onHit(knockback);
            _hitAnimation = 0.25f;
            ImmunityTime  = ImmunityDuration;

            _hp--;
            if (_hp <= 0)
            {
                _animatedSprite.play("dying");
                _dying     = true;
                _deathTime = DeathDuration;
                battleEntity?.onDeath();
            }
        }
        public bool onHit(Vector2 knockback)
        {
            if (_dying || ImmunityTime > 0.0f || battleEntity != null && !battleEntity.canTakeDamage)
            {
                return(false);
            }

            knockback *= Vector2.UnitX;
            battleEntity?.onHit(knockback);
            _hitAnimation = 0.25f;
            ImmunityTime  = ImmunityDuration;

            HP -= damageHitFunction();
            if (HP <= 0)
            {
                _animatedSprite.play("dying");
                _dying     = true;
                _deathTime = DeathDuration;
                battleEntity?.onDeath();
            }

            return(true);
        }