using UnityEngine;
using FL.Battle;
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 skillId = 200705;//13521;
        private EntityAttributes _attr;
        public EntityAttributes Attr => _attr ?? (_attr = new EntityAttributes());

        /// <summary>
        /// 剑的偏移值，只记录左边的，右边对称获取
        /// </summary>
        public Vector3[] swordOffsets = new Vector3[] { new Vector3(-3.2f, 2.4f, 0), new Vector3(-2.4f, 1.8f, 0), new Vector3(-1.8f, 0.8f, 0), new Vector3(-1f, 0f, 0) };

        public Vector3 GetSwordOffset(int index)
        {
            var offset = swordOffsets[index % 4];
            if (index >= 4)
            {
                offset.x *= -1;
            }
            return offset;
        }
        public string MapAssetName
        {
            get
            {
                var chapter = ChapterTableRepo.Get(chapterId);
                var map = MapTableRepo.Get(chapter.Map);
                return map.AssetName;
            }
        }
    }
}