using System.Collections;
using System.Collections.Generic;
using Fort23.Core;
using Fort23.UTool;
using GameLogic.Combat.Hero;
using UnityEngine;
using UnityEngine.Rendering;
using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;

public class CombatHeroEntity : ITimeLineSpecialDotPos, ILifeCycle
{
    public bool IsEnemy;
    public CombatAIBasic CombatAIBasic;
    public CombatHeroGameObject combatHeroGameObject;
    public CombatHeroInfo CurrCombatHeroInfo;
    public CombatHeroInfo MaxCombatHeroInfo;
    public CombatHeroTimeLineControl combatHeroTimeLineControl;


    public Vector3 dotPos
    {
        get { return combatHeroGameObject.position; }
    }

    public Vector3 faceDir { get; }

    public async CTask<CombatHeroEntity> Init(CombatAIBasic combatAIBasic, CombatHeroInfo combatHeroInfo)
    {
        //后面记到检查战斗里面不要出现异步加载，也不要出现同步IO加载

        IGObjectPoolInterface poolInterface =
            await GObjectPool.Instance.FetchAsync<GameObjectPool>(combatHeroInfo.modelName + ".prefab", null);
#if !COMBAT_SERVER
        if (poolInterface == null || poolInterface.own == null)
        {
            return null;
        }


#endif
        return this;
    }

    public void Update(float t)
    {
    }

    public T This<T>()
    {
        return (T)(object)this;
    }

    public T GetILifetCycleHitPoint<T>(string hitPoinName, bool isStandType, bool isIgnoreHind)
        where T : ILifetCycleHitPoint
    {
        return combatHeroGameObject.GetILifetCycleHitPoint<T>(hitPoinName, isStandType, isIgnoreHind);
    }

    public T GetMainHotPoin<T>(bool isIgnoreHind) where T : ILifetCycleHitPoint
    {
        return combatHeroGameObject.GetMainHotPoin<T>(isIgnoreHind);
    }
}