Пример #1
0
        public static MeshRendererData MeshRendererDataFromSource(MeshRenderer target)
        {
            MeshRendererData data = new MeshRendererData();

            data.n = "MeshRenderer";
            List <string> materialsList = new List <string>();

            for (int i = 0; i < target.sharedMaterials.Length; i++)
            {
                materialsList.Add(target.sharedMaterials[i].name);
            }
            data.materials = materialsList.ToArray();
            return(data);
        }
Пример #2
0
 public static ComponentData ComponentDataFromSource(Component target, Hammurabi serializer)
 {
     if (target is Transform)
     {
         return(TransformData.TransformDataFromSource(target as Transform));
     }
     if (target is Camera)
     {
         return(CameraData.CameraDataFromSource(target as Camera));
     }
     if (target is Light)
     {
         return(LightData.LightDataFromSource(target as Light));
     }
     if (target is MeshFilter)
     {
         return(MeshFilterData.MeshFilterDataFromSource(target as MeshFilter));
     }
     if (target is MeshRenderer)
     {
         return(MeshRendererData.MeshRendererDataFromSource(target as MeshRenderer));
     }
     if (target is Rigidbody)
     {
         return(RigidbodyData.RigidbodyDataFromSource(target as Rigidbody));
     }
     if (target is BoxCollider)
     {
         return(BoxColliderData.BoxColliderDataFromSource(target as BoxCollider));
     }
     if (target is MonoBehaviour)
     {
         return(MonoBehaviourData.MonoBehaviourDataFromSource(target as MonoBehaviour, serializer));
     }
     return(new ComponentData());
 }