本文整理汇总了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);
}
示例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;
}
示例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;
}
}
示例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();
}