Exemple #1
0
    public MFABone(MFASkeletalModel model, GameObject obj, MFABone parent)
    {
        m_GameObj = obj;
        m_Parent  = parent;

        MeshRenderer cmMeshRenderer = m_GameObj.GetComponent <MeshRenderer>();

        if (cmMeshRenderer != null)
        {
            model.RegMesh(this);
        }

        SkinnedMeshRenderer cmSkinnedMeshRenderer = m_GameObj.GetComponent <SkinnedMeshRenderer>();

        if (cmSkinnedMeshRenderer != null)
        {
            model.RegSkeletal(this);
        }

        model.RegBone(this);

        //添加子骨骼
        int childCount = m_GameObj.transform.childCount;

        for (int i = 0; i < childCount; i++)
        {
            GameObject childObj = m_GameObj.transform.GetChild(i).gameObject;
            m_Child.Add(new MFABone(model, childObj, this));
        }
    }
Exemple #2
0
 /// <summary>
 /// 注册网格
 /// </summary>
 /// <param name="bone"></param>
 public void RegMesh(MFABone bone)
 {
     Meshs.Add(bone);
 }
Exemple #3
0
 public void RegBone(MFABone bone)
 {
     BonesIndexByGameobj.Add(bone.gameObject, bone);
 }
Exemple #4
0
 /// <summary>
 /// 注册蒙皮
 /// </summary>
 /// <param name="bone"></param>
 public void RegSkeletal(MFABone bone)
 {
     Skeletals.Add(bone);
 }