using Common.Utility.CombatEvent; using Fort23.Core; using GameLogic.Combat.CombatTool; using GameLogic.Combat.CombatType; using GameLogic.Combat.Hero; using GameLogic.Hero; using UnityEngine; namespace GameLogic.Combat.CombatGuide { public class Guide_GongJiang : GuideBasic { protected bool isTrgger; private AccountFileInfo.HeroData heroData2; private HeroInfo heroInfo; private int state; private CombatHeroEntity heroEntity; protected override void ProUpdate() { Trigger(); } protected void Trigger() { if (state == 0) { if (isTrgger) { return; } LevelBattleCombatType levelBattleCombatType = (LevelBattleCombatType)CombatController.currActiveCombat.CombatTypeBasic; if (levelBattleCombatType._levelBattleConfig.ID == 2 && !levelBattleCombatType.isActiveCombat && !CombatController.currActiveCombat.isStopAi) { isTrgger = true; Guide2_0(); } } else if (state == 1) { if (isTrgger) { return; } CombatHeroEntity[] allHero = CombatController.currActiveCombat.CombatHeroController.GetHero(false); if (Vector3.Distance(allHero[0].dotPos, heroEntity.dotPos) < 5) { isTrgger = true; Guide2_1(); } } } private async void Guide2_0() { heroData2 = new AccountFileInfo.HeroData { heroModelId = 116, heroPowerId = 10, heroPromoteId = 3, isLead = true, }; heroInfo = new HeroInfo(); heroInfo.InitHero(heroData2); LevelBattleCombatType levelBattleCombatType = (LevelBattleCombatType)CombatController.currActiveCombat.CombatTypeBasic; heroEntity = CObjectPool.Instance.Fetch(); heroEntity.IsEnemy = false; heroEntity.number = 1; Vector3 pos = levelBattleCombatType.currBannerHero.dotPos ; await heroEntity.Init(new CombatAIBasic(), heroInfo, pos, delegate(CombatHeroEntity entity) { CombatController.currActiveCombat.CombatHeroController.AddHero(entity); }); // heroEntity.CombatAIBasic.ChangeState(CombatHeroStateType.NullState); CombatController.currActiveCombat.isStopAi = true; ShowDialogueEventData showDialogueEventData = ShowDialogueEventData.Create(); showDialogueEventData.finish = delegate { CombatController.currActiveCombat.isStopAi = false; state = 1; isTrgger = false; }; showDialogueEventData.dialogueMessaga = new string[] { "救命呀~", "救命~~~" }; showDialogueEventData.icon = new string[] { "icon_tx116", "icon_tx116" }; showDialogueEventData.messageShowType = ShowDialogueEventData.MessageShowType.Verbatim; EventManager.Instance.Dispatch(CustomEventType.ShowDialogue, showDialogueEventData); } private async void Guide2_1() { CombatController.currActiveCombat.isStopAi = true; ShowDialogueEventData showDialogueEventData = ShowDialogueEventData.Create(); showDialogueEventData.finish = Guide2_2; showDialogueEventData.dialogueMessaga = new string[] { "越往深林深处走怪物越强大了,这里的怪我有点招架不足了,我能不能加入你们一起探险?" }; showDialogueEventData.icon = new string[] { "icon_tx116"}; showDialogueEventData.messageShowType = ShowDialogueEventData.MessageShowType.Verbatim; EventManager.Instance.Dispatch(CustomEventType.ShowDialogue, showDialogueEventData); } private async void Guide2_2() { ShowDialogueEventData showDialogueEventData = ShowDialogueEventData.Create(); showDialogueEventData.finish = delegate { AccountFileInfo.Instance.playerData.HeroListData.Add(heroData2); PlayerManager.Instance.heroController.DeployHeroToLead(heroInfo); AccountFileInfo.Instance.playerData.combatGuideIndex =3; AccountFileInfo.Instance.SavePlayerData(); EventManager.Instance.Dispatch(CustomEventType.AlterCombatHero, null); CombatController.currActiveCombat.isStopAi = false; CombatGuideManager.Instance.NextGuide(); }; showDialogueEventData.dialogueMessaga = new string[] { "没问题,我们正缺你这样的勇士。","欢迎加入我们的队伍,让我们一起看看深林深处是什么在作怪。" }; showDialogueEventData.icon = new string[] { "icon_tx105"}; showDialogueEventData.messageShowType = ShowDialogueEventData.MessageShowType.Verbatim; EventManager.Instance.Dispatch(CustomEventType.ShowDialogue, showDialogueEventData); } } }