Example #1
0
        private void ApplyToMainMenu()
        {
            if (HighLogic.LoadedScene == GameScenes.MAINMENU)
            {
                GameObject go = Tools.GetMainMenuObject(body);

                if (go != null && go.transform != mainMenuBodyTransform)
                {
                    mainMenuCamera = GameObject.FindObjectsOfType <Camera>().First(c => (c.cullingMask & (1 << go.layer)) > 0 && c.isActiveAndEnabled);

                    if (layer2D != null)
                    {
                        if (mainMenuLayer != null)
                        {
                            mainMenuLayer.Remove();
                        }
                        mainMenuBodyTransform = go.transform;
                        mainMenuLayer         = layer2D.CloneForMainMenu(go);
                        CloudsManager.Log(this.name + " Applying to main menu!");
                    }
                }
                else if (go == null)
                {
                    CloudsManager.Log("Cannot find " + body + " to apply to main Menu!");
                }
                else if (mainMenuBodyTransform == go.transform)
                {
                    CloudsManager.Log("Already Applied to main Menu!");
                }
            }
        }
Example #2
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);
 }