少年修仙传客户端代码仓库
client_Hale
2019-04-25 d2ff47a31afe4167a78eb76e44cabdb1025c16fc
Fight/ClientDropItemUtility.cs
@@ -14,6 +14,35 @@
    private List<DropItem> m_DropItemList = new List<DropItem>();
    public bool TryGetDropItem(out DropItem item)
    {
        var _hero = PlayerDatas.Instance.hero;
        if (_hero == null || m_DropItemList.Count == 0)
        {
            item = null;
            return false;
        }
        m_DropItemList.Sort((i1, i2) =>
        {
            var _d1 = MathUtility.DistanceSqrtXZ(_hero.Pos, i1.transform.position);
            var _d2 = MathUtility.DistanceSqrtXZ(_hero.Pos, i2.transform.position);
            if (_d2 > _d1)
            {
                return -1;
            }
            else if (_d2 < _d1)
            {
                return 1;
            }
            return 0;
        });
        item = m_DropItemList[0];
        return true;
    }
    public void Update()
    {
        var _hero = PlayerDatas.Instance.hero;