Guide_GongJiang.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using Common.Utility.CombatEvent;
  2. using Fort23.Core;
  3. using GameLogic.Combat.CombatTool;
  4. using GameLogic.Combat.CombatType;
  5. using GameLogic.Hero;
  6. using UnityEngine;
  7. namespace GameLogic.Combat.CombatGuide
  8. {
  9. public class Guide_GongJiang:GuideBasic
  10. {
  11. protected bool isTrgger;
  12. protected override void ProUpdate()
  13. {
  14. Trigger();
  15. }
  16. protected void Trigger()
  17. {
  18. if (isTrgger)
  19. {
  20. return;
  21. }
  22. if (CombatController.currActiveCombat.CombatTypeBasic.dieHeroCount > 20)
  23. {
  24. isTrgger = true;
  25. Guide2();
  26. }
  27. }
  28. private async void Guide2()
  29. {
  30. LevelBattleCombatType levelBattleCombatType =
  31. (LevelBattleCombatType)CombatController.currActiveCombat.CombatTypeBasic;
  32. int[] monsterId = new int[] { 9000101, 9000107, 9000108 };
  33. CombatHeroEntity[] allHero = CombatController.currActiveCombat.CombatHeroController.GetHero(false);
  34. CombatHeroEntity combatHeroEntity = allHero[0];
  35. Vector3 d = combatHeroEntity.dotPos + combatHeroEntity.faceDir * -10;
  36. CTaskAwaitBuffer cTaskAwaitBuffer = new CTaskAwaitBuffer();
  37. for (int i = 0; i < 5; i++)
  38. {
  39. int monsterIndx = CombatCalculateTool.Instance.GetOdd(0, monsterId.Length);
  40. int id = monsterId[monsterIndx];
  41. int level = 1;
  42. int star = 1;
  43. Vector3 pos = d + new Vector3(CombatCalculateTool.Instance.GetOdd(-150, 150) * 0.01f, 0,
  44. CombatCalculateTool.Instance.GetOdd(-150, 150) * 0.01f);
  45. levelBattleCombatType.ExtraCreateEnemy(cTaskAwaitBuffer, id, level, star, pos);
  46. }
  47. await cTaskAwaitBuffer.WaitAll();
  48. await TimerComponent.Instance.WaitAsync(1000);
  49. Guide2_1();
  50. }
  51. private async void Guide2_1()
  52. {
  53. CombatController.currActiveCombat.isStopAi = true;
  54. ShowDialogueEventData showDialogueEventData = ShowDialogueEventData.Create();
  55. showDialogueEventData.finish = Guide2_2;
  56. showDialogueEventData.dialogueMessaga = new string[] { "怎么办我们后面好像也有敌人~~" };
  57. showDialogueEventData.messageShowType = ShowDialogueEventData.MessageShowType.Verbatim;
  58. EventManager.Instance.Dispatch(CustomEventType.ShowDialogue, showDialogueEventData);
  59. }
  60. private async void Guide2_2()
  61. {
  62. AccountFileInfo.HeroData heroData2 = new AccountFileInfo.HeroData
  63. {
  64. heroModelId = 116,
  65. heroPowerId = 5,
  66. heroPromoteId = 3,
  67. isLead = true,
  68. };
  69. HeroInfo heroInfo = new HeroInfo();
  70. heroInfo.InitHero(heroData2);
  71. AccountFileInfo.Instance.playerData.HeroListData.Add(heroData2);
  72. PlayerManager.Instance.heroController.AddHero(heroInfo);
  73. AccountFileInfo.Instance.playerData.combatGuideIndex = 2;
  74. AccountFileInfo.Instance.SavePlayerData();
  75. CombatHeroEntity[] allHero = CombatController.currActiveCombat.CombatHeroController.GetHero(false);
  76. CombatHeroEntity heroEntity = CObjectPool.Instance.Fetch<CombatHeroEntity>();
  77. heroEntity.IsEnemy = false;
  78. heroEntity.number = 1;
  79. Vector3 pos = allHero[0].dotPos + allHero[0].faceDir * -2;
  80. await heroEntity.Init(new CombatAIBasic(), heroInfo, pos,
  81. delegate(CombatHeroEntity entity)
  82. {
  83. CombatController.currActiveCombat.CombatHeroController.AddHero(entity);
  84. });
  85. ShowDialogueEventData showDialogueEventData = ShowDialogueEventData.Create();
  86. showDialogueEventData.finish = delegate
  87. {
  88. heroEntity.CombatHeroSkillControl.AddCommandSkill(
  89. heroEntity.CombatHeroSkillControl.GetSkillBasic(40001));
  90. CombatController.currActiveCombat.isStopAi = false;
  91. CombatGuideManager.Instance.NextGuide();
  92. };
  93. showDialogueEventData.dialogueMessaga = new string[] { "后面的事情交给我,看我百步穿杨,百发百中!" };
  94. showDialogueEventData.messageShowType = ShowDialogueEventData.MessageShowType.Verbatim;
  95. EventManager.Instance.Dispatch(CustomEventType.ShowDialogue, showDialogueEventData);
  96. }
  97. }
  98. }