Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
| | |
| | | NavMesh.CalculatePath(source, dest, -1, _path);
|
| | | if (_path.corners != null && _path.corners.Length > 0)
|
| | | {
|
| | | return true;
|
| | | return MathUtility.DistanceSqrtXZ(dest, _path.corners[_path.corners.Length - 1]) < 0.01f;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
| | |
|
| | | CB405_tagCMSuperAtk _b405 = null;
|
| | | if (!ClientDungeonStageUtility.isClientDungeon
|
| | | && !ClientSceneManager.Instance.IsClientFightMode
|
| | | #if UNITY_EDITOR
|
| | | && !RuntimeLogUtility.TEST_CLIENT_PVP
|
| | | #endif
|
| | |
| | | || PlayerDatas.Instance.baseData.MapID == 52020
|
| | | || userSID != PlayerDatas.Instance.PlayerId
|
| | | || ClientDungeonStageUtility.isClientDungeon
|
| | | || ClientSceneManager.Instance.IsClientFightMode
|
| | | #if UNITY_EDITOR
|
| | | || RuntimeLogUtility.TEST_CLIENT_PVP
|
| | | #endif
|
| | |
| | | protected void AddToNpcPosList(GActorFight attacker, GActorFight target, int bodyControlId, Vector3 direction, List<NPCPos> npcPosList)
|
| | | {
|
| | | // Debug.LogFormat("{0} attack {1} ==================== 0", attacker.GetType().ToString(), target.GetType().ToString());
|
| | | if (PreFightMission.Instance.IsFinished() == false)
|
| | | if (!PreFightMission.Instance.IsFinished()
|
| | | || ClientSceneManager.Instance.IsClientFightMode)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | if (AttackHandler.CheckPull(attacker, target, bodyControlId) == false)
|
| | | if (!AttackHandler.CheckPull(attacker, target, bodyControlId))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | if (m_NpcPosList.Count > 0)
|
| | | {
|
| | | if (!ClientDungeonStageUtility.isClientDungeon
|
| | | && !ClientSceneManager.Instance.IsClientFightMode
|
| | | #if UNITY_EDITOR
|
| | | && !RuntimeLogUtility.TEST_CLIENT_PVP
|
| | | && !RuntimeLogUtility.TEST_CLIENT_PVP
|
| | | #endif
|
| | | )
|
| | | {
|
| | |
| | | OnCirclePanelTouched();
|
| | | }
|
| | |
|
| | | MapTransferUtility.Instance.Clear();
|
| | |
|
| | | // 是否是可以移动的状态
|
| | | _direction = CameraController.Instance.transform.TransformDirection(_direction);
|
| | | _direction.y = 0;
|
| | |
| | | {
|
| | | public static Vector3 MapOffset;
|
| | | public static bool s_MapSwitching = false;
|
| | | public static bool s_Flying = false;
|
| | | //public static bool s_MapSwitching
|
| | | //{
|
| | | // get
|
| | |
| | | Fight,
|
| | | }
|
| | | private E_MapTransferDoType m_MapTransferType;
|
| | | public E_MapTransferDoType MapTransferDoType {
|
| | | get {
|
| | | public E_MapTransferDoType MapTransferDoType
|
| | | {
|
| | | get
|
| | | {
|
| | | return m_MapTransferType;
|
| | | }
|
| | | set {
|
| | | set
|
| | | {
|
| | | m_MapTransferType = value;
|
| | | #if UNITY_EDITOR
|
| | | // Debug.LogFormat("设置方式: {0}", m_MapTransferType);
|
| | |
| | | #endregion
|
| | |
|
| | | #region npc
|
| | | public int NpcID {
|
| | | public int NpcID
|
| | | {
|
| | | get; set;
|
| | | }
|
| | | #endregion
|
| | |
| | |
|
| | | public bool forceMove = false;
|
| | |
|
| | | public void MoveToNPC(int npcID, int sid = 0)
|
| | | private struct MoveToData
|
| | | {
|
| | | public int npcID;
|
| | | public int sid;
|
| | | }
|
| | |
|
| | | public void MoveToNPC(int _npcID, int _sid = 0)
|
| | | {
|
| | | StopCoroutine("CoMoveToNPC");
|
| | | var _data = new MoveToData
|
| | | {
|
| | | npcID = _npcID,
|
| | | sid = _sid
|
| | | };
|
| | | StartCoroutine("CoMoveToNPC", _data);
|
| | | }
|
| | |
|
| | | private IEnumerator CoMoveToNPC(MoveToData data)
|
| | | {
|
| | | var _hero = PlayerDatas.Instance.hero;
|
| | | if (_hero == null)
|
| | | {
|
| | | yield break;
|
| | | }
|
| | |
|
| | | var npcID = data.npcID;
|
| | | var sid = data.sid;
|
| | |
|
| | | Vector3 _destPostion = Vector3.zero;
|
| | |
|
| | | // 判断是否能够得到到达指定点
|
| | | // 获取NPC位置数据
|
| | | GAStaticDefine.NPCLocation _npcLocation;
|
| | | var _findLocation = GAStaticDefine.TryGetMapNPCLocation(npcID, out _npcLocation);
|
| | | if (!_findLocation)
|
| | | {
|
| | | #if UNITY_EDITOR
|
| | | Debug.LogWarningFormat("需要传送至的npcid有错,无法在mapnpc表中查询到, id: {0}", npcID);
|
| | | #endif
|
| | | // 如果找不到配置, 可能为客户端战斗配置的刷怪逻辑
|
| | | // 由于可能有回包慢问题, 这里等待
|
| | | yield return WaitingForSecondConst.WaitMS200;
|
| | | GActor _npc = GAMgr.Instance.GetCloserNPC(_hero.Pos, npcID);
|
| | | if (_npc != null)
|
| | | {
|
| | | //Debug.LogFormat(" |-- 在视野内");
|
| | | _destPostion = _npc.Pos;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | _destPostion = new Vector3(_npcLocation.position.x, 0, _npcLocation.position.y);
|
| | | }
|
| | |
|
| | | if (_destPostion == Vector3.zero)
|
| | | {
|
| | | Debug.LogErrorFormat("移动至NPC: {0} 时找不到一个可以到达的点.", npcID);
|
| | | yield break;
|
| | | }
|
| | |
|
| | | if (PathFinder.WalkAble(_hero.Pos, _destPostion))
|
| | | {
|
| | | _MoveToNPC(npcID, sid);
|
| | | }
|
| | | else
|
| | | {
|
| | | // 不可达的情况, 这里寻找是否有可以跳跃的点
|
| | | Vector3 _jumpPos = ClientSceneManager.Instance.GetCloseTransPoint(_destPostion);
|
| | | if (_jumpPos == Vector3.zero)
|
| | | {
|
| | | Debug.LogErrorFormat("移动至NPC: {0} 时找不到任何跳跃点", npcID);
|
| | | yield break;
|
| | | }
|
| | | float _dis = MathUtility.DistanceSqrtXZ(_hero.Pos, _jumpPos);
|
| | | while (_dis > 0.01f)
|
| | | {
|
| | | _dis = MathUtility.DistanceSqrtXZ(_hero.Pos, _jumpPos);
|
| | | _hero.MoveToPosition(_jumpPos);
|
| | | yield return null;
|
| | | }
|
| | | while (!GA_Hero.s_Flying)
|
| | | {
|
| | | yield return null;
|
| | | }
|
| | | while (GA_Hero.s_Flying)
|
| | | {
|
| | | yield return null;
|
| | | }
|
| | | _MoveToNPC(npcID, sid);
|
| | | }
|
| | | }
|
| | |
|
| | | private void _MoveToNPC(int npcID, int sid = 0)
|
| | | {
|
| | | if (npcID != NpcID)
|
| | | {
|
| | |
| | |
|
| | | public void Clear()
|
| | | {
|
| | | StopCoroutine("CoMoveToNPC");
|
| | | if (m_SwitchMapFinished)
|
| | | {
|
| | | NpcID = 0;
|
| | |
| | | private Dictionary<int, TriggerHandler> m_TriggerHandlerDict = new Dictionary<int, TriggerHandler>(); |
| | | private List<int> m_ReadyRemoveTriggerList = new List<int>(); |
| | | private Dictionary<int, List<GActorNpcFight>> m_EventActorDict = new Dictionary<int, List<GActorNpcFight>>(); |
| | | public bool IsClientFightMode { get; private set; } |
| | | |
| | | private IEnumerator DelayUnTrigger(int id) |
| | | { |
| | |
| | | int _triggerID = (int)package.DictValue; |
| | | if (_triggerID == 0) |
| | | { |
| | | Debug.LogFormat("退出当前触发事件, 已触发数量: {0}", m_TriggerIDToMissionIDDict.Count); |
| | | foreach (var _removeTriggerID in m_TriggerIDToMissionIDDict.Keys) |
| | | { |
| | | SnxxzGame.Instance.StartCoroutine(DelayUnTrigger(_removeTriggerID)); |
| | |
| | | if (package.DictValue == 0) |
| | | { |
| | | Debug.LogFormat("= 退出了前端模式 ="); |
| | | IsClientFightMode = false; |
| | | } |
| | | else |
| | | { |
| | | Debug.LogFormat("= 进入了前端模式 ="); |
| | | IsClientFightMode = true; |
| | | } |
| | | } |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public Vector3 GetCloseTransPoint(Vector3 pos) |
| | | { |
| | | // 遍历找到离给定点最近并且可寻路至的传送点 P |
| | | // 找到 P点的 另一端 P1 |
| | | // 判断当前传入的点是否可以寻路至 P1 |
| | | // 不行的话重新寻找 可以的话返回 P1 的坐标 |
| | | float _compareDis; |
| | | float _dis; |
| | | Vector3 _targetPos = Vector3.zero; |
| | | |
| | | foreach (var _p in m_TransferGroupList) |
| | | foreach (var _t in m_MapData.transfers) |
| | | { |
| | | |
| | | for (int i = 0; i < _t.transferPoints.Length; ++i) |
| | | { |
| | | if (PathFinder.WalkAble(pos, _t.transferPoints[i].position)) |
| | | { |
| | | if (i == 0) |
| | | { |
| | | _targetPos = _t.transferPoints[_t.transferPoints.Length - 1].position; |
| | | } |
| | | else |
| | | { |
| | | _targetPos = _t.transferPoints[0].position; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | if (_targetPos != Vector3.zero) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return Vector3.zero; |
| | | if (_targetPos == Vector3.zero) |
| | | { |
| | | Debug.LogWarningFormat("寻找最近的寻路飞跃点, 没有找到任何结果..."); |
| | | } |
| | | |
| | | return _targetPos; |
| | | } |
| | | |
| | | private IEnumerator DelayTrigger(uint missionID, int triggerID) |
| | |
| | | { |
| | | var _data = m_Evt.monsters[m_RefreshCount]; |
| | | var _npc = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightNorm>(_data.npcID, E_ActorGroup.Enemy); |
| | | _npc.Pos = _data.position; |
| | | _npc.BornPos = _npc.Pos = _data.position; |
| | | _npc.belongEventID = m_Evt.id; |
| | | ClientSceneManager.Instance.NpcBorn(m_Evt.id, _npc); |
| | | } |
| | |
| | | foreach (var _data in m_Evt.monsters) |
| | | { |
| | | var _npc = GAMgr.Instance.ReqClntFightNpc<GA_NpcClientFightNorm>(_data.npcID, E_ActorGroup.Enemy); |
| | | _npc.Pos = _data.position; |
| | | _npc.BornPos = _npc.Pos = _data.position; |
| | | _npc.belongEventID = m_Evt.id; |
| | | ClientSceneManager.Instance.NpcBorn(m_Evt.id, _npc); |
| | | } |
| | |
| | | { |
| | | _hero.RunImmediate(); |
| | | } |
| | | GA_Hero.s_Flying = true; |
| | | break; |
| | | } |
| | | } |
| | |
| | | _hero.SwitchHeadNameBindNode(false); |
| | | _hero.StopPathFind(); |
| | | CameraController.Instance.LookAtTarget = _hero.Root; |
| | | GA_Hero.s_Flying = false; |
| | | } |
| | | } |
| | | break; |
| | |
| | | m_Step = 0; |
| | | m_InCreaseTime = 0; |
| | | targetPoint = -1; |
| | | _hero.StopPathFind(); |
| | | _hero.Behaviour.StopHandupAI(true); |
| | | } |
| | | break; |
| | | } |