using FL.Battle;
using System.Collections.Generic;
using UnityEngine;
using XGame.Database;
using XGame.Framework.Data;

namespace FL.Data
{
    public class PlayerData : DataSingleton<PlayerData>
    {
        public long hp;
        public float moveSpeed = 5;
        public float radius;
        public float atkRange;
        public float alertRange;
        public int chapterId = 10010101;
        public int[] skillIds = new int[] { 10011 };//13521;200705 , 
        private EntityAttributes _attr;
        public EntityAttributes Attr => _attr ??= new EntityAttributes();
        public List<int> activePartnerIds = new List<int>() { 20511, 20521, 20541, 20531, 20561, 20551 };

        /// <summary>
        /// 剑的偏移值，只记录左边的，右边对称获取
        /// </summary>
        public Vector3[] partnerOffsets = new Vector3[] { new Vector3(-4.5f, 1.5f, 0), new Vector3(-3.5f, 0.6f, 0), new Vector3(-2.5f, -0.3f, 0) };

        public Vector3 GetPartnerOffset(int partnerId)
        {
            var index = activePartnerIds.IndexOf(partnerId);
            var offset = partnerOffsets[index % 3];
            if (index >= 3)
            {
                offset.x *= -1;
            }
            return offset;
        }
        public string MapAssetName
        {
            get
            {
                var chapter = ChapterTableRepo.Get(chapterId);
                var map = MapTableRepo.Get(chapter.Map);
                return map.AssetName;
            }
        }
    }
}