RealFuels.Tanks.ModuleFuelTanks.GetModuleCost C# (CSharp) Method

GetModuleCost() public method

public GetModuleCost ( float defaultCost, ModifierStagingSituation sit ) : float
defaultCost float
sit ModifierStagingSituation
return float
        public float GetModuleCost(float defaultCost, ModifierStagingSituation sit)
        {
            double cst = 0;
            if (baseCostPV >= 0) {
                cst = volume * baseCostPV;
                if (PartResourceLibrary.Instance != null && tankList != null) {
                    for (int i = 0; i < tankList.Count; i++) {
                        FuelTank t = tankList[i];
                        if (t.resource != null) {
                            PartResourceDefinition d = PartResourceLibrary.Instance.GetDefinition (t.resource.resourceName);
                            if (d != null) {
                                cst += t.maxAmount * (d.unitCost + t.cost / t.utilization);
                            }
                        }
                    }
                }
            }
            return (float)cst;
        }

Usage Example

Esempio n. 1
0
 void DisplayMass()
 {
     GUILayout.BeginHorizontal();
     GUILayout.Label("Mass: " + tank_module.massDisplay + ", Cst " + tank_module.GetModuleCost(0).ToString("N1"));
     GUILayout.EndHorizontal();
 }
All Usage Examples Of RealFuels.Tanks.ModuleFuelTanks::GetModuleCost