| | |
| | | |
| | | private void HandleCallback(E_NpcType type, int npcID, uint sid) |
| | | { |
| | | if (sid == ServerInstID) |
| | | var _hero = PlayerDatas.Instance.hero; |
| | | if (_hero != null) |
| | | { |
| | | OnClick(); |
| | | if (_hero.SelectTarget == null) |
| | | { |
| | | if (sid == ServerInstID) |
| | | { |
| | | OnClick(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var _collect = _hero.SelectTarget as GA_NpcClientCollect; |
| | | if (_collect != null) |
| | | { |
| | | float _chkDistSqrt = MathUtility.DistanceSqrtXZ(_hero.Pos, _collect.Pos); |
| | | |
| | | // 这里判断是否要走向此对象 |
| | | if (_chkDistSqrt < 4) |
| | | { |
| | | if (OnArrive != null) |
| | | { |
| | | OnArrive(_collect.ServerInstID, _collect.NpcConfig.NPCID); |
| | | } |
| | | |
| | | var _model = ModelCenter.Instance.GetModel<HazyGrassModel>(); |
| | | if (_model.CanCollectClientNpc(_collect.NpcConfig.NPCID)) |
| | | { |
| | | StartCollect(); |
| | | } |
| | | else |
| | | { |
| | | _model.DisplayCollectErrorTip(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _hero.MoveToPosition(_collect.Pos, 1.5f); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (sid == ServerInstID) |
| | | { |
| | | OnClick(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | float _chkDistSqrt = MathUtility.DistanceSqrtXZ(_hero.Pos, Pos); |
| | | |
| | | // 这里判断是否要走向此对象 |
| | | if (_chkDistSqrt > 2f) |
| | | { |
| | | _hero.MoveToPosition(Pos, 1f); |
| | | } |
| | | |
| | | if (_chkDistSqrt < 4) |
| | | { |
| | | if (OnArrive != null) |
| | | { |
| | | OnArrive(ServerInstID, NpcConfig.NPCID); |
| | | } |
| | | |
| | | var _model = ModelCenter.Instance.GetModel<HazyGrassModel>(); |
| | | if (_model.CanCollectClientNpc(NpcConfig.NPCID)) |
| | | { |
| | |
| | | { |
| | | _model.DisplayCollectErrorTip(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _hero.MoveToPosition(Pos, 1.5f); |
| | | } |
| | | } |
| | | |
| | |
| | | PrepareHandler.Instance.isPreparing = true; |
| | | WindowCenter.Instance.Open<NormalCollectWin>(); |
| | | m_StartCollect = true; |
| | | var _hero = PlayerDatas.Instance.hero; |
| | | if (_hero != null && !_hero.ActorInfo.serverDie) |
| | | { |
| | | _hero.Collect(); |
| | | } |
| | | } |
| | | |
| | | public void StopCollect() |
| | |
| | | PrepareHandler.Instance.isPreparing = false; |
| | | WindowCenter.Instance.Close<NormalCollectWin>(); |
| | | m_StartCollect = false; |
| | | var _hero = PlayerDatas.Instance.hero; |
| | | if (_hero != null && _hero.ActorInfo.serverDie) |
| | | { |
| | | if (_hero.IsCollect()) |
| | | { |
| | | _hero.IdleImmediate(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | protected override void OnUpdate() |
| | |
| | | } |
| | | else |
| | | { |
| | | if (m_ArrivedList.Contains(ServerInstID)) |
| | | { |
| | | if (OnLeave != null) |
| | | { |
| | | OnLeave(ServerInstID, NpcConfig.NPCID); |
| | | } |
| | | m_ArrivedList.Remove(ServerInstID); |
| | | } |
| | | Leave(); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | OnArrive(ServerInstID, NpcConfig.NPCID); |
| | | } |
| | | |
| | | if (!m_ArrivedList.Contains(ServerInstID)) |
| | | { |
| | | m_ArrivedList.Add(ServerInstID); |
| | | } |
| | | } |
| | | |
| | | public void Leave() |
| | | { |
| | | if (OnLeave != null) |
| | | if (m_ArrivedList.Contains(ServerInstID)) |
| | | { |
| | | OnLeave(ServerInstID, NpcConfig.NPCID); |
| | | if (OnLeave != null) |
| | | { |
| | | OnLeave(ServerInstID, NpcConfig.NPCID); |
| | | } |
| | | m_ArrivedList.Remove(ServerInstID); |
| | | } |
| | | } |
| | | } |