using System;
using RootMotion.FinalIK;
using UnityEngine;

namespace NBF
{
    /// <summary>
    /// 鱼竿资产配置
    /// </summary>
    public class RodAsset : PreviewableAsset
    {
        /// <summary>
        /// 根节点
        /// </summary>
        public Transform root;

        public Transform gripEnd;

        /// <summary>
        /// 左手连接点
        /// </summary>
        public Transform LeftHandConnector;

        /// <summary>
        /// 右手连接点
        /// </summary>
        public Transform RightHandConnector;

        /// <summary>
        /// 线轴连接点
        /// </summary>
        public Transform ReelConnector;

        /// <summary>
        /// 弯曲节点
        /// </summary>
        public Transform[] joints;

        /// <summary>
        /// 圈挂点
        /// </summary>
        public Transform[] rings;

        /// <summary>
        /// rings 画线
        /// </summary>
        public LineRenderer lineRenderer;

        /// <summary>
        /// 鱼线连接点
        /// </summary>
        public Transform lineConnector;

        public CCDIK CCDIK;


        public Rigidbody LineConnectorRigidbody;

        private void Awake()
        {
            CCDIK = GetComponent<CCDIK>();
            CCDIK.enabled = false;
            if (!lineConnector && joints.Length > 0)
            {
                lineConnector = joints[^1];
                // LineConnectorRigidbody = lineConnector.gameObject.AddComponent<Rigidbody>();
                // LineConnectorRigidbody.isKinematic = true;
                // LineConnectorRigidbody.useGravity = false;
            }
        }

        private void Start()
        {
            
        }
    }
}