コード例 #1
0
 public void Remove()
 {
     if (layer2D != null)
     {
         layer2D.Remove();
     }
     if (mainMenuLayer != null)
     {
         mainMenuLayer.Remove();
     }
     if (layerVolume != null)
     {
         layerVolume.Remove();
     }
     layer2D               = null;
     mainMenuLayer         = null;
     layerVolume           = null;
     volumeApplied         = false;
     this.enabled          = false;
     this.sphere           = null;
     this.transform.parent = null;
     GameEvents.OnMapExited.Remove(ExitMapView);
     GameEvents.onGameSceneLoadRequested.Remove(SceneLoaded);
 }
コード例 #2
0
        internal void Apply(String body, CloudsMaterial cloudsMaterial, Clouds2D layer2D, CloudsVolume layerVolume, float altitude, Vector3d speed, Vector3d detailSpeed, Vector3 offset, Matrix4x4 rotationAxis, bool killBodyRotation)
        {
            this.body = body;
            this.cloudsMaterial = cloudsMaterial;
            this.layer2D = layer2D;
            this.layerVolume = layerVolume;
            this.altitude = altitude;
            this.offset = -offset;
            this.rotationAxis = rotationAxis;
            this.killBodyRotation = killBodyRotation;

            celestialBody = Tools.GetCelestialBody(body);
            scaledCelestialTransform = Tools.GetScaledTransform(body);
            PQS pqs = null;
            if (celestialBody != null && celestialBody.pqsController != null)
            {
                pqs = celestialBody.pqsController;
            }
            else
            {
                CloudsManager.Log("No PQS! Instanciating one.");
                pqs = PQSManagerClass.GetPQS(body);
            }
            CloudsManager.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 = (altitude + celestialBody.Radius);

                double circumference = 2f * Mathf.PI * radius;
                mainPeriod = -(speed) / circumference;
                detailPeriod = -(detailSpeed) / circumference;

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

                if (!pqs.isActive || HighLogic.LoadedScene == GameScenes.TRACKSTATION)
                {
                    this.OnSphereInactive();
                }
                else
                {
                    this.OnSphereActive();
                }
                this.OnSetup();
                pqs.EnableSphere();
            }
            else
            {
                CloudsManager.Log("PQS is null somehow!?");
            }

            GameEvents.OnMapExited.Add(ExitMapView);
            GameEvents.onGameSceneLoadRequested.Add(SceneLoaded);

            if (HighLogic.LoadedScene == GameScenes.MAINMENU)
            {
                ApplyToMainMenu();
            }
        }
コード例 #3
0
        internal void Apply(String body, CloudsMaterial cloudsMaterial, Clouds2D layer2D, CloudsVolume layerVolume, float altitude, Vector3d speed, Vector3d detailSpeed, Vector3 offset, Matrix4x4 rotationAxis, bool killBodyRotation)
        {
            this.body             = body;
            this.cloudsMaterial   = cloudsMaterial;
            this.layer2D          = layer2D;
            this.layerVolume      = layerVolume;
            this.altitude         = altitude;
            this.offset           = -offset;
            this.rotationAxis     = rotationAxis;
            this.killBodyRotation = killBodyRotation;

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

            if (celestialBody != null && celestialBody.pqsController != null)
            {
                pqs = celestialBody.pqsController;
            }
            else
            {
                CloudsManager.Log("No PQS! Instanciating one.");
                pqs = PQSManagerClass.GetPQS(body);
            }
            CloudsManager.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 = (altitude + celestialBody.Radius);


                double circumference = 2f * Mathf.PI * radius;
                mainPeriod   = -(speed) / circumference;
                detailPeriod = -(detailSpeed) / circumference;

                if (layer2D != null)
                {
                    this.layer2D.Apply(celestialBody, scaledCelestialTransform, cloudsMaterial, this.name, (float)radius);
                }

                if (!pqs.isActive || HighLogic.LoadedScene == GameScenes.TRACKSTATION)
                {
                    this.OnSphereInactive();
                }
                else
                {
                    this.OnSphereActive();
                }
                this.OnSetup();
                pqs.EnableSphere();
            }
            else
            {
                CloudsManager.Log("PQS is null somehow!?");
            }

            GameEvents.OnMapExited.Add(ExitMapView);
            GameEvents.onGameSceneLoadRequested.Add(SceneLoaded);

            if (HighLogic.LoadedScene == GameScenes.MAINMENU)
            {
                ApplyToMainMenu();
            }
        }
コード例 #4
0
 public void Remove()
 {
     if (layer2D != null)
     {
         layer2D.Remove();
     }
     if(mainMenuLayer != null)
     {
         mainMenuLayer.Remove();
     }
     if (layerVolume != null)
     {
         layerVolume.Remove();
     }
     layer2D = null;
     mainMenuLayer = null;
     layerVolume = null;
     volumeApplied = false;
     this.enabled = false;
     this.sphere = null;
     this.transform.parent = null;
     GameEvents.OnMapExited.Remove(ExitMapView);
     GameEvents.onGameSceneLoadRequested.Remove(SceneLoaded);
 }