TrapEntityView.cs 984 B

12345678910111213141516171819202122232425262728293031
  1. using FL.Battle.Components;
  2. using FL.Battle.Components.AI;
  3. using UnityEngine;
  4. using XGame.Framework.Map;
  5. using XGame.Framework.ObjectCollection;
  6. namespace FL.Map
  7. {
  8. /// <summary>
  9. /// 陷阱实例
  10. /// </summary>
  11. public class TrapEntityView : SimpleEntityView<TrapEntityVM>, IVfxContext, ITrapAIContext
  12. {
  13. public VfxComponent Vfx => GetComponent<VfxComponent>();
  14. public TrapAI AI => GetComponent<TrapAI>();
  15. #region IVfxContext
  16. Transform IVfxContext.WorldTr => null;
  17. Transform IVfxContext.CenterTr => VM.Tr;
  18. Transform IVfxContext.CastTr => VM.Tr;
  19. #endregion
  20. GameObject ITrapAIContext.ParticleRoot => VM.ParticleRoot;
  21. }
  22. public class TrapEntityVM : EntityViewModel
  23. {
  24. public GameObject ParticleRoot { get; private set; }
  25. protected override void OnInit(IObjectCollector collector)
  26. {
  27. ParticleRoot = collector.GetGameObject("ParticleRoot");
  28. }
  29. }
  30. }