少年修仙传客户端代码仓库
client_Hale
2019-07-06 0071cd1dd8c1b71183527ca35aa98c75222dd9cb
382 修复寻路卡住问题
7个文件已修改
193 ■■■■■ 已修改文件
Fight/GameActor/GA_Guard.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/GameActor/GA_NpcClientFunc.cs 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/GameActor/GA_NpcFunc.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/GameActor/GActor.cs 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/GameActor/GActorNpcFight.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/GameActor/GActorNpcNoFight.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/GameActor/HeroRoundGird.cs 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Fight/GameActor/GA_Guard.cs
@@ -25,8 +25,6 @@
    public bool IsStateActive { get; set; }//是否状态机开启
    public bool guardPick { get; private set; }
    public float animatorSpeed { get; private set; }
Fight/GameActor/GA_NpcClientFunc.cs
@@ -10,6 +10,7 @@
    protected override void OnInit(GameNetPackBasic package)
    {
        IsUnInit = false;
        ActorInfo.PlayerName = NpcConfig.charName;
        // 功能NPC需要读取配置朝向
        GAStaticDefine.NPCLocation _npcLocation;
Fight/GameActor/GA_NpcFunc.cs
@@ -204,6 +204,10 @@
    private void OnHorseLoaded(bool result, UnityEngine.Object prefab)
    {
        if (IsUnInit)
        {
            return;
        }
        if (!result || !prefab)
        {
            return;
@@ -268,6 +272,10 @@
    private void OnWingLoaded(bool result, UnityEngine.Object prefab)
    {
        if (IsUnInit)
        {
            return;
        }
        if (!result || !prefab)
        {
            return;
@@ -297,6 +305,10 @@
    private void OnSecondaryLoaded(bool result, UnityEngine.Object prefab)
    {
        if (IsUnInit)
        {
            return;
        }
        if (!result || !prefab)
        {
            return;
@@ -324,6 +336,10 @@
    private void OnWeaponLoaded(bool result, UnityEngine.Object prefab)
    {
        if (IsUnInit)
        {
            return;
        }
        if (!result || !prefab)
        {
            return;
@@ -423,6 +439,8 @@
        ReleaseMissionSign();
        base.OnUnit();
        IsUnInit = true;
    }
    protected virtual void OnTaskRefresh(int _nowNPCid, int _nPCLamp, Dictionary<int, int> _dic)
Fight/GameActor/GActor.cs
@@ -559,30 +559,34 @@
            _curPos.y = 0;
            _curCorner.y = 0;
            float _chkDistSqrt = MathUtility.DistanceSqrtXZ(_curPos, _curCorner);
            float _compareDist = ActorInfo.moveSpeed * Time.deltaTime;
            if (_chkDistSqrt <= _compareDist * _compareDist)
            _curCorner.y = Pos.y;
            Vector3 _dir = MathUtility.ForwardXZ(_curCorner, Pos);
            if (_dir != Vector3.zero)
            {
                Quaternion _quaternion = Quaternion.LookRotation(_dir, Vector3.up);
                Rotation = Quaternion.RotateTowards(Rotation, _quaternion, GeneralDefine.RotateSpeed);
                destForward = _dir;
            }
            float _deltaDis = ActorInfo.moveSpeed * Time.deltaTime;
            if (_deltaDis > .5f)
            {
                _deltaDis = .5f;
            }
            Vector3 _detalMove = _deltaDis * _dir;
            var _next = _curPos + _detalMove;
            var _vec1 = _curCorner - _curPos;
            var _vec3 = _curCorner - _next;
            if (!MathUtility.IsSameDir(_vec1, _vec3))
            {
                Pos = new Vector3(_curCorner.x, Pos.y, _curCorner.z);
                m_CornerIndex += 1;
            }
            else
            {
                _curCorner.y = Pos.y;
                Vector3 _dir = MathUtility.ForwardXZ(_curCorner, Pos);
                if (_dir != Vector3.zero)
                {
                    Quaternion _quaternion = Quaternion.LookRotation(_dir, Vector3.up);
                    Rotation = Quaternion.RotateTowards(Rotation, _quaternion, GeneralDefine.RotateSpeed);
                    destForward = _dir;
                }
                float _deltaDis = ActorInfo.moveSpeed * Time.deltaTime;
                if (_deltaDis > .5f)
                {
                    _deltaDis = .5f;
                }
                Vector3 _detalMove = _deltaDis * _dir;
                Pos += _detalMove;
                Pos = new Vector3(_next.x, Pos.y, _next.z);
            }
            if (OnPathFinding != null)
@@ -590,6 +594,8 @@
                OnPathFinding();
            }
            float _chkDistSqrt = 0;
            // 寻找动态目标的时候
            // 判断目标是否坐标发生了需要重新寻路的变化
            if (m_SearchType == E_SearchType.Dynamic)
Fight/GameActor/GActorNpcFight.cs
@@ -14,7 +14,7 @@
    private SFXController m_AppearEffect;
    private bool m_LoadDefaultRes = false;
    protected bool IsUnInit = false;
    /// <summary>
    /// 上一次记录不能被攻击旋转的时间
    /// </summary>
@@ -59,6 +59,7 @@
    protected override void OnInit(GameNetPackBasic package)
    {
        base.OnInit(package);
        IsUnInit = false;
        m_LoadDefaultRes = false;
        int _npcID = 0;
@@ -107,6 +108,10 @@
    private void OnPrefabLoadFinished(bool result, UnityEngine.Object prefab)
    {
        if (IsUnInit)
        {
            return;
        }
        if (!result || prefab == null)
        {
            if (!m_LoadDefaultRes)
@@ -244,7 +249,7 @@
            SFXPlayUtility.Instance.Release(m_AppearEffect);
            m_AppearEffect = null;
        }
        IsUnInit = true;
        base.OnUnit();
    }
Fight/GameActor/GActorNpcNoFight.cs
@@ -11,7 +11,7 @@
    public NPCConfig NpcConfig { get; protected set; }
    public SFXController m_AppearEffect;
    protected bool m_LoadDefaultRes = false;
    protected bool IsUnInit = false;
    public override int NextAction
    {
        get
@@ -42,7 +42,7 @@
    protected override void OnInit(GameNetPackBasic package)
    {
        m_LoadDefaultRes = false;
        IsUnInit = false;
        int _npcID = 0;
        if (this is GA_NpcSummonFunc)
        {
@@ -159,6 +159,7 @@
        {
            Root.localScale = Vector3.one;
        }
        IsUnInit = true;
    }
    public override void Destroy()
@@ -167,12 +168,17 @@
    protected virtual void OnPrefabLoadFinished(bool result, UnityEngine.Object prefab)
    {
        if (IsUnInit)
        {
            return;
        }
        if (!result || prefab == null)
        {
            if (!m_LoadDefaultRes)
            {
                InstanceResourcesLoader.AsyncLoadDefaultFuncNpc(OnPrefabLoadFinished);
                m_LoadDefaultRes = true;
                InstanceResourcesLoader.AsyncLoadDefaultFuncNpc(OnPrefabLoadFinished);
            }
            else
            {
Fight/GameActor/HeroRoundGird.cs
@@ -1,8 +1,11 @@
using UnityEngine;
using System.Collections.Generic;
using UnityEngine.AI;
[XLua.LuaCallCSharp]
public class HeroRoundGird : Singleton<HeroRoundGird>
{
    [XLua.LuaCallCSharp]
    public class GirdNode
    {
        public int index;
@@ -33,8 +36,8 @@
        if (_hero != null)
        {
            return new Vector3(node.column * m_Width, 0, node.row * m_Height)
                   + _hero.Pos
                   - new Vector3(m_Half * m_Width, 0, m_Half * m_Height);
                    + _hero.Pos
                    - new Vector3(m_Half * m_Width, 0, m_Half * m_Height);
        }
        return Vector3.zero;
    }
@@ -262,12 +265,33 @@
                    }
                    if (m_NodeEmpty[_node.index])
                    {
                        _node.ownerSID = sid;
                        m_NodeEmpty[_node.index] = false;
                        return _node;
                        var _real = GetRealPos(_node);
                        _real.y = 0;
                        NavMeshHit _hit;
                        if (NavMesh.SamplePosition(_real, out _hit, 0.02f, NavMesh.AllAreas))
                        {
                            _node.ownerSID = sid;
                            return _node;
                        }
                    }
                    else
                    {
                        if (!m_NodeEmpty[_node.index])
                        {
                            if (_node.ownerSID == 0)
                            {
                                var _real = GetRealPos(_node);
                                _real.y = 0;
                                NavMeshHit _hit;
                                if (NavMesh.SamplePosition(_real, out _hit, 0.02f, NavMesh.AllAreas))
                                {
                                    m_NodeEmpty[_node.index] = true;
                                }
                            }
                        }
                        if (m_NodeDict[_node.index].ownerSID == sid)
                        {
                            return m_NodeDict[_node.index];
@@ -289,12 +313,33 @@
                    }
                    if (m_NodeEmpty[_node.index])
                    {
                        _node.ownerSID = sid;
                        m_NodeEmpty[_node.index] = false;
                        return _node;
                        var _real = GetRealPos(_node);
                        _real.y = 0;
                        NavMeshHit _hit;
                        if (NavMesh.SamplePosition(_real, out _hit, 0.02f, NavMesh.AllAreas))
                        {
                            _node.ownerSID = sid;
                            return _node;
                        }
                    }
                    else
                    {
                        if (!m_NodeEmpty[_node.index])
                        {
                            if (_node.ownerSID == 0)
                            {
                                var _real = GetRealPos(_node);
                                _real.y = 0;
                                NavMeshHit _hit;
                                if (NavMesh.SamplePosition(_real, out _hit, 0.02f, NavMesh.AllAreas))
                                {
                                    m_NodeEmpty[_node.index] = true;
                                }
                            }
                        }
                        if (m_NodeDict[_node.index].ownerSID == sid)
                        {
                            return m_NodeDict[_node.index];
@@ -316,12 +361,33 @@
                    }
                    if (m_NodeEmpty[_node.index])
                    {
                        _node.ownerSID = sid;
                        m_NodeEmpty[_node.index] = false;
                        return _node;
                        var _real = GetRealPos(_node);
                        _real.y = 0;
                        NavMeshHit _hit;
                        if (NavMesh.SamplePosition(_real, out _hit, 0.02f, NavMesh.AllAreas))
                        {
                            _node.ownerSID = sid;
                            return _node;
                        }
                    }
                    else
                    {
                        if (!m_NodeEmpty[_node.index])
                        {
                            if (_node.ownerSID == 0)
                            {
                                var _real = GetRealPos(_node);
                                _real.y = 0;
                                NavMeshHit _hit;
                                if (NavMesh.SamplePosition(_real, out _hit, 0.02f, NavMesh.AllAreas))
                                {
                                    m_NodeEmpty[_node.index] = true;
                                }
                            }
                        }
                        if (m_NodeDict[_node.index].ownerSID == sid)
                        {
                            return m_NodeDict[_node.index];
@@ -342,12 +408,33 @@
                    }
                    if (m_NodeEmpty[_node.index])
                    {
                        _node.ownerSID = sid;
                        m_NodeEmpty[_node.index] = false;
                        return _node;
                        var _real = GetRealPos(_node);
                        _real.y = 0;
                        NavMeshHit _hit;
                        if (NavMesh.SamplePosition(_real, out _hit, 0.02f, NavMesh.AllAreas))
                        {
                            _node.ownerSID = sid;
                            return _node;
                        }
                    }
                    else
                    {
                        if (!m_NodeEmpty[_node.index])
                        {
                            if (_node.ownerSID == 0)
                            {
                                var _real = GetRealPos(_node);
                                _real.y = 0;
                                NavMeshHit _hit;
                                if (NavMesh.SamplePosition(_real, out _hit, 0.02f, NavMesh.AllAreas))
                                {
                                    m_NodeEmpty[_node.index] = true;
                                }
                            }
                        }
                        if (m_NodeDict[_node.index].ownerSID == sid)
                        {
                            return m_NodeDict[_node.index];