コード例 #1
0
 public SSTUFuelType(ConfigNode node)
 {
     name = node.GetStringValue("name");
     tankageVolumeLoss = node.GetFloatValue("tankageVolumeLoss");
     tankageMassFactor = node.GetFloatValue("tankageMassFactor", 1);
     costPerDryTon = node.GetFloatValue("costPerDryTon");
     ConfigNode[] fuelConfigs = node.GetNodes("RESOURCE");
     SSTUFuelEntry e = null;
     foreach(ConfigNode n in fuelConfigs)
     {
         e = new SSTUFuelEntry(n);
         fuelEntries.Add(e);
         litersPerUnit += SSTUFuelTypes.INSTANCE.getResourceVolume(e.resourceName) * e.ratio;
         costPerUnit += PartResourceLibrary.Instance.GetDefinition(e.resourceName).unitCost * e.ratio;
     }
     unitsPerCubicMeter = 1000f / litersPerUnit;
     MonoBehaviour.print("Loaded SSTU_FUEL TYPE: "+name+"  units/m3: "+unitsPerCubicMeter+"  costPerUnit: "+costPerUnit +"  costPerM3: "+(unitsPerCubicMeter*costPerUnit));
 }
コード例 #2
0
ファイル: FuelType.cs プロジェクト: Joshg213/SSTULabs
 public FuelType(ConfigNode node)
 {
     name = node.GetStringValue("name");
     tankageVolumeLoss = node.GetFloatValue("tankageVolumeLoss", 0.15f);
     tankageMassFactor = node.GetFloatValue("tankageMassFactor", 0.15f);
     costPerDryTon = node.GetFloatValue("costPerDryTon");
     ConfigNode[] fuelConfigs = node.GetNodes("RESOURCE");
     SSTUFuelEntry e = null;
     PartResourceDefinition def;
     float massPerUnit = 0;
     foreach (ConfigNode n in fuelConfigs)
     {
         e = new SSTUFuelEntry(n);
         fuelEntries.Add(e);
         litersPerUnit += FuelTypes.INSTANCE.getResourceVolume(e.resourceName) * e.ratio;
         def = PartResourceLibrary.Instance.GetDefinition(e.resourceName);
         costPerUnit += def.unitCost * e.ratio;
         massPerUnit += def.density * e.ratio;
     }
     unitsPerCubicMeter = 1000f / litersPerUnit;
     tonsPerCubicMeter = massPerUnit * unitsPerCubicMeter;
 }