4 static const int DECIMALS_SUPPLIES = 1;
15 return baseGameMode.IsResourceTypeEnabled(resourceType);
26 static bool GetStoredResources(notnull SCR_ResourceComponent resourceComponent, out
float storedRescources,
EResourceType resourceType =
EResourceType.SUPPLIES)
28 SCR_ResourceConsumer consumer;
33 storedRescources = consumer.GetAggregatedResourceValue();
40 storedRescources = consumer.GetAggregatedResourceValue();
47 storedRescources = generator.GetAggregatedResourceValue();
60 static string SuppliesToString(
float supplies)
62 return SCR_FormatHelper.FloatToStringNoZeroDecimalEndings(supplies, DECIMALS_SUPPLIES);
74 static bool GetStoredAndMaxResources(notnull SCR_ResourceComponent resourceComponent, out
float totalResources, out
float maxResources,
EResourceType resourceType =
EResourceType.SUPPLIES)
76 SCR_ResourceConsumer consumer;
83 maxResources = consumer.GetAggregatedMaxResourceValue();
84 totalResources = consumer.GetAggregatedResourceValue();
92 maxResources = consumer.GetAggregatedMaxResourceValue();
93 totalResources = consumer.GetAggregatedResourceValue();
102 maxResources = generator.GetAggregatedMaxResourceValue();
103 totalResources = generator.GetAggregatedResourceValue();
105 if (maxResources > 0)
127 SCR_ResourceConsumer consumer;
128 availableResources = 0;
130 if (resourceComponent.GetConsumer(resourceID, resourceType, consumer))
132 availableResources = consumer.GetAggregatedResourceValue();
147 static SCR_ResourceConsumer GetStorageConsumer(notnull SCR_ResourceComponent resourceComponent,
EResourceType resourceType =
EResourceType.SUPPLIES)
149 SCR_ResourceConsumer consumer = resourceComponent.GetConsumer(
EResourceGeneratorID.DEFAULT_STORAGE, resourceType);
167 static SCR_ResourceConsumer GetAvailableResourceConsumer(notnull SCR_ResourceComponent resourceComponent,
EResourceType resourceType =
EResourceType.SUPPLIES)
179 static SCR_ResourceConsumer GetFirstValidConsumer(notnull SCR_ResourceComponent resourceComponent,
EResourceType resourceType =
EResourceType.SUPPLIES)
181 SCR_ResourceConsumer consumer = resourceComponent.GetConsumer(
EResourceGeneratorID.DEFAULT_STORAGE, resourceType);
223 static float RoundRefundSupplyAmount(
float refundCost)
225 return Math.Ceil(refundCost);