using UnityEngine;

namespace Unicorn.Hitbox
{
    public class UnicornHitbox : MonoBehaviour
    {
        public UnicornAttackDataSObj attackData;

        private void OnTriggerEnter2D(Collider2D other)
        {
            if (!other.TryGetComponent(out LivingEntity target)) return;
            var info = new DamageInfo
            {
                Damage = attackData.damage,
                KnockbackForce = attackData.knockbackForce,
                HitPoint = transform.position
            };

            target.Damage(info);
        }
    }
}