Пример #1
0
    /// <summary>
    /// 获取皮肤项
    /// </summary>
    /// <param name="target"></param>
    /// <returns></returns>
    public SkinManagerItem GetItem(Transform target)
    {
        if (null == m_dic)
        {
            m_dic = new Dictionary <Transform, SkinManagerItem>();
        }

        SkinManagerItem item;

        try
        {
            if (!m_dic.TryGetValue(target, out item))
            {
                item = new SkinManagerItem();

                item.owner = target;
                item.skin  = DisplayUtil.SearchHierarchyForBone(target.transform, SkinName_Skin);
                item.hair  = DisplayUtil.SearchHierarchyForBone(target.transform, SkinName_Hair);
                item.cloth = DisplayUtil.SearchHierarchyForBone(target.transform, SkinName_Cloth);

                m_dic[target] = item;
            }

            return(item);
        }
        catch
        {
            Debug.Log("is destory : " + target);
        }

        target = null;
        return(null);
    }