using UnityEngine;

namespace Assets.Source.Core.Effecting
{
    public class EffectWithVfx : Effect
    {
        public Transform TargetTransform { get; }
        public VFXEffect VisualEffect { get; }

        protected EffectWithVfx(Transform target, VFXEffect vfx)
        {
            TargetTransform = target;
            VisualEffect = vfx;

            vfx.transform.Attach(target);
            OnStackSubtract += () =>
            {
                //vfx.transform.Unattach();
                vfx.SetPlaying(false);
                vfx.ReleaseAfterDelay();
            };
        }
    }
}
