internal void Apply(String body, AtmosphereVolume atmosphere, float altitude)
        {
            this.body       = body;
            this.atmosphere = atmosphere;
            this.altitude   = altitude;

            celestialBody            = Tools.GetCelestialBody(body);
            scaledCelestialTransform = Tools.GetScaledTransform(body);
            PQS pqs = null;

            if (celestialBody != null && celestialBody.pqsController != null)
            {
                pqs = celestialBody.pqsController;
            }
            else
            {
                AtmosphereManager.Log("No PQS! Instanciating one.");
                pqs = PQSManagerClass.GetPQS(body);
            }
            AtmosphereManager.Log("PQS Applied");
            if (pqs != null)
            {
                this.sphere           = pqs;
                this.transform.parent = pqs.transform;
                this.requirements     = PQS.ModiferRequirements.Default;
                this.modEnabled       = true;
                this.order           += 10;

                this.transform.localPosition = Vector3.zero;
                this.transform.localRotation = Quaternion.identity;
                this.transform.localScale    = Vector3.one;
                this.radius = (float)(altitude + celestialBody.Radius);


                if (atmosphere != null)
                {
                    this.atmosphere.Apply(celestialBody, scaledCelestialTransform, radius);
                }

                if (!pqs.isActive || HighLogic.LoadedScene == GameScenes.TRACKSTATION)
                {
                    this.OnSphereInactive();
                }
                else
                {
                    this.OnSphereActive();
                }
                this.OnSetup();
                pqs.EnableSphere();
            }
            else
            {
                AtmosphereManager.Log("PQS is null somehow!?");
            }
            onExitMapView          = new Callback(OnExitMapView);
            MapView.OnExitMapView += onExitMapView;
            GameEvents.onGameSceneLoadRequested.Add(GameSceneLoaded);
        }
 public override void OnSphereInactive()
 {
     AtmosphereManager.Log("AtmospherePQS: OnSphereInactive");
     if (atmosphere != null)
     {
         atmosphere.Scaled = true;
     }
     if (!MapView.MapIsEnabled)
     {
         applied = false;
     }
 }
 public override void OnSphereActive()
 {
     AtmosphereManager.Log("AtmospherePQS: OnSphereActive");
     if (atmosphere != null)
     {
         atmosphere.Scaled = false;
     }
     if (!applied)
     {
         applied = true;
     }
 }
示例#4
0
        protected override void Clean()
        {
            AtmosphereManager.Log("Cleaning Atmosphere!");
            foreach (AtmosphereObject obj in ObjectList)
            {
                obj.Remove();
                GameObject go = obj.gameObject;
                go.transform.parent = null;

                GameObject.DestroyImmediate(obj);
                GameObject.DestroyImmediate(go);
            }
            ObjectList.Clear();
        }