internal void Start() { if (LoadManager.GetCurrentScene() == OWScene.SolarSystem) { _shipWindshield = GameObject.Find("ShipLODTrigger_Cockpit").transform; } _signalscope = Camera.main.transform.Find("Signalscope").GetComponent <Signalscope>(); var holdSignalscope = _signalscope.gameObject.AddComponent <Holdable>(); holdSignalscope.transform.localPosition = new Vector3(0.013f, 0.1f, 0.123f); holdSignalscope.transform.localRotation = Quaternion.Euler(32.8f, 0, 0); var signalScopeModel = _signalscope.transform.GetChild(0); // Tools have a special shader that draws them on top of everything // and screws with perspective. Changing to Standard shader so they look // like a normal 3D object. signalScopeModel.GetComponent <MeshRenderer>().material.shader = Shader.Find("Standard"); signalScopeModel.localPosition = Vector3.up * -0.1f; signalScopeModel.localRotation = Quaternion.identity; // This child seems to be only for some kind of shader effect. // Disabling it since it looks glitchy and doesn't seem necessary. signalScopeModel.GetChild(0).gameObject.SetActive(false); var signalScopeHolster = Instantiate(signalScopeModel).gameObject; signalScopeHolster.SetActive(true); var holster = signalScopeHolster.AddComponent <HolsterTool>(); holster.hand = HandsController.Behaviour.RightHand; holster.position = new Vector3(0.3f, 0, 0); holster.mode = ToolMode.SignalScope; holster.scale = 0.8f; holster.angle = Vector3.right * 90; holster.onUnequip = OnUnequip; var playerHUD = GameObject.Find("PlayerHUD").transform; _reticule = playerHUD.Find("HelmetOffUI/SignalscopeReticule"); // Attatch Signalscope UI to the Signalscope. _reticule.GetComponent <Canvas>().renderMode = RenderMode.WorldSpace; _reticule.parent = _signalscope.transform; _reticule.localScale = Vector3.one * 0.0005f; _reticule.localPosition = Vector3.forward * 0.5f; _reticule.localRotation = Quaternion.identity; var helmetOff = playerHUD.Find("HelmetOffUI/SignalscopeCanvas"); SetupSignalscopeUI(helmetOff, new Vector3(-0.05f, 0.45f, 0)); var helmetOn = playerHUD.Find("HelmetOnUI/UICanvas/SigScopeDisplay"); SetupSignalscopeUI(helmetOn, new Vector3(-0.05f, -0.2f, 0)); LayerHelper.ChangeLayerRecursive(helmetOn.gameObject, "UI"); SetupScopeLens(); }
void Start() { _instance = this; NomaiVR.Log("Started FogFix"); // Make dark bramble lights visible in the fog. var fogLightCanvas = GameObject.Find("FogLightCanvas").GetComponent <Canvas>(); fogLightCanvas.renderMode = RenderMode.ScreenSpaceCamera; fogLightCanvas.worldCamera = Locator.GetActiveCamera().mainCamera; fogLightCanvas.planeDistance = 100; // Disable underwater effect. GameObject.FindObjectOfType <UnderwaterEffectBubbleController>().gameObject.SetActive(false); // Disable water entering and exiting effect. var visorEffects = FindObjectOfType <VisorEffectController>(); visorEffects.SetValue("_waterClearLength", 0); visorEffects.SetValue("_waterFadeInLength", 0); _camera = Locator.GetPlayerCamera(); if (LoadManager.GetPreviousScene() == OWScene.TitleScreen && LoadManager.GetCurrentScene() == OWScene.SolarSystem) { CloseEyes(); } }
private void Update() { if (LoadManager.GetCurrentScene() == OWScene.SolarSystem || LoadManager.GetCurrentScene() == OWScene.EyeOfTheUniverse) { if (PlayerNMBody == null) { PlayerNMBody = GameObject.FindObjectOfType <PlayerNoiseMaker>()?.GetAttachedBody(); } } else { PlayerNMBody = null; } if (LoadManager.GetCurrentScene() == OWScene.SolarSystem) { if (ShipNMBody == null) { ShipNMBody = GameObject.FindObjectOfType <ShipNoiseMaker>()?.GetAttachedBody(); } } else { fishes.Clear(); ShipNMBody = null; } }
internal void Start() { _instance = this; _camera = Locator.GetPlayerCamera(); if (LoadManager.GetPreviousScene() == OWScene.TitleScreen && LoadManager.GetCurrentScene() == OWScene.SolarSystem) { CloseEyes(); } }
public NomaiVRModule() { if (IsSceneRelevant(LoadManager.GetCurrentScene())) { SetupBehaviour(); } LoadManager.OnCompleteSceneLoad += OnSceneLoad; SetupPatch(); }
private void OnEvent(MonoBehaviour behaviour, Events ev) { if (LoadManager.GetCurrentScene() == OWScene.SolarSystem) { bool flag = behaviour.GetType() == typeof(Flashlight) && ev == Events.AfterStart; if (flag) { SetupCamera(); } } base.ModHelper.Console.WriteLine(behaviour.name); }
internal void Start() { var scene = LoadManager.GetCurrentScene(); if (scene == OWScene.SolarSystem) { FixSleepTimerCanvas(); } else if (scene == OWScene.TitleScreen) { FixTitleMenuCanvases(); FixStarLogos(); } ScreenCanvasesToWorld(); }
private ServerState ForceGetCurrentState() { var currentScene = LoadManager.GetCurrentScene(); switch (currentScene) { case OWScene.SolarSystem: return(ServerState.InSolarSystem); case OWScene.EyeOfTheUniverse: return(ServerState.InEye); default: return(ServerState.NotLoaded); } }
private void SetupCamera() { if (_disableLauncher) { GameObject.Find("ProbeLauncher").SetActive(false); base.ModHelper.Console.WriteLine("[FreeCam] : Launcher off!"); GameObject.Find("ProbeLauncher").SetActive(false); base.ModHelper.Console.WriteLine("[FreeCam] : Visor off!"); } if (_freeCam.name == "FREECAM") { base.ModHelper.Console.WriteLine("[FreeCam] : Already set up! Aborting..."); } else { if (LoadManager.GetCurrentScene() == OWScene.SolarSystem) { _freeCam.transform.parent = Locator.GetAstroObject(AstroObject.Name.TimberHearth).gameObject.transform; } else { _freeCam.transform.parent = Locator.GetPlayerTransform(); } _freeCam.transform.position = Locator.GetPlayerTransform().position; _freeCam.SetActive(false); FlashbackScreenGrabImageEffect temp = _freeCam.AddComponent <FlashbackScreenGrabImageEffect>(); temp._downsampleShader = Locator.GetPlayerCamera().gameObject.GetComponent <FlashbackScreenGrabImageEffect>()._downsampleShader; PlanetaryFogImageEffect _image = _freeCam.AddComponent <PlanetaryFogImageEffect>(); _image.fogShader = Locator.GetPlayerCamera().gameObject.GetComponent <PlanetaryFogImageEffect>().fogShader; PostProcessingBehaviour _postProcessiong = _freeCam.AddComponent <PostProcessingBehaviour>(); _postProcessiong.profile = Locator.GetPlayerCamera().gameObject.GetAddComponent <PostProcessingBehaviour>().profile; _freeCam.SetActive(true); _camera.cullingMask = Locator.GetPlayerCamera().mainCamera.cullingMask & ~(1 << 27) | (1 << 22); _freeCam.name = "FREECAM"; } }
void Start() { NomaiVR.Log("Start Menus"); // Make UI elements draw on top of everything. Canvas.GetDefaultCanvasMaterial().SetInt("unity_GUIZTestMode", (int)CompareFunction.Always); var scene = LoadManager.GetCurrentScene(); if (scene == OWScene.SolarSystem) { // Make sleep timer canvas visible while eyes closed. Locator.GetUIStyleManager().transform.Find("SleepTimerCanvas").gameObject.layer = LayerMask.NameToLayer("VisibleToPlayer"); } else if (scene == OWScene.TitleScreen) { var animatedTitle = GameObject.Find("TitleCanvasHack").GetComponent <Canvas>(); animatedTitle.renderMode = RenderMode.ScreenSpaceOverlay; } ScreenCanvasesToWorld(); if (SceneManager.GetActiveScene().name == "SolarSystem") { GlobalMessenger.AddListener("WakeUp", OnWakeUp); var animatedTitleChild = animatedTitle.transform.GetChild(0).GetComponent <RectTransform>(); animatedTitleChild.anchorMax = Vector2.one * 0.5f; animatedTitleChild.anchorMin = Vector2.one * 0.5f; var mainMenu = GameObject.Find("TitleLayoutGroup").GetComponent <RectTransform>(); mainMenu.position = Vector3.zero; // Cant't get the footer to look good, so I'm hiding it. GameObject.Find("FooterBlock").SetActive(false); // Make the camera start looking forward instead of some random direction. var cameraSocket = GameObject.Find("CameraSocket").transform; cameraSocket.rotation = Quaternion.identity; } ScreenCanvasesToWorld(); }
public static bool IsInGame() { var scene = LoadManager.GetCurrentScene(); return(scene == OWScene.SolarSystem || scene == OWScene.EyeOfTheUniverse); }
public static bool IsInTitle() { return(LoadManager.GetCurrentScene() == OWScene.TitleScreen); }
public static bool IsInSolarSystem() { return(LoadManager.GetCurrentScene() == OWScene.SolarSystem); }