Esempio n. 1
0
 private void Regenerate()
 {
     if (this._planet != null)
     {
         this.App.ReleaseObject((IGameObject)this._planet);
     }
     this._planetReady = false;
     this._planet      = StellarBody.Create(this.App, this.App.AssetDatabase.PlanetGenerationRules.GetStellarBodyParams(string.Empty, Vector3.Zero, 5000f, this._seed, 0, this._type, (float)this._hazard, 750f, this._faction, this._biosphere, this._population, new int?(this._typeVariant), ColonyStage.Open, SystemColonyType.Normal));
     this._planet.PostSetProp("Rotation", MathHelper.DegreesToRadians((float)this._rotation));
 }
Esempio n. 2
0
 protected override void OnExit(GameState prev, ExitReason reason)
 {
     if (this._crits != null)
     {
         this._crits.Dispose();
     }
     if (this._planet != null)
     {
         this.App.ReleaseObject((IGameObject)this._planet);
     }
     this._planet = (StellarBody)null;
 }
Esempio n. 3
0
 private void CachePlanet(PlanetInfo planetInfo)
 {
     if (planetInfo == null)
     {
         return;
     }
     if (this._cachedPlanet != null)
     {
         this.App.ReleaseObject((IGameObject)this._cachedPlanet);
         this._cachedPlanet = (StellarBody)null;
     }
     this._cachedPlanetReady = false;
     this._cachedPlanet      = StarSystem.CreatePlanet(this.App.Game, Vector3.Zero, planetInfo, Matrix.Identity, 1f, false, StarSystem.TerrestrialPlanetQuality.High);
     this._cachedPlanet.PostSetProp("AutoDraw", false);
     this._crits.Add((IGameObject)this._cachedPlanet);
 }
Esempio n. 4
0
        public static StellarBody Create(App game, StellarBody.Params p)
        {
            Player        player     = game.GetPlayer(p.ColonyPlayerID);
            List <object> objectList = new List <object>();

            objectList.AddRange((IEnumerable <object>) new object[38]
            {
                (object)(player != null ? player.ObjectID : 0),
                (object)p.OrbitalID,
                (object)p.IconSpriteName,
                (object)(p.SurfaceMaterial ?? "planet_earth2"),
                (object)p.Position,
                (object)p.Radius,
                (object)p.IsInCombat,
                (object)game.AssetDatabase.DefaultPlanetSensorRange,
                (object)p.AtmoThickness,
                (object)p.AtmoScatterWaveLengths,
                (object)p.AtmoKm,
                (object)p.AtmoKr,
                (object)p.AtmoScaleDepth,
                (object)p.UseHeightMap,
                (object)p.RandomSeed,
                (object)p.TextureSize,
                (object)p.HeightGradient1Texture,
                (object)p.HeightGradient2Texture,
                (object)p.HeightGradient3Texture,
                (object)p.HeightGradient2Blend,
                (object)p.HeightGradient3Blend,
                (object)p.CityEmissiveTexture,
                (object)p.MinCityAltitude,
                (object)p.MaxCityAltitude,
                (object)p.CitySprawl,
                (double)p.CloudOpacity != 0.0 ? (object)p.CloudDiffuseTexture : (object)string.Empty,
                (double)p.CloudOpacity != 0.0 ? (object)p.CloudSpecularTexture : (object)string.Empty,
                (object)p.CloudOpacity,
                (object)p.CloudDiffuseColor,
                (object)p.CloudSpecularColor,
                (object)p.WaterLevel,
                (object)p.WaterSpecularColor,
                (object)p.MaxWaterDepth,
                (object)p.MaxLandHeight,
                (object)p.BodyType,
                (object)(p.BodyName ?? string.Empty),
                (object)(int)p.ColonyStage,
                (object)(int)p.ColonyType
            });
            if (p.HeightGen != null)
            {
                if (p.HeightGen is StellarBody.HGBlendParams)
                {
                    StellarBody.HGBlendParams heightGen = p.HeightGen as StellarBody.HGBlendParams;
                    objectList.AddRange((IEnumerable <object>) new object[5]
                    {
                        (object)"blend",
                        (object)heightGen.Bumpiness,
                        (object)heightGen.Layer1Texture,
                        (object)heightGen.Layer2Texture,
                        (object)heightGen.Layer2Amount
                    });
                }
                else if (p.HeightGen is StellarBody.HGPlaneCutsParams)
                {
                    StellarBody.HGPlaneCutsParams heightGen = p.HeightGen as StellarBody.HGPlaneCutsParams;
                    objectList.AddRange((IEnumerable <object>) new object[5]
                    {
                        (object)"planecuts",
                        (object)heightGen.Bumpiness,
                        (object)heightGen.BaseHeight,
                        (object)heightGen.Iterations,
                        (object)heightGen.Shift
                    });
                }
                else
                {
                    objectList.Add((object)"none");
                }
            }
            else
            {
                objectList.Add((object)"none");
            }
            objectList.Add((object)p.Civilians.Length);
            foreach (StellarBody.PlanetCivilianData civilian in p.Civilians)
            {
                objectList.Add((object)civilian.Faction);
                objectList.Add((object)civilian.Population);
            }
            objectList.Add((object)p.ImperialPopulation);
            objectList.Add((object)p.Infrastructure);
            objectList.Add((object)p.Suitability);
            objectList.Add((object)Constants.MinSuitability);
            objectList.Add((object)Constants.MaxSuitability);
            StellarBody stellarBody = game.AddObject <StellarBody>(objectList.ToArray());

            stellarBody.Parameters = p;
            return(stellarBody);
        }