using FL.Battle.Components;
using FL.Battle.Components.AI;
using UnityEngine;
using XGame.Framework.Map;
using XGame.Framework.ObjectCollection;

namespace FL.Map
{
    /// <summary>
    /// 陷阱实例
    /// </summary>
    public class TrapEntityView : SimpleEntityView<TrapEntityVM>, IVfxContext, ITrapAIContext
    {
        public VfxComponent Vfx => GetComponent<VfxComponent>();
        public TrapAI AI => GetComponent<TrapAI>();
        #region IVfxContext
        Transform IVfxContext.WorldTr => null;
        Transform IVfxContext.CenterTr => VM.Tr;
        Transform IVfxContext.CastTr => VM.Tr;
        #endregion
        GameObject ITrapAIContext.ParticleRoot => VM.ParticleRoot;
    }
    public class TrapEntityVM : EntityViewModel
    {
        public GameObject ParticleRoot { get; private set; }
        protected override void OnInit(IObjectCollector collector)
        {
            ParticleRoot = collector.GetGameObject("ParticleRoot");
        }
    }
}
