private void Update() { if (m_CurBornNode == null) { bool hasNewDstNode = GenerateBornNode(); if (hasNewDstNode) { GameObject Npc_boy = Global.gApp.gResMgr.InstantiateObj("Prefabs/Campsite/NpcFight/Npc_boy"); Npc_boy.transform.position = m_CurBornNode.transform.position; m_BoyNpcTsf = Npc_boy.transform; FightNormalNpcPlayer npcPlayer = Npc_boy.GetComponent <FightNormalNpcPlayer>(); npcPlayer.FightCloseToRoleBehavior.SetPursueCallBack(CloseEndCallBack); npcPlayer.Init(); npcPlayer.SetBehavior(FightNpcPlayer.NpcBehaviorType.CloseToRole); Global.gApp.gGameCtrl.AddGlobalTouchMask(); } } if (m_StartMoveToNpc) { m_CurMoveTime += BaseScene.GetDtTime(); if (m_CurMoveTime < MoveTime) { m_Player.GetFight().Move(m_LockX, m_LockY); } else { m_Player.GetFight().Move(0, 0); m_StartMoveToNpc = false; Global.gApp.gGameCtrl.RemoveGlobalTouchMask(); ShowNewPlot(m_NewPlotId2, Plot2EndCallBack); } } }
private void AddTipNpc(float checkTime) { int curPass = m_PassData.id; int plotId = -1; string[] passInfo = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.NPC_BOY_APPEAR_PASS).contents; string[] plotInfo = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.NPC_BOY_APPEAR_WORD).contents; for (int i = 0; i < passInfo.Length; i++) { int newPassId = int.Parse(passInfo[i]); if (newPassId == curPass) { if (plotInfo.Length >= i) { plotId = int.Parse(plotInfo[i]); } break; } } if (plotId > 0) { m_TimerMgr.AddTimer(checkTime, 1, (float a, bool b) => { foreach (BornNode bornNode in m_BornNodes) { if (bornNode.GetIsOutMap()) { GameObject Npc_boy = Global.gApp.gResMgr.InstantiateObj("Prefabs/Campsite/NpcFight/Npc_boy"); Npc_boy.transform.position = bornNode.transform.position; FightNormalNpcPlayer npcPlayer = Npc_boy.GetComponent <FightNormalNpcPlayer>(); npcPlayer.Init(m_MainPlayer); npcPlayer.SetFoolAppearActPlotId(plotId); npcPlayer.SetBehavior(FightNpcPlayer.NpcBehaviorType.FoolAppear); return; } } AddTipNpc(2); }); } }