using System;
using UnityEngine;

namespace FL.Battle
{
    public abstract class Entity : IEntity, IDisposable
    {
        public int TableId { get; private set; }
        public long EntityId { get; private set; }
        public EntityAttributes Attr { get; private set; }
        public int[] SkillIds { get; private set; }
        /// <summary>
        /// 出生坐标
        /// 相对于地图根节点的坐标
        /// </summary>
        public Vector3 BirthPosition { get; set; }

        public EEntityState State { get; set; }
        public void Init(int tableId, long entityId, EntityAttributes attr, int[] skillIds)
        {
            TableId = tableId;
            EntityId = entityId;
            Attr = attr;
            SkillIds = skillIds;
            State = EEntityState.Idle;
        }

        void IDisposable.Dispose()
        {
            OnDispose();
        }

        public abstract EEntityType EntityType { get; }

        protected virtual void OnDispose()
        {
        }

    }
}
