123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using FL.Battle;
- using FL.Battle.Components;
- using Spine.Unity;
- using UnityEngine;
- using XGame.Framework.Map;
- using XGame.Framework.ObjectCollection;
- namespace FL.Map
- {
- public class MonsterEntityView : BattleEntityView<MonsterEntityVM>, ISkillContext, ISpineContext, IVfxContext, IStatesContext
- {
- public override Transform UIPoint => VM.UIPoint;
- protected override EEntityType DefaultTargetType => EEntityType.Player;
- //public void FindTarget(int skillId)
- //{
- // Selector.FindAsync(this, EEntityType.Player, (target) =>
- // {
- // SelectTarget(target, skillId);
- // });
- //}
- public IAnimator Animator => GetComponent<SpineComponent>();
- #region ISkillContext
- Transform ISkillContext.ActionRoot => VM.ActionRoot;
- #endregion
- #region ISpineContext
- SkeletonAnimation ISpineContext.Skeleton => VM.Skeleton;
- #endregion
- #region IVfxContext
- Transform IVfxContext.WorldTr => null;
- Transform IVfxContext.CenterTr => VM.Tr;
- Transform IVfxContext.CastTr => VM.Tr;
- #endregion
- public override EpigraphicsComponent Epigraphics => null;
- }
- public class MonsterEntityVM : EntityViewModel
- {
- public Transform ActionRoot { get; private set; }
- public Transform UIPoint { get; private set; }
- public SkeletonAnimation Skeleton { get; private set; }
- protected override void OnInit(IObjectCollector collector)
- {
- ActionRoot = collector.GetGameObject("ActionRoot").transform;
- UIPoint = collector.GetGameObject("UIPoint").transform;
- Skeleton = collector.GetComponent<SkeletonAnimation>("Skeleton");
- }
- }
- }
|