Exemplo n.º 1
0
        private static void AddResource(int refBody, List <OceanicResource> bodyOceanicComposition, string outputResourname, string inputResource1, string inputResource2, string inputResource3, string displayname)
        {
            var abundances = new[] { GetAbundance(inputResource1, refBody), GetAbundance(inputResource2, refBody), GetAbundance(inputResource2, refBody) };

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

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

            var OceanicResource = new OceanicResource(outputResourname, abundances.Max(), displayname, variants);

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