TimeLineAlertLogic.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using Core.Triiger;
  2. using UnityEngine;
  3. using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
  4. namespace UTool.CustomizeTimeLogic.FxLogic.TimeLineEventLogic
  5. {
  6. public class TimeLineAlertLogic : TimeLineEventLogicBasic
  7. {
  8. private IUnRegister _enterRegister;
  9. private IUnRegister _exitRegister;
  10. protected override void ProSetCombatInfo()
  11. {
  12. }
  13. protected override void ProEnter()
  14. {
  15. TimeLineAlertSeriailztion timeLineAlertSeriailztion =
  16. mTimeLineAssetSerialization as TimeLineAlertSeriailztion;
  17. if (!string.IsNullOrEmpty(timeLineAlertSeriailztion.guid))
  18. {
  19. SpecialDotInfo specialDotInfo = castEntity.GetMainHotPoin<ILifetCycleHitPoint>(true)
  20. .GetSpecialDotInfo(timeLineAlertSeriailztion.guid);
  21. _enterRegister = specialDotInfo.targetTran.gameObject.OnTriggerEnterEvent(OnTriggerEnterEvent);
  22. _exitRegister = specialDotInfo.targetTran.gameObject.OnTriggerExitEvent(OnTriggerExitEvent);
  23. ITimeLineAlertTargetEnter timeLineAlertTarget =
  24. _timeLineTriggerEntity as ITimeLineAlertTargetEnter;
  25. if (timeLineAlertTarget != null)
  26. {
  27. timeLineAlertTarget.InitAlert(timeLineAlertSeriailztion,specialDotInfo.targetTran.gameObject);
  28. }
  29. }
  30. }
  31. protected void OnTriggerEnterEvent(Collider collider)
  32. {
  33. TimeLineAlertSeriailztion timeLineAlertSeriailztion =
  34. mTimeLineAssetSerialization as TimeLineAlertSeriailztion;
  35. ITimeLineAlertTargetEnter timeLineAlertTarget =
  36. _timeLineTriggerEntity as ITimeLineAlertTargetEnter;
  37. if (timeLineAlertTarget != null)
  38. {
  39. timeLineAlertTarget.Enter(timeLineAlertSeriailztion, collider);
  40. }
  41. }
  42. protected void OnTriggerExitEvent(Collider collider)
  43. {
  44. TimeLineAlertSeriailztion timeLineAlertSeriailztion =
  45. mTimeLineAssetSerialization as TimeLineAlertSeriailztion;
  46. ITimeLineAlertTargetEnter timeLineAlertTarget =
  47. _timeLineTriggerEntity as ITimeLineAlertTargetEnter;
  48. if (timeLineAlertTarget != null)
  49. {
  50. timeLineAlertTarget.Leave(timeLineAlertSeriailztion, collider);
  51. }
  52. }
  53. protected override void ProLeave()
  54. {
  55. TimeLineAlertSeriailztion timeLineAlertSeriailztion =
  56. mTimeLineAssetSerialization as TimeLineAlertSeriailztion;
  57. if (!string.IsNullOrEmpty(timeLineAlertSeriailztion.guid))
  58. {
  59. SpecialDotInfo specialDotInfo = castEntity.GetMainHotPoin<ILifetCycleHitPoint>(true)
  60. .GetSpecialDotInfo(timeLineAlertSeriailztion.guid);
  61. specialDotInfo.targetTran.gameObject.SetActive(false);
  62. ITimeLineAlertTargetEnter timeLineAlertTarget =
  63. _timeLineTriggerEntity as ITimeLineAlertTargetEnter;
  64. if (timeLineAlertTarget != null)
  65. {
  66. timeLineAlertTarget.LeaveAlert(timeLineAlertSeriailztion,specialDotInfo.targetTran.gameObject);
  67. }
  68. }
  69. _enterRegister?.UnRegister();
  70. _exitRegister?.UnRegister();
  71. }
  72. protected override void ProTimeUpdate()
  73. {
  74. }
  75. protected override void ProBreakTimeLine()
  76. {
  77. TimeLineAlertSeriailztion timeLineAlertSeriailztion =
  78. mTimeLineAssetSerialization as TimeLineAlertSeriailztion;
  79. if (!string.IsNullOrEmpty(timeLineAlertSeriailztion.guid))
  80. {
  81. SpecialDotInfo specialDotInfo = castEntity.GetMainHotPoin<ILifetCycleHitPoint>(true)
  82. .GetSpecialDotInfo(timeLineAlertSeriailztion.guid);
  83. specialDotInfo.targetTran.gameObject.SetActive(false);
  84. ITimeLineAlertTargetEnter timeLineAlertTarget =
  85. _timeLineTriggerEntity as ITimeLineAlertTargetEnter;
  86. if (timeLineAlertTarget != null)
  87. {
  88. timeLineAlertTarget.LeaveAlert(timeLineAlertSeriailztion,specialDotInfo.targetTran.gameObject);
  89. }
  90. }
  91. _enterRegister?.UnRegister();
  92. _exitRegister?.UnRegister();
  93. }
  94. protected override void ProDispose()
  95. {
  96. }
  97. }
  98. }