addResourceByVolume() public method

Add a resource, by volume, setting/adjusting fill and max units by the volume specified
public addResourceByVolume ( String name, float cubicMetersTotalFilled ) : void
name String
cubicMetersTotalFilled float
return void
Example #1
0
        public void addResources(SSTUResourceList list, float cubicMeters)
        {
            float resourceVolumeRatio;
            float resourcePercent;
            float resourceVolume;
            int   len = resourceRatios.Length;
            ContainerResourceRatio ratio;

            for (int i = 0; i < len; i++)
            {
                ratio = resourceRatios[i];
                resourceVolumeRatio = ratio.resourceRatio * ratio.resourceVolume;
                resourcePercent     = resourceVolumeRatio / totalVolumeRatio;
                resourceVolume      = cubicMeters * resourcePercent;
                list.addResourceByVolume(ratio.resourceName, resourceVolume);
            }
        }