base.transform.name = this.bodyName;
this.radius = this.diameterKm * 500.0;
this.mass = Math.Pow(this.radius, 2.0) * this.surfaceGravity;
this.cameraSwitchHeightM = this.cameraSwitchHeightKm * 1000.0;
if (this.atmosphereData.shadowIntensity == 0f)
{
this.atmosphereData.shadowIntensity = 1.65f;
}
this.atmosphereData.atmosphereHeightM = this.atmosphereData.atmosphereHeightKm * 1000.0;
if (this.terrainData.terrainMaterial != null)
{
this.terrainData.terrainMaterial.color = this.terrainData.terrainColor;
}
this.terrainData.maxTerrainHeight = this.GetMaxTerrainHeight();
this.terrainData.unitToAngle = 360.0 / ((this.radius + this.terrainData.maxTerrainHeight) * 2.0 * 3.1415926535897931);
for (int i = 0; i < this.terrainData.detailLevels.Length; i++)
{
this.terrainData.detailLevels[i].chunckSize = (double)this.terrainData.baseChunckSize / Math.Pow(2.0, (double)i);
this.terrainData.detailLevels[i].angularSize = (float)this.terrainData.detailLevels[i].chunckSize / (float)this.terrainData.heightMaps[0].heightMap.HeightDataArray.Length * 360f;
}
this.terrainData.detailLevels[0].loadDistance = double.PositiveInfinity;
if (this.type == CelestialBodyData.Type.Star)
{
this.parentBody = null;
this.orbitData.SOIMultiplier = double.PositiveInfinity;
}
if (this.parentBody != null && (this.type == this.parentBody.type || (this.type == CelestialBodyData.Type.Planet && this.parentBody.type == CelestialBodyData.Type.Moon)))
{
this.parentBody = null;
}
if (this.parentBody != null)
{
this.orbitData._period = Kepler.GetPeriod(0.0, this.orbitData.orbitHeightM, this.parentBody.mass);
this.orbitData.periodString = Ref.GetTimeString(this.orbitData._period);
this.orbitData._meanMotion = -6.2831853071795862 / this.orbitData._period;
this.orbitData.orbitalVelocity = this.orbitData.orbitHeightM * this.orbitData._meanMotion;
this.orbitData.SOI = this.orbitData.orbitHeightM * Math.Pow(this.mass / this.parentBody.mass, 0.4) * this.orbitData.SOIMultiplier;
if (!this.ParentHasThisBodyAsSatellite())
{
List<CelestialBodyData> list = new List<CelestialBodyData>(this.parentBody.satellites);
list.Add(this);
this.parentBody.satellites = list.ToArray();
this.parentBody.ValidateSatellites();
}