Exemple #1
0
 public MeshConfig(ConfigNode node, Part part)
 {
     variantName = node.GetValue("variantName");
     if (variantName == null || variantName.Length == 0)
     {
         MonoBehaviour.print("ILLEGAL VARIANT NAME: " + variantName);
     }
     tankName = node.GetStringValue("tankName");
     variantMass = (float)node.GetDoubleValue("variantMass");
     variantCost = (float)node.GetDoubleValue("variantCost");
     tankOption = node.GetStringValue("tankOption");
     String meshNames = node.GetStringValue("meshNames");
     if (String.IsNullOrEmpty(meshNames))
     {
         meshData = new MeshData[0];
     }
     else
     {
         String[] splitNames = meshNames.Split(',');
         meshData = new MeshData[splitNames.Length];
         int len = splitNames.Length;
         for (int i = 0; i < len; i++)
         {
             meshData[i] = new MeshData(splitNames[i].Trim(), part);
         }
     }
     String configControlIDs = node.GetStringValue("controlIDs");
     if (String.IsNullOrEmpty(configControlIDs))
     {
         controlledModules = new int[0];
     }
     else
     {
         String[] splitIDs = configControlIDs.Split(',');
         controlledModules = new int[splitIDs.Length];
         for (int i = 0; i < splitIDs.Length; i++) { controlledModules[i] = SSTUUtils.safeParseInt(splitIDs[i].Trim()); }
     }
     ConfigNode[] nodeNodes = node.GetNodes("MESHNODE");
     if (nodeNodes != null && nodeNodes.Length > 0)
     {
         nodeData = new MeshNodeData[nodeNodes.Length];
         int len = nodeNodes.Length;
         for (int i = 0; i < len; i++)
         {
             nodeData[i] = new MeshNodeData(nodeNodes[i], part);
         }
     }
     else
     {
         nodeData = new MeshNodeData[0];
     }
 }