当前位置: 首页>>代码示例>>C#>>正文


C# Part.GetModuleCosts方法代码示例

本文整理汇总了C#中Part.GetModuleCosts方法的典型用法代码示例。如果您正苦于以下问题:C# Part.GetModuleCosts方法的具体用法?C# Part.GetModuleCosts怎么用?C# Part.GetModuleCosts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Part的用法示例。


在下文中一共展示了Part.GetModuleCosts方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemovePartFromInventory

 public static int RemovePartFromInventory(Part part, Dictionary<String, int> inventory)
 {
     string name = part.partInfo.name;
     int amt = 1;
     if (KCT_Utilities.PartIsProcedural(part))
     {
         float cost = part.partInfo.cost + part.GetModuleCosts(0);
         foreach (PartResource resource in part.Resources.list)
         {
             cost -= (float)(PartResourceLibrary.Instance.GetDefinition(resource.resourceName).unitCost * resource.maxAmount);
         }
         amt = (int)(cost * 1000);
     }
     else
         name += GetTweakScaleSize(part.protoPartSnapshot);
     /*string tweakscale = GetTweakScaleSize(part.protoPartSnapshot); //partName,tweakscale
     string nameToStore = part.partInfo.name + tweakscale;*/
     return RemovePartFromInventory(name, inventory, amt);
 }
开发者ID:Kerbas-ad-astra,项目名称:KCT,代码行数:19,代码来源:KCT_Utilities.cs

示例2: GetPartCosts

 public static double GetPartCosts(Part part, bool includeFuel = true)
 {
     double cost = 0;
     cost = part.partInfo.cost + part.GetModuleCosts(part.partInfo.cost);
     foreach (PartResource rsc in part.Resources)
     {
         PartResourceDefinition def = PartResourceLibrary.Instance.GetDefinition(rsc.resourceName);
         if (!includeFuel)
         {
             cost -= rsc.maxAmount * def.unitCost;
         }
         else //accounts for if you remove some fuel from a tank
         {
             cost -= (rsc.maxAmount - rsc.amount) * def.unitCost;
         }
     }
     return cost;
 }
开发者ID:Kerbas-ad-astra,项目名称:KCT,代码行数:18,代码来源:KCT_Utilities.cs

示例3: AddPartToInventory

        public static void AddPartToInventory(Part part)
        {
            string name = part.partInfo.name;
            int amt = 1;
            if (KCT_Utilities.PartIsProcedural(part))
            {
                float cost = part.partInfo.cost + part.GetModuleCosts(0);
                KCTDebug.Log("PP cost: " + cost);
                foreach (PartResource resource in part.Resources.list)
                {
                    cost -= (float)(PartResourceLibrary.Instance.GetDefinition(resource.resourceName).unitCost * resource.amount);
                }
                KCTDebug.Log("After fuel costs: " + cost);
                amt = (int)(cost * 1000);

                AddPartToInventory(name, amt);
                return;
            }
            else
            {
                string tweakscale = GetTweakScaleSize(part.protoPartSnapshot); //partName,tweakscale
                string nameToStore = part.partInfo.name + tweakscale;
                AddPartToInventory(nameToStore, amt);
                return;
            }
        }
开发者ID:Kerbas-ad-astra,项目名称:KCT,代码行数:26,代码来源:KCT_Utilities.cs

示例4: getPartRawPrice

 public float getPartRawPrice(Part P)
 {
     if (P.protoPartSnapshot != null)
         return getPartRawPrice(P.protoPartSnapshot);
     float price = P.partInfo.cost;
     foreach (PartResource resource in P.Resources.list)
     {
         float cost = getResourcePrice(resource.resourceName);
         price -= (float)(cost * resource.maxAmount);
     }
     return price + P.GetModuleCosts();
 }
开发者ID:magico13,项目名称:TheScrapyard,代码行数:12,代码来源:Scrapyard.cs


注:本文中的Part.GetModuleCosts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。