Beispiel #1
0
        private static IGameObject CreateProceduralStellarBody(
            App game,
            CombatConfig.DataContext context,
            XmlElement node)
        {
            float   singleOrDefault1 = node["Radius"].ExtractSingleOrDefault(5000f);
            int     integerOrDefault = node["RandomSeed"].ExtractIntegerOrDefault(0);
            string  stringOrDefault1 = node["PlanetType"].ExtractStringOrDefault("normal");
            float   singleOrDefault2 = node["HazardRating"].ExtractSingleOrDefault(0.0f);
            string  stringOrDefault2 = node["Faction"].ExtractStringOrDefault("human");
            float   singleOrDefault3 = node["Biosphere"].ExtractSingleOrDefault(0.0f);
            double  doubleOrDefault  = node["Population"].ExtractDoubleOrDefault(0.0);
            Vector3 vector3OrDefault = node["Position"].ExtractVector3OrDefault(Vector3.Zero);

            context.TransformPosition(ref vector3OrDefault);
            int?typeVariant = new int?();

            if (node["Variant"] != null)
            {
                typeVariant = new int?(node["Variant"].ExtractIntegerOrDefault(0));
            }
            StellarBody.Params stellarBodyParams = game.AssetDatabase.PlanetGenerationRules.GetStellarBodyParams("sysmap_planet", vector3OrDefault, singleOrDefault1, integerOrDefault, 0, stringOrDefault1, singleOrDefault2, 750f, stringOrDefault2, singleOrDefault3, doubleOrDefault, typeVariant, ColonyStage.Open, SystemColonyType.Normal);
            stellarBodyParams.Civilians          = new StellarBody.PlanetCivilianData[0];
            stellarBodyParams.ImperialPopulation = 0.0;
            stellarBodyParams.Suitability        = 0.0f;
            stellarBodyParams.Infrastructure     = 0.0f;
            return((IGameObject)StellarBody.Create(game, stellarBodyParams));
        }
Beispiel #2
0
 private static IGameObject CreateLegacyStellarBody(
     App game,
     CombatConfig.DataContext context,
     XmlElement node)
 {
     StellarBody.Params p = StellarBody.Params.Default;
     p.SurfaceMaterial = node["Asset"].ExtractStringOrDefault(string.Empty);
     p.Position        = node["Position"].ExtractVector3OrDefault(Vector3.Zero);
     context.TransformPosition(ref p.Position);
     p.Radius                 = node["Scale"].ExtractSingleOrDefault(0.0f);
     p.AtmoThickness          = node["AtmosphereThickness"].ExtractSingleOrDefault(0.0f);
     p.AtmoScatterWaveLengths = node["AtmosphereScatteringWavelengths"].ExtractVector3OrDefault(Vector3.Zero);
     p.AtmoKm                 = node["AtmosphereMieConstant"].ExtractSingleOrDefault(0.0f);
     p.AtmoKr                 = node["AtmosphereRayleighConstant"].ExtractSingleOrDefault(0.0f);
     p.AtmoScaleDepth         = node["AtmosphereScaleDepth"].ExtractSingleOrDefault(0.0f);
     p.Civilians              = new StellarBody.PlanetCivilianData[0];
     p.ImperialPopulation     = 0.0;
     p.Suitability            = 0.0f;
     p.Infrastructure         = 0.0f;
     return((IGameObject)StellarBody.Create(game, p));
 }