예제 #1
0
        private static void AddResource(int refBody, List <OceanicResource> bodyOceanicComposition, string outputResourceName, string inputResource1, string inputResource2, string inputResource3, string displayname)
        {
            var abundances = new[] { GetAbundance(inputResource1, refBody), GetAbundance(inputResource2, refBody), GetAbundance(inputResource2, refBody) };

            var oceanicResource = new OceanicResource(outputResourceName, abundances.Max(), displayname, new[] { inputResource1, inputResource2, inputResource3 });

            if (oceanicResource.ResourceAbundance > 0)
            {
                var existingResource = bodyOceanicComposition.FirstOrDefault(a => a.ResourceName == outputResourceName);
                if (existingResource != null)
                {
                    Debug.Log("[KSPI]: replaced resource " + outputResourceName + " with stock defined abundance " + oceanicResource.ResourceAbundance);
                    bodyOceanicComposition.Remove(existingResource);
                }
                bodyOceanicComposition.Add(oceanicResource);
            }
        }
예제 #2
0
        private static void AddResource(string outputResourceName, string displayName, int refBody, List <OceanicResource> bodyOceanicComposition, string[] variants)
        {
            var abundances = new[] { GetAbundance(outputResourceName, refBody) }.Concat(variants.Select(m => GetAbundance(m, refBody)));

            var oceanicResource = new OceanicResource(outputResourceName, abundances.Max(), displayName, variants);

            if (oceanicResource.ResourceAbundance > 0)
            {
                var existingResource = bodyOceanicComposition.FirstOrDefault(a => a.ResourceName == outputResourceName);
                if (existingResource != null)
                {
                    Debug.Log("[KSPI]: replaced resource " + outputResourceName + " with stock defined abundance " + oceanicResource.ResourceAbundance);
                    bodyOceanicComposition.Remove(existingResource);
                }
                bodyOceanicComposition.Add(oceanicResource);
            }
        }