Exemplo n.º 1
0
 // Parser post apply event
 void IParserEventSubscriber.PostApply(ConfigNode node)
 {
     if (atmosphereFromGround != null)
     {
         AFGInfo.StoreAFG(atmosphereFromGround.afg);
     }
 }
Exemplo n.º 2
0
            // Parser post apply event
            void IParserEventSubscriber.PostApply(ConfigNode node)
            {
                // Recalculate with the new values and store
                CalculatedMembers(Value);
                AFGInfo.StoreAFG(Value);

                // Fire event
                Events.OnAFGLoaderPostApply.Fire(this, node);
            }
Exemplo n.º 3
0
            /// <summary>
            /// Renders the Window
            /// </summary>
            protected override void Render(Int32 id)
            {
                // Call base
                base.Render(id);

                // Scroll
                BeginScrollView(250, Utils.GetScrollSize <AtmosphereFromGround>() + distance * 3, 20);

                // Index
                index = 0;

                // Check for existing AFG
                if (Current.afg == null)
                {
                    Button(Localization.LOC_KITTOPIATECH_AFGEDITOR_ADD + " " + Current.displayName.Replace("^N", ""), () =>
                    {
                        // Create the atmosphere shell game object
                        GameObject scaledAtmosphere       = new GameObject("Atmosphere");
                        scaledAtmosphere.transform.parent = Current.scaledBody.transform;
                        scaledAtmosphere.layer            = Constants.GameLayers.ScaledSpaceAtmosphere;
                        MeshRenderer renderer             = scaledAtmosphere.AddComponent <MeshRenderer>();
                        renderer.sharedMaterial           = new MaterialWrapper.AtmosphereFromGround();
                        MeshFilter meshFilter             = scaledAtmosphere.AddComponent <MeshFilter>();
                        meshFilter.sharedMesh             = Templates.ReferenceGeosphere;
                        Current.afg = scaledAtmosphere.AddComponent <AtmosphereFromGround>();

                        // Register the AFG for updates
                        AFGInfo.StoreAFG(Current.afg);
                    });
                    return;
                }

                // Render AFG
                RenderObject(Current.afg);
                index++;

                // Updates
                Button(Localization.LOC_KITTOPIATECH_AFGEDITOR_UPDATE, () => { AtmosphereFromGroundLoader.CalculatedMembers(Current.afg); AFGInfo.PatchAFG(Current.afg); });

                // End Scroll
                EndScrollView();
            }
Exemplo n.º 4
0
            public AtmosphereFromGroundLoader(CelestialBody body)
            {
                // Is this a spawned body?
                if (body?.scaledBody == null)
                {
                    throw new InvalidOperationException("The body must be already spawned by the PSystemManager.");
                }

                // Store values
                Value = body.afg;

                if (Value == null)
                {
                    // Add the material light direction behavior
                    MaterialSetDirection materialLightDirection = body.scaledBody.AddComponent <MaterialSetDirection>();
                    materialLightDirection.valueName = "_localLightDirection";

                    // Create the atmosphere shell game object
                    GameObject scaledAtmosphere = new GameObject("Atmosphere");
                    scaledAtmosphere.transform.parent = body.scaledBody.transform;
                    scaledAtmosphere.layer            = Constants.GameLayers.ScaledSpaceAtmosphere;
                    MeshRenderer renderer = scaledAtmosphere.AddComponent <MeshRenderer>();
                    renderer.sharedMaterial = new MaterialWrapper.AtmosphereFromGround();
                    MeshFilter meshFilter = scaledAtmosphere.AddComponent <MeshFilter>();
                    meshFilter.sharedMesh = Templates.ReferenceGeosphere;
                    Value            = body.afg = scaledAtmosphere.AddComponent <AtmosphereFromGround>();
                    Value.planet     = body;
                    Value.sunLight   = Sun.Instance.gameObject;
                    Value.mainCamera = ScaledCamera.Instance.transform;
                    AFGInfo.StoreAFG(Value);
                    AFGInfo.PatchAFG(Value);

                    // Set defaults
                    SetDefaultValues();
                }

                Value.planet = body;
            }
 public void Store()
 {
     CalculateMembers();
     AFGInfo.StoreAFG(Value);
 }