S3302.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using CombatLibrary.CombatLibrary.CombatCore.CustomizeTimeLogic.FxLogic;
  2. using Common.Utility.CombatEvent;
  3. using Fort23.Core;
  4. using GameLogic.Combat.Buff;
  5. using GameLogic.Combat.CombatTool;
  6. using UnityEngine;
  7. using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
  8. namespace GameLogic.Combat.Skill.MagicSkill
  9. {
  10. /// <summary>
  11. /// 一盏明灯围绕玩家,{0}秒内抵消所有负面效果,每{1}秒触发1次。
  12. /// </summary>
  13. public class S3302 : MagicSkillBasic
  14. {
  15. private CombatHeroEntity target;
  16. private bool isUpdate = false;
  17. private float _currTime;
  18. private float _jiaoDu;
  19. private Vector3 _dir;
  20. private Transform root;
  21. private float _lasetAddTime = -255;
  22. private int _AddCount;
  23. private bool isActiveSkill;
  24. protected override void ProInitSkill()
  25. {
  26. isActiveSkill = false;
  27. isUpdate = false;
  28. _currTime = 0;
  29. _AddCount = 0;
  30. _jiaoDu = 0;
  31. }
  32. protected override void ProMagicUseSkill()
  33. {
  34. TimeLineEventLogicGroupBasic sk1_show = ActivationTimeLineData("sk1_show");
  35. sk1_show.TimeLineUpdateEnd = ShowFinish;
  36. root = CombatMagicWeaponEntity.RootMagicWeaponControl.combatHeroEntity.GameObject.transform;
  37. _dir = Vector3.forward * 1;
  38. Vector3 d = root.rotation * _dir;
  39. CombatHeroEntity.GameObject.transform.position = d + root.position;
  40. // TimeLineEventLogicGroupBasic timeLineEventLogicGroupBasic = ActivationTimeLineData("sk1_xiaoshi");
  41. // timeLineEventLogicGroupBasic.TimeLineUpdateEnd = delegate()
  42. // {
  43. //
  44. //
  45. //
  46. // };
  47. isActiveSkill = true;
  48. CombatEventManager.Instance.AddEventListener(CombatEventType.StartAddBuff, StartAddBuff);
  49. }
  50. private void StartAddBuff(IEventData eventData)
  51. {
  52. if (!isActiveSkill)
  53. {
  54. return;
  55. }
  56. StartAddBuffEventData startAddBuffEventData = eventData as StartAddBuffEventData;
  57. if (startAddBuffEventData.target == CombatMagicWeaponEntity.RootMagicWeaponControl.combatHeroEntity)
  58. {
  59. BuffInfo buffInfo = startAddBuffEventData.BuffInfo;
  60. if (buffInfo.BuffConfig.buffType != 2)
  61. {
  62. return;
  63. }
  64. float t = CombatController.currActiveCombat.combatTime;
  65. float v = t - _lasetAddTime;
  66. if (v < effectValue[1] && _AddCount >= 1)
  67. {
  68. return;
  69. }
  70. if (v > effectValue[1])
  71. {
  72. _lasetAddTime = t;
  73. _AddCount = 0;
  74. }
  75. _AddCount++;
  76. startAddBuffEventData.isNotAddBuff = true;
  77. }
  78. }
  79. private void ShowFinish()
  80. {
  81. ActivationTimeLineData("sk1");
  82. isUpdate = true;
  83. _currTime = 0;
  84. }
  85. protected override void MagicSkillUpdate(float time)
  86. {
  87. if (!isUpdate)
  88. {
  89. return;
  90. }
  91. _currTime += time;
  92. if (_currTime >= SelfSkillConfig.effectValue[0])
  93. {
  94. ActivationTimeLineData("sk1_xiaoshi");
  95. SkillPlayFinish();
  96. isUpdate = false;
  97. return;
  98. }
  99. _jiaoDu -= 360 * time * 0.5f;
  100. Quaternion quaternionY = Quaternion.Euler(0, _jiaoDu, 0);
  101. Vector3 d = root.rotation * quaternionY * _dir+new Vector3(0,0.5f,0);
  102. CombatHeroEntity.GameObject.transform.position = d + root.position;
  103. }
  104. protected override void ProBreakMagicSkill()
  105. {
  106. SkillPlayFinish();
  107. isUpdate = false;
  108. isActiveSkill = false;
  109. }
  110. protected override void ProSkillPlayFinish()
  111. {
  112. isActiveSkill = false;
  113. CombatEventManager.Instance.RemoveEventListener(CombatEventType.StartAddBuff, StartAddBuff);
  114. }
  115. protected override void ProDispose()
  116. {
  117. isActiveSkill = false;
  118. CombatEventManager.Instance.RemoveEventListener(CombatEventType.StartAddBuff, StartAddBuff);
  119. }
  120. protected override ILifetCycleHitPoint[] ProGetTineLineTargetEntity(
  121. TimeLineEventLogicBasic timeLineEventLogicBasic)
  122. {
  123. ILifetCycleHitPoint[] lifetCycleHitPoints = new ILifetCycleHitPoint[1];
  124. lifetCycleHitPoints[0] = target.GetMainHotPoin<ILifetCycleHitPoint>();
  125. return lifetCycleHitPoints;
  126. }
  127. }
  128. }