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);
        }
        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);
        }
Example #3
0
        public void Remove()
        {
            atmospherePQS.Remove();
            GameObject go = atmospherePQS.gameObject;


            GameObject.DestroyImmediate(atmospherePQS);
            GameObject.DestroyImmediate(go);
            atmosphere = null;
        }
        public void Remove()
        {
            atmospherePQS.Remove();
            GameObject go = atmospherePQS.gameObject;
            

            GameObject.DestroyImmediate(atmospherePQS);
            GameObject.DestroyImmediate(go);
            atmosphere = null;
        }
 public void Apply()
 {
     celestialBody = Tools.GetCelestialBody(body);
     scaledCelestialTransform = Tools.GetScaledTransform(body);
     
     GameObject go = new GameObject();
     atmospherePQS = go.AddComponent<AtmospherePQS>();
     atmosphere = new AtmosphereVolume(atmosphereMaterial);
     atmospherePQS.Apply(body, atmosphere, altitude);
 }
Example #6
0
        public void Apply()
        {
            celestialBody            = Tools.GetCelestialBody(body);
            scaledCelestialTransform = Tools.GetScaledTransform(body);

            GameObject go = new GameObject("AtmosphereObject");

            atmospherePQS = go.AddComponent <AtmospherePQS>();
            atmosphere    = new AtmosphereVolume(atmosphereMaterial);
            atmospherePQS.Apply(body, atmosphere, altitude);
        }
 public void Remove()
 {
     if (atmosphere != null)
     {
         atmosphere.Remove();
     }
     atmosphere = null;
     applied = false;
     this.sphere = null;
     this.enabled = false;
     this.transform.parent = null;
     MapView.OnExitMapView -= onExitMapView;
     GameEvents.onGameSceneLoadRequested.Remove(GameSceneLoaded);
 }
 public void Remove()
 {
     if (atmosphere != null)
     {
         atmosphere.Remove();
     }
     atmosphere             = null;
     applied                = false;
     this.sphere            = null;
     this.enabled           = false;
     this.transform.parent  = null;
     MapView.OnExitMapView -= onExitMapView;
     GameEvents.onGameSceneLoadRequested.Remove(GameSceneLoaded);
 }