public KspSystemDefinition GetConfigData()
 {
     KspSystemDefinition kspSystemDefinition;
     if (system_config == null)
     {
         return null;
     }
     else
     {
         if (!system_config.HasData && !system_config_valid)
         {
             return null;
         }
         else
         {
             ConfigNode kspNode = system_config.GetNode("KSPSystem");
             RootDefinition rootDefinition;
             double sun_solar_mass;
             SunType sun_solar_type;
             try
             {
                 sun_solar_mass = double.Parse(kspNode.GetNode("Root").GetValue("SolarMasses"));
             }
             catch
             {
                 sun_solar_mass = 7700;
             }
             try
             {
                 sun_solar_type = ((SunType)int.Parse(kspNode.GetNode("Root").GetValue("Type")));
             }
             catch
             {
                 sun_solar_type = SunType.Blackhole;
             }
             rootDefinition = new RootDefinition(sun_solar_mass, sun_solar_type);
             try
             {
                 kspSystemDefinition = new KspSystemDefinition(rootDefinition,
                     double.Parse(kspNode.GetNode("Kerbol").GetValue("semiMajorAxis")));
             }
             catch
             {
                 kspSystemDefinition = new KspSystemDefinition(rootDefinition, 4500000000000);
             }
             kspSystemDefinition.Stars = getStars(kspNode.GetNode("StarSystems").GetNodes("StarSystem"));
         }
     }
     return kspSystemDefinition;
 }
Esempio n. 2
0
        public void OnPSystemReady(RootDefinition Root, CelestialBody OriginalSun, Transform ScaledSun)
        {
            Debug.Log("Altering sun...");

            //Set Original Sun Parameters
            double SolarMasses;

            SolarMasses = Root.SolarMasses;

            OriginalSun.Mass = SolarMasses * OriginalSun.Mass;
            OriginalSun.Radius = (2 * (6.74E-11) * OriginalSun.Mass) / (Math.Pow(299792458, 2.0));
            OriginalSun.GeeASL = OriginalSun.Mass * (6.674E-11 / 9.81) / Math.Pow(OriginalSun.Radius, 2.0);
            OriginalSun.gMagnitudeAtCenter = OriginalSun.GeeASL * 9.81 * Math.Pow(OriginalSun.Radius, 2.0);
            OriginalSun.gravParameter = OriginalSun.gMagnitudeAtCenter;

            OriginalSun.scienceValues.InSpaceLowDataValue = OriginalSun.scienceValues.InSpaceLowDataValue * 10f;
            OriginalSun.scienceValues.RecoveryValue = OriginalSun.scienceValues.RecoveryValue * 5f;

            OriginalSun.bodyName = "Blacky Karman";

            OriginalSun.bodyDescription =
                "This recently discovered black hole, named after its discoverer Billy-Hadrick Kerman, is the central point where multiple star systems revolve around.";

            OriginalSun.CBUpdate();

            //Make Sun Black
            ScaledSun.renderer.material.SetColor("_EmitColor0", new Color(0.0f, 0.0f, 0.0f, 1));
            ScaledSun.renderer.material.SetColor("_EmitColor1", new Color(0.0f, 0.0f, 0.0f, 1));
            ScaledSun.renderer.material.SetColor("_SunspotColor", new Color(0.0f, 0.0f, 0.0f, 1));
            ScaledSun.renderer.material.SetColor("_RimColor", new Color(0.0f, 0.0f, 0.0f, 1.0f));

            //Update Sun Scale
            var ScaledSunMeshFilter = (MeshFilter)ScaledSun.GetComponent(typeof(MeshFilter));
            var SunRatio = (float)OriginalSun.Radius / 261600000f;

            MeshScaler.ScaleMesh(ScaledSunMeshFilter.mesh, SunRatio);

            //Change Sun Corona
            foreach (var SunCorona in ScaledSun.GetComponentsInChildren<SunCoronas>())
            {
                SunCorona.renderer.material.mainTexture =
                    GameDatabase.Instance.GetTexture("StarSystems/Resources/BlackHoleCorona", false);
                var SunCoronaMeshFilter = (MeshFilter)SunCorona.GetComponent(typeof(MeshFilter));
                MeshScaler.ScaleMesh(SunCoronaMeshFilter.mesh, SunRatio);
            }

            Debug.Log("Sun altered");
        }
 public KspSystemDefinition(RootDefinition Root, double SemiMajorAxis, List <StarSystemDefintion> Stars)
 {
     this.Root          = Root;
     this.SemiMajorAxis = SemiMajorAxis;
     this.Stars         = Stars;
 }
 public KspSystemDefinition(RootDefinition Root, double SemiMajorAxis)
 {
     this.Root          = Root;
     this.SemiMajorAxis = SemiMajorAxis;
     Stars = new List <StarSystemDefintion>();
 }
 public KspSystemDefinition(RootDefinition Root, double SemiMajorAxis, List<StarSystemDefintion> Stars)
 {
     this.Root = Root;
     this.SemiMajorAxis = SemiMajorAxis;
     this.Stars = Stars;
 }
 public KspSystemDefinition(RootDefinition Root, double SemiMajorAxis)
 {
     this.Root = Root;
     this.SemiMajorAxis = SemiMajorAxis;
     Stars = new List<StarSystemDefintion>();
 }
Esempio n. 7
0
 public KspSystemDefinition(RootDefinition Root)
 {
     this.Root = Root;
     Stars     = new List <StarSystemDefintion>();
 }
Esempio n. 8
0
 public KspSystemDefinition(RootDefinition Root, List <StarSystemDefintion> Stars)
 {
     this.Root  = Root;
     this.Stars = Stars;
 }