1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 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 PlayerEntityView : BattleEntityView<PlayerEntityVM>, ISkillContext, ISpineContext, IVfxContext, IStatesContext
- {
- public override Transform UIPoint => VM.UIPoint;
- protected override EEntityType DefaultTargetType => EEntityType.Monster;
- //public void FindTarget(int skillId)
- //{
- // Selector.FindAsync(this, EEntityType.Monster, (target) =>
- // {
- // SelectTarget(target, skillId);
- // });
- //}
- public IAnimator Animator => GetComponent<SpineComponent>();
- #region ISkillContext
- Transform ISkillContext.ActionRoot => VM.ActionRoot;
- void ISkillContext.OnSkillStart(int skillId)
- {
- }
- void ISkillContext.OnSkillStop(int skillId)
- {
- }
- #endregion
- #region ISpineContext
- SkeletonAnimation ISpineContext.Skeleton => VM.PlayerSkeleton;
- #endregion
- #region IVfxContext
- Transform IVfxContext.WorldTr => null;
- Transform IVfxContext.CenterTr => VM.Tr;
- Transform IVfxContext.CastTr => VM.VfxRoot;
- #endregion
- public override EpigraphicsComponent Epigraphics => null;
- }
- public class PlayerEntityVM : EntityViewModel
- {
- public Transform ActionRoot { get; private set; }
- public SkeletonAnimation PlayerSkeleton { get; private set; }
- public Transform VfxRoot { get; private set; }
- public Transform UIPoint { get; private set; }
- protected override void OnInit(IObjectCollector collector)
- {
- ActionRoot = collector.GetGameObject("ActionRoot").transform;
- PlayerSkeleton = collector.GetComponent<SkeletonAnimation>("PlayerSkeleton");
- VfxRoot = collector.GetGameObject("VfxRoot").transform;
- UIPoint = collector.GetGameObject("UIPoint").transform;
- }
- }
- }
|