Beispiel #1
0
        /// <summary>
        /// 换装(删除之前所有增加的)
        /// </summary>
        /// <param name="entity">要换装的实体</param>
        /// <param name="assetName">要换装的资源名称</param>
        public void ChangeSkinnedMesh(Entity entity, string assetName)
        {
            AvtarInfo avtarInfo = null;

            if (m_AvtarInfos.TryGetValue(entity, out avtarInfo))
            {
                avtarInfo.Clear();
            }
            else
            {
                avtarInfo = new AvtarInfo(entity, this);
                m_AvtarInfos.Add(entity, avtarInfo);
            }

            AssetObject assetObject = m_AssetPool.Spawn(assetName);

            if (assetObject == null)
            {
                GameEntry.Resource.LoadAsset(assetName, typeof(UnityEngine.Object), Constant.AssetPriority.TextureAsset, m_LoadAssetCallbacks, new LoadAvtarInfo(avtarInfo));
            }
            else
            {
                InternalAddSkinnedMesh(avtarInfo, assetObject);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 移除所有蒙皮信息
        /// </summary>
        /// <param name="entity">要换装的实体</param>
        public void RemoveAllSkinnedMesh(Entity entity)
        {
            AvtarInfo avtarInfo = null;

            if (m_AvtarInfos.TryGetValue(entity, out avtarInfo))
            {
                avtarInfo.Clear();
            }
        }