| | |
| | | }
|
| | | }
|
| | |
|
| | | public void MoveToLocalMapPosition(Vector2 _position)
|
| | | public void MoveToLocalMapPosition(Vector2 pos)
|
| | | {
|
| | | var hero = PlayerDatas.Instance.hero;
|
| | | if (GA_Hero.s_MapSwitching || hero == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | MapTransferDoType = E_MapTransferDoType.None;
|
| | | m_DelayMoveToPos = false;
|
| | | m_TempPos = hero.Pos;
|
| | |
|
| | | hero.Behaviour.StopHandupAI(true);
|
| | | hero.Behaviour.StopKillUntilDieAI();
|
| | |
|
| | | if ((hero.SkillMgr.CurCastSkill != null && !hero.SkillMgr.CurCastSkill.SkillCompelete)
|
| | | || hero.IsRushing)
|
| | | {
|
| | | m_TempPos = _position;
|
| | | m_DelayMoveToPos = true;
|
| | | return;
|
| | | }
|
| | |
|
| | | hero.MoveToPosition(new Vector3(_position.x * 0.5f, 0f, _position.y * 0.5f));
|
| | | DTC0428_tagPlayerRideHorse.Send_tagPlayerRideHorse(true);
|
| | | StartCoroutine("_MoveToLocalPos", pos);
|
| | | }
|
| | |
|
| | | private IEnumerator _MoveToLocalPos(Vector2 pos)
|
| | | {
|
| | | var _hero = PlayerDatas.Instance.hero;
|
| | | if (_hero == null || GA_Hero.s_MapSwitching)
|
| | | {
|
| | | yield break;
|
| | | }
|
| | |
|
| | | var _dest = new Vector3(pos.x, 0, pos.y);
|
| | |
|
| | | if (PathFinder.WalkAble(_hero.Pos, _dest))
|
| | | {
|
| | | while (true)
|
| | | {
|
| | | Vector3 _nextPos = ClientSceneManager.Instance.GetNext1(_hero.Pos, _dest);
|
| | | if (_nextPos == Vector3.zero)
|
| | | {
|
| | | break;
|
| | | }
|
| | | float _dis = MathUtility.DistanceSqrtXZ(_hero.Pos, _nextPos);
|
| | | while (_dis > 0.01f)
|
| | | {
|
| | | _dis = MathUtility.DistanceSqrtXZ(_hero.Pos, _nextPos);
|
| | | _hero.MoveToPosition(_nextPos);
|
| | | yield return null;
|
| | | }
|
| | | while (!GA_Hero.s_Flying)
|
| | | {
|
| | | yield return null;
|
| | | }
|
| | | while (GA_Hero.s_Flying)
|
| | | {
|
| | | yield return null;
|
| | | }
|
| | | }
|
| | |
|
| | | _hero.MoveToPosition(_dest);
|
| | | DTC0428_tagPlayerRideHorse.Send_tagPlayerRideHorse(true);
|
| | | }
|
| | | else
|
| | | {
|
| | | while (true)
|
| | | {
|
| | | if (PathFinder.WalkAble(_hero.Pos, _dest))
|
| | | {
|
| | | break;
|
| | | }
|
| | | var _nextPos = ClientSceneManager.Instance.GetTransPoint(_hero.Pos, _dest);
|
| | | // 如果找到的下一个点
|
| | | if (!PathFinder.WalkAble(_hero.Pos, _nextPos)
|
| | | || _nextPos == Vector3.zero)
|
| | | {
|
| | | Debug.LogErrorFormat("移动至NPC: {0} 时找不到任何跳跃点", NpcID);
|
| | | break;
|
| | | }
|
| | | float _dis = MathUtility.DistanceSqrtXZ(_hero.Pos, _nextPos);
|
| | | while (_dis > 0.01f)
|
| | | {
|
| | | _dis = MathUtility.DistanceSqrtXZ(_hero.Pos, _nextPos);
|
| | | _hero.MoveToPosition(_nextPos);
|
| | | yield return null;
|
| | | }
|
| | | while (!GA_Hero.s_Flying)
|
| | | {
|
| | | yield return null;
|
| | | }
|
| | | while (GA_Hero.s_Flying)
|
| | | {
|
| | | yield return null;
|
| | | }
|
| | | }
|
| | |
|
| | | _hero.MoveToPosition(_dest);
|
| | | DTC0428_tagPlayerRideHorse.Send_tagPlayerRideHorse(true);
|
| | | }
|
| | | }
|
| | |
|
| | | // public void MoveToLocalMapPosition(Vector2 _position)
|
| | | // {
|
| | | // var hero = PlayerDatas.Instance.hero;
|
| | | // if (GA_Hero.s_MapSwitching || hero == null)
|
| | | // {
|
| | | // return;
|
| | | // }
|
| | |
|
| | | // MapTransferDoType = E_MapTransferDoType.None;
|
| | | // m_DelayMoveToPos = false;
|
| | | // m_TempPos = hero.Pos;
|
| | |
|
| | | // hero.Behaviour.StopHandupAI(true);
|
| | | // hero.Behaviour.StopKillUntilDieAI();
|
| | |
|
| | | // if ((hero.SkillMgr.CurCastSkill != null && !hero.SkillMgr.CurCastSkill.SkillCompelete)
|
| | | // || hero.IsRushing)
|
| | | // {
|
| | | // m_TempPos = _position;
|
| | | // m_DelayMoveToPos = true;
|
| | | // return;
|
| | | // }
|
| | |
|
| | | // hero.MoveToPosition(new Vector3(_position.x * 0.5f, 0f, _position.y * 0.5f));
|
| | | // DTC0428_tagPlayerRideHorse.Send_tagPlayerRideHorse(true);
|
| | | // }
|
| | |
|
| | | public void MissionFlyTo(int mapId, int npcId, int extField = 0)
|
| | | {
|
| | |
| | | if (m_SwitchMapFinished)
|
| | | {
|
| | | StopCoroutine("CoMoveToNPC");
|
| | | StopCoroutine("_MoveToLocalPos");
|
| | | NpcID = 0;
|
| | | MapTransferDoType = E_MapTransferDoType.None;
|
| | | m_DelayMoveToNPC = false;
|