XiaoShiAndShow.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using CombatLibrary.CombatLibrary.CombatCore.CustomizeTimeLogic.FxLogic;
  2. using Core.Utility;
  3. using UnityEngine;
  4. using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventLogic;
  5. namespace GameLogic.Combat.Skill.MagicSkill
  6. {
  7. public class XiaoShiAndShow : MagicAttShowBasic
  8. {
  9. private Vector3 currSize;
  10. private Vector3 targetSize;
  11. private Vector3 currPos;
  12. private Vector3 targetPos;
  13. private float currTime;
  14. private float moveSpeed = 5;
  15. protected bool isUpdateMove;
  16. protected float showSizeTime;
  17. protected int state;
  18. private BesselPath _besselPathA;
  19. protected override void ProInit()
  20. {
  21. }
  22. protected override void ProSetInfo()
  23. {
  24. isUpdateMove = false;
  25. int odds = UnityEngine.Random.Range(0, 100);
  26. // if (odds < 1)
  27. {
  28. state = 0;
  29. TimeLineEventLogicGroupBasic timeLineEventLogicGroupBasic =
  30. _skillBasic.ActivationTimeLineData("sk1_xiaoshi");
  31. timeLineEventLogicGroupBasic.TimeLineUpdateEnd = XiaoShiFinish;
  32. }
  33. // else
  34. // {
  35. // state = 1;
  36. // // Vector3 p1 =
  37. // // _skillBasic.CombatHeroEntity.GameObject.transform.TransformPoint(new Vector3(-5f, 5f, 5f));
  38. // // Vector3 p2 = SetTargetPos2();
  39. // // _besselPathA.controlPoints.Add(_skillBasic.CombatHeroEntity.GameObject.transform.position);
  40. // // _besselPathA.controlPoints.Add(p1);
  41. // // _besselPathA.controlPoints.Add(p2);
  42. // // _besselPathA.controlPoints.Add(target.dotPos);
  43. // //
  44. //
  45. // _besselPathA = new BesselPath();
  46. // _besselPathA.controlPoints.Add(CombatHeroEntity.dotPos);
  47. // _besselPathA.controlPoints.Add(
  48. // CombatHeroEntity.GameObject.transform.TransformPoint(new Vector3(-5f, 5f, 5f)));
  49. //
  50. // _besselPathA.controlPoints.Add(target.GameObject.transform.TransformPoint(new Vector3(-5f, 6f, 5f)));
  51. // Vector3 headPos = target.dotPos + new Vector3(0, 5, 0);
  52. // _besselPathA.controlPoints.Add(headPos);
  53. // currTime = 0;
  54. // isUpdateMove = true;
  55. // }
  56. }
  57. private void XiaoShiFinish()
  58. {
  59. TimeLineMagicWeaponShowPointSerializtion timeLineMagicWeaponShowPointSerializtion = CombatHeroEntity
  60. .combatHeroTimeLineControl
  61. .GetTimeLineEventInfo<TimeLineMagicWeaponShowPointSerializtion>("sk1_show");
  62. if (timeLineMagicWeaponShowPointSerializtion != null)
  63. {
  64. switch (timeLineMagicWeaponShowPointSerializtion.showPointType)
  65. {
  66. case TimeLineMagicWeaponShowPointSerializtion.ShowPointType.Head:
  67. Vector3 headPos = target.dotPos + new Vector3(0, 8, 0);
  68. CombatHeroEntity.combatHeroGameObject.SetPosition(headPos);
  69. break;
  70. case TimeLineMagicWeaponShowPointSerializtion.ShowPointType.Customize:
  71. SpecialDotInfo specialDotInfo =
  72. target.GetSpecialDotInfo(timeLineMagicWeaponShowPointSerializtion.customizePointName);
  73. CombatHeroEntity.combatHeroGameObject.SetPosition(specialDotInfo.GetWorlPos());
  74. break;
  75. }
  76. }
  77. else
  78. {
  79. Vector3 headPos = target.dotPos + new Vector3(0, 8, 0);
  80. CombatHeroEntity.combatHeroGameObject.SetPosition(headPos);
  81. }
  82. CombatHeroEntity.combatHeroGameObject.SetScale(new Vector3(2, 2, 2));
  83. CombatHeroEntity.GameObject.transform.eulerAngles =
  84. new Vector3(0, target.GameObject.transform.eulerAngles.y + 180, 0);
  85. TimeLineEventLogicGroupBasic timeLineEventLogicGroupBasic =
  86. _skillBasic.ActivationTimeLineData("sk1_show");
  87. timeLineEventLogicGroupBasic.TimeLineUpdateEnd = ShowFinish;
  88. }
  89. private void ShowFinish()
  90. {
  91. TimeLineEventLogicGroupBasic timeLineEventLogicGroupBasic =
  92. _skillBasic.ActivationTimeLineData("sk1");
  93. if (timeLineEventLogicGroupBasic != null) //有表现.播表现,不需要位移
  94. {
  95. timeLineEventLogicGroupBasic.TimeLineUpdateEnd = AllFinish;
  96. }
  97. else //位移
  98. {
  99. showSizeTime = 0;
  100. currSize = Vector3.one;
  101. targetSize = Vector3.one * 2f;
  102. currPos = CombatHeroEntity.dotPos;
  103. targetPos = target.dotPos;
  104. currTime = 0;
  105. isUpdateMove = true;
  106. state = 3;
  107. }
  108. }
  109. private void AllFinish()
  110. {
  111. TimeLineEventLogicGroupBasic timeLineEventLogicGroupBasic =
  112. _skillBasic.ActivationTimeLineData("sk1_hit");
  113. callBack?.Invoke();
  114. }
  115. protected override void ProUpdate(float t)
  116. {
  117. if (!isUpdateMove)
  118. {
  119. return;
  120. }
  121. if (state == 1)
  122. {
  123. currTime += t * 0.5f;
  124. Vector3 a1 = _besselPathA.CalculatePoint(currTime);
  125. Vector3 a2 = _besselPathA.CalculatePoint(currTime - 0.01f);
  126. CombatHeroEntity.combatHeroGameObject.SetPosition(a1);
  127. CombatHeroEntity.GameObject.transform.rotation = Quaternion.LookRotation((a1 - a2).normalized);
  128. if (currTime > 1)
  129. {
  130. isUpdateMove = false;
  131. CombatHeroEntity.combatHeroGameObject.SetScale(new Vector3(3, 3, 3));
  132. CombatHeroEntity.GameObject.transform.eulerAngles =
  133. new Vector3(0, target.GameObject.transform.eulerAngles.y + 180, 0);
  134. ShowFinish();
  135. }
  136. }
  137. else if (state == 3)
  138. {
  139. currTime += t * moveSpeed;
  140. // Vector3 size = Vector3.Lerp(currSize, targetSize, currTime);
  141. Vector3 pos = Vector3.Lerp(currPos, targetPos, currTime);
  142. CombatHeroEntity.combatHeroGameObject.SetPosition(pos);
  143. // CombatHeroEntity.combatHeroGameObject.SetScale(size);
  144. if (currTime > 1)
  145. {
  146. isUpdateMove = false;
  147. AllFinish();
  148. }
  149. }
  150. }
  151. }
  152. }