using NBF;
using UnityEngine;
using UnityEngine.Serialization;

public class FReel : FPlayerGear
{
    public bool isBlockLineByFinger { get; set; }


    [SerializeField] public float reelingDrag = 1f;


    public ReelAsset reelAsset;

    public ReelAnimator AnimatorCtrl;


    private void Awake()
    {
        reelAsset = GetComponent<ReelAsset>();
        AnimatorCtrl = reelAsset.animator.gameObject.GetComponent<ReelAnimator>();
        if (AnimatorCtrl == null)
        {
            AnimatorCtrl = reelAsset.animator.gameObject.AddComponent<ReelAnimator>();
        }
    }

    protected override void OnStart()
    {
    }

    protected override void OnUpdate()
    {
        AnimatorCtrl.Reeling = Owner.Data.reelSpeed;
        if (Owner.Data.reelSpeed > 0)
        {
            Unlock();
        }
        // Reeling();
    }

    public void Unlock(bool unlock = true)
    {
        if (unlock)
        {
            AnimatorCtrl.Unlock = true;
        }
        else
        {
            AnimatorCtrl.Unlock = false;
        }
    }
}