Esempio n. 1
0
 public SerializableColor(SerializableColor c)
 {
     if (c == null)
     {
         this.r = 1f;
         this.g = 1f;
         this.b = 1f;
         this.a = 1f;
     }
     else
     {
         this.r = c.r;
         this.g = c.g;
         this.b = c.b;
         this.a = c.a;
     }
 }
Esempio n. 2
0
 public static bool Different(SerializableColor A, SerializableColor B)
 {
     return(A.a != B.a || A.r != B.r || A.g != B.g || A.b != B.b);
 }
Esempio n. 3
0
 public ProceduralObjectContainer(ProceduralObject baseObject)
 {
     id               = baseObject.id;
     basePrefabName   = baseObject.basePrefabName;
     objectType       = baseObject.baseInfoType;
     renderDistance   = baseObject.renderDistance;
     renderDistLocked = baseObject.renderDistLocked;
     position         = new SerializableVector3(baseObject.m_position);
     rotation         = new SerializableQuaternion(baseObject.m_rotation);
     scale            = 1f;
     if (baseObject.group != null)
     {
         belongsToGroup = true;
         if (baseObject.isRootOfGroup)
         {
             groupRootId = -1; // = we are a group root
         }
         else
         {
             groupRootId = baseObject.group.root.id;
         }
     }
     else
     {
         belongsToGroup = false; // we don't have a group
     }
     color = baseObject.m_color;
     // if (meshStatus > 0)
     meshStatus = baseObject.meshStatus;
     if (meshStatus != 1)
     {
         /*
          * try
          * {
          *  serializedMeshData = new POSerializableMeshData(baseObject);
          *  vertices = null;
          * }
          * catch (Exception e)
          * {
          *  Debug.LogWarning("[ProceduralObjects] Warning : error while compressing Mesh data for object #" + baseObject.id + " (" + baseObject.baseInfoType + ", " + baseObject.basePrefabName + "). Saving uncompressed raw data instead\n" + e);
          *
          *
          * */
         vertices           = SerializableVector3.ToSerializableArray(baseObject.m_mesh.vertices);
         serializedMeshData = null;
         //   }
     }
     else
     {
         serializedMeshData = null;
         vertices           = null;
     }
     hasCustomTexture     = baseObject.customTexture != null;
     visibility           = baseObject.m_visibility;
     disableRecalculation = baseObject.disableRecalculation;
     normalsRecalculation = baseObject.normalsRecalcMode;
     layerId            = (baseObject.layer == null) ? 0 : baseObject.layer.m_id;
     flipFaces          = baseObject.flipFaces;
     disableCastShadows = baseObject.disableCastShadows;
     // recalculateNormals = baseObject.recalculateNormals;
     tilingFactor = baseObject.tilingFactor;
     if (baseObject.m_textParameters != null)
     {
         textParam = TextParameters.Clone(baseObject.m_textParameters, false);
         for (int i = 0; i < textParam.Count(); i++)
         {
             textParam[i].serializableColor = null;
         }
     }
     if (hasCustomTexture == true)
     {
         customTextureName = baseObject.customTexture.name;
     }
     else
     {
         customTextureName = string.Empty;
     }
     modulesData = new List <Dictionary <string, string> >();
     if (baseObject.m_modules != null)
     {
         foreach (POModule m in baseObject.m_modules)
         {
             modulesData.Add(m._get_data(true));
         }
     }
 }