using Common.Utility.CombatEvent; using Fort23.Core; using GameLogic.Combat.CombatTool; using GameLogic.Combat.CombatType; using GameLogic.Hero; using UnityEngine; namespace GameLogic.Combat.CombatGuide { public class Guide_GongJiang:GuideBasic { protected bool isTrgger; protected override void ProUpdate() { Trigger(); } protected void Trigger() { if (isTrgger) { return; } if (CombatController.currActiveCombat.CombatTypeBasic.dieHeroCount > 20) { isTrgger = true; Guide2(); } } private async void Guide2() { LevelBattleCombatType levelBattleCombatType = (LevelBattleCombatType)CombatController.currActiveCombat.CombatTypeBasic; int[] monsterId = new int[] { 9000101, 9000107, 9000108 }; CombatHeroEntity[] allHero = CombatController.currActiveCombat.CombatHeroController.GetHero(false); CombatHeroEntity combatHeroEntity = allHero[0]; Vector3 d = combatHeroEntity.dotPos + combatHeroEntity.faceDir * -10; CTaskAwaitBuffer cTaskAwaitBuffer = new CTaskAwaitBuffer(); for (int i = 0; i < 5; i++) { int monsterIndx = CombatCalculateTool.Instance.GetOdd(0, monsterId.Length); int id = monsterId[monsterIndx]; int level = 1; int star = 1; Vector3 pos = d + new Vector3(CombatCalculateTool.Instance.GetOdd(-150, 150) * 0.01f, 0, CombatCalculateTool.Instance.GetOdd(-150, 150) * 0.01f); levelBattleCombatType.ExtraCreateEnemy(cTaskAwaitBuffer, id, level, star, pos); } await cTaskAwaitBuffer.WaitAll(); await TimerComponent.Instance.WaitAsync(1000); Guide2_1(); } private async void Guide2_1() { CombatController.currActiveCombat.isStopAi = true; ShowDialogueEventData showDialogueEventData = ShowDialogueEventData.Create(); showDialogueEventData.finish = Guide2_2; showDialogueEventData.dialogueMessaga = new string[] { "怎么办我们后面好像也有敌人~~" }; showDialogueEventData.messageShowType = ShowDialogueEventData.MessageShowType.Verbatim; EventManager.Instance.Dispatch(CustomEventType.ShowDialogue, showDialogueEventData); } private async void Guide2_2() { AccountFileInfo.HeroData heroData2 = new AccountFileInfo.HeroData { heroModelId = 116, heroPowerId = 5, heroPromoteId = 3, isLead = true, }; HeroInfo heroInfo = new HeroInfo(); heroInfo.InitHero(heroData2); AccountFileInfo.Instance.playerData.HeroListData.Add(heroData2); PlayerManager.Instance.heroController.AddHero(heroInfo); AccountFileInfo.Instance.playerData.combatGuideIndex = 2; AccountFileInfo.Instance.SavePlayerData(); CombatHeroEntity[] allHero = CombatController.currActiveCombat.CombatHeroController.GetHero(false); CombatHeroEntity heroEntity = CObjectPool.Instance.Fetch(); heroEntity.IsEnemy = false; heroEntity.number = 1; Vector3 pos = allHero[0].dotPos + allHero[0].faceDir * -2; await heroEntity.Init(new CombatAIBasic(), heroInfo, pos, delegate(CombatHeroEntity entity) { CombatController.currActiveCombat.CombatHeroController.AddHero(entity); }); ShowDialogueEventData showDialogueEventData = ShowDialogueEventData.Create(); showDialogueEventData.finish = delegate { heroEntity.CombatHeroSkillControl.AddCommandSkill( heroEntity.CombatHeroSkillControl.GetSkillBasic(40001)); CombatController.currActiveCombat.isStopAi = false; CombatGuideManager.Instance.NextGuide(); }; showDialogueEventData.dialogueMessaga = new string[] { "后面的事情交给我,看我百步穿杨,百发百中!" }; showDialogueEventData.messageShowType = ShowDialogueEventData.MessageShowType.Verbatim; EventManager.Instance.Dispatch(CustomEventType.ShowDialogue, showDialogueEventData); } } }