Пример #1
0
            /// <summary>
            /// Creates a new Properties Loader from the Injector context.
            /// </summary>
            public PropertiesLoader()
            {
                // Is this the parser context?
                if (!Injector.IsInPrefab)
                {
                    throw new InvalidOperationException("Must be executed in Injector context.");
                }

                // Store values
                Value = generatedBody.celestialBody;

                // We require a science values object
                if (Value.scienceValues == null)
                {
                    Value.scienceValues = new CelestialBodyScienceParams();
                }
                scienceValues = new ScienceValuesLoader(Value.scienceValues);

                // isHomeWorld Check
                Value.isHomeWorld = Value.transform.name == "Kerbin";

                // Biomes
                biomes = new CallbackList <BiomeLoader>(e =>
                {
                    // Check biome map
                    if (Value.BiomeMap == null)
                    {
                        throw new InvalidOperationException("The Biome Map cannot be null if you want to add biomes.");
                    }

                    // Replace the old biomes list with the new one
                    Value.BiomeMap.Attributes = biomes.Select(b => b.Value).ToArray();
                });
            }