| | |
| | | static Dictionary<uint, int> s_Sid2NpcIndexs = new Dictionary<uint, int>();
|
| | | static Dictionary<int, int> s_NpcCounts = new Dictionary<int, int>();
|
| | |
|
| | | static GA_NpcClientCollect autoNpc = null;
|
| | |
|
| | | HazyRegionIncidentType incidentType;
|
| | |
|
| | | HazyGrassModel model { get { return ModelCenter.Instance.GetModel<HazyGrassModel>(); } }
|
| | |
| | | s_CollectNpcs.Remove(_sid);
|
| | | }
|
| | |
|
| | | if (ClientDungeonStageUtility.clientMapId == HazyGrassModel.REIKI_CLIENTDATAMAP)
|
| | | var dungeon = ClientDungeonStageUtility.dungeonInfo;
|
| | | var hintId = dungeonModel.GetDungeonHintId(dungeon.mapId, dungeon.lineId);
|
| | | var dungeonHintConfig = DungeonHintConfig.Get(hintId);
|
| | | if (dungeonHintConfig != null)
|
| | | {
|
| | | var dungeon = ClientDungeonStageUtility.dungeonInfo;
|
| | | var hintId = dungeonModel.GetDungeonHintId(dungeon.mapId, dungeon.lineId);
|
| | | var dungeonHintConfig = DungeonHintConfig.Get(hintId);
|
| | | if (dungeonHintConfig != null)
|
| | | var collectCount = 0;
|
| | | for (int i = 0; i < dungeonHintConfig.NPC1ID.Length; i++)
|
| | | {
|
| | | var collectCount = 0;
|
| | | for (int i = 0; i < dungeonHintConfig.NPC1ID.Length; i++)
|
| | | collectCount += dungeonModel.GetDugneonNpcCollectCount(dungeonHintConfig.NPC1ID[i]);
|
| | | }
|
| | | if (dungeonHintConfig.targetValue1.Length > 0
|
| | | && dungeonHintConfig.targetValue1[0] > 0)
|
| | | {
|
| | | if (collectCount < dungeonHintConfig.targetValue1[0] - 1)
|
| | | {
|
| | | collectCount += dungeonModel.GetDugneonNpcCollectCount(dungeonHintConfig.NPC1ID[i]);
|
| | | }
|
| | | if (dungeonHintConfig.targetValue1.Length > 0
|
| | | && dungeonHintConfig.targetValue1[0] > 0)
|
| | | {
|
| | | if (collectCount < dungeonHintConfig.targetValue1[0] - 1)
|
| | | {
|
| | | TryGotoCloserNpc();
|
| | | }
|
| | | TryGotoCloserNpc();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | var minDis = float.MaxValue;
|
| | | var targetPosition = PlayerBornPosition1;
|
| | |
|
| | | autoNpc = null;
|
| | |
|
| | | foreach (var npc in s_CollectNpcs.Values)
|
| | | {
|
| | | var dis = MathUtility.CalDistance(hero.Pos, npc.Pos);
|
| | | if (minDis > dis)
|
| | | {
|
| | | minDis = dis;
|
| | | targetPosition = npc.Pos;
|
| | | autoNpc = npc;
|
| | | }
|
| | | }
|
| | |
|
| | | hero.MoveToPosition(targetPosition, 0.3f);
|
| | | if (autoNpc != null)
|
| | | {
|
| | | hero.OnPathFindStop -= OnHeroFindStop;
|
| | | hero.OnPathFindStop += OnHeroFindStop;
|
| | | MapTransferUtility.Instance.MoveToNPC(autoNpc.NpcConfig.NPCID, (int)autoNpc.ServerInstID);
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnHeroFindStop()
|
| | | {
|
| | | var hero = PlayerDatas.Instance.hero;
|
| | | if (hero == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | hero.OnPathFindStop -= OnHeroFindStop;
|
| | |
|
| | | if (ClientDungeonStageUtility.clientMapId == HazyGrassModel.REIKI_CLIENTDATAMAP)
|
| | | {
|
| | | if (PlayerDatas.Instance.baseData.LV >= model.autoCollectLevel)
|
| | | {
|
| | | if (autoNpc != null)
|
| | | {
|
| | | float _chkDistSqrt = MathUtility.DistanceSqrtXZ(hero.Pos, autoNpc.Pos);
|
| | | float _chkDist = GeneralDefine.CloseNpcDist + autoNpc.NpcConfig.ModelRadius + 0.3f;
|
| | |
|
| | | if (_chkDistSqrt <= Mathf.Pow(_chkDist, 2))
|
| | | {
|
| | | hero.SelectTarget = autoNpc;
|
| | | ClientCollectUtility.HandleCallback(E_NpcType.Collect, autoNpc.NpcConfig.NPCID, autoNpc.ServerInstID);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | void InitializeNpc()
|