using UnityEngine;

public class ProjectileEffect : MonoBehaviour, ISkillEffect
{
    public void Execute(SkillInstance skill, Transform caster, float chargeRatio)
    {
        if (skill.Data.AttackEffectPrefab == null) return;

        Vector3 spawnPos = caster.position + caster.forward + Vector3.up;
        GameObject proj = Instantiate(skill.Data.AttackEffectPrefab, spawnPos, caster.rotation);

        // 투사체에 데미지 정보 전달
        // proj.GetComponent<Projectile>()?.Init(skill.CurrentLevelData.Damage * chargeRatio);
    }

    public void ExecuteAtPosition(SkillInstance skill, Transform caster, Vector3 targetPos, float chargeRatio)
    {
        if (skill.Data.AttackEffectPrefab == null) return;

        Vector3 spawnPos = caster.position + Vector3.up;
        Vector3 direction = (targetPos - spawnPos).normalized;
        Quaternion rotation = Quaternion.LookRotation(direction);
        GameObject proj = Instantiate(skill.Data.AttackEffectPrefab, spawnPos, rotation);

        // 투사체에 데미지 정보 전달
        // proj.GetComponent<Projectile>()?.Init(skill.CurrentLevelData.Damage * chargeRatio);
    }
}
