private void Awake() { StaticLogger = Logger; VRAssetBundle = AssetBundle.LoadFromMemory(Properties.Resources.vrmodassets); ModConfig.Init(); ActionAddons.Init(); SettingsAddon.Init(); UIFixes.Init(); CameraFixes.Init(); CutsceneFixes.Init(); FocusChecker.Init(); if (ModConfig.InitialMotionControlsValue) { RoR2.RoR2Application.isModded = true; MotionControls.Init(); MotionControlledAbilities.Init(); EntityStateAnimationParameter.Init(); } RoR2.RoR2Application.onLoad += () => { StartCoroutine(InitVR(ModConfig.InitialOculusModeValue)); RecenterController.Init(); UIPointer.Init(); }; }
private static void ChangeLIVHUD(object sender, EventArgs e) { if (UIFixes.livHUD != null) { UIFixes.livHUD.gameObject.SetActive(ModConfig.LIVHUD.Value); } else if (LIVHUD.Value && CameraFixes.liv && CameraFixes.liv.enabled) { UIFixes.CreateLIVHUD(CameraFixes.liv.render.cameraInstance); } }
private static void InitCamera(On.RoR2.CameraRigController.orig_Start orig, CameraRigController self) { orig(self); if (self.sceneCam.cullingMask == (self.sceneCam.cullingMask | (1 << LayerIndex.triggerZone.intVal))) { self.sceneCam.cullingMask &= ~(1 << LayerIndex.triggerZone.intVal); } if (self.sceneCam.cullingMask == (self.sceneCam.cullingMask | (1 << LayerIndex.noDraw.intVal))) { self.sceneCam.cullingMask &= ~(1 << LayerIndex.noDraw.intVal); } if (self.gameObject.scene.name == "intro" && self.sceneCam.cullingMask == (self.sceneCam.cullingMask | (1 << LayerIndex.ui.intVal))) { self.sceneCam.cullingMask &= ~(1 << LayerIndex.ui.intVal); } if (Run.instance && ModConfig.UseConfortVignette.Value) { self.uiCam.gameObject.AddComponent <ConfortVignette>(); } GameObject cameraOffsetObject = new GameObject("Camera Offset"); cameraOffset = cameraOffsetObject.transform; cameraOffset.transform.SetParent(self.transform); cameraOffset.transform.localPosition = Vector3.zero; cameraOffset.transform.localRotation = Quaternion.identity; cameraOffset.transform.localScale = Vector3.one; self.sceneCam.transform.SetParent(cameraOffset.transform); if (ModConfig.InitialRoomscaleValue && !Run.instance) { self.currentCameraState = self.desiredCameraState; } if (!ModConfig.InitialOculusModeValue && ModConfig.InitialRoomscaleValue) { if (liv) { GameObject.Destroy(liv); } liv = self.gameObject.AddComponent <LIV.SDK.Unity.LIV>(); liv.stage = self.transform; liv.stageTransform = cameraOffset.transform; liv.HMDCamera = self.sceneCam; liv.excludeBehaviours = new string[] { "AkAudioListener", "Rigidbody", "AkGameObj", "CameraResolutionScaler", "TranslucentImageSource" }; liv.spectatorLayerMask = self.sceneCam.cullingMask; liv.enabled = true; } if (self.hud) { UIFixes.AdjustHUD(self.hud); } RoR2Application.instance.mainCanvas.worldCamera = self.uiCam; if (FocusChecker.instance) { FocusChecker.instance.UpdateCameraRig(self); } }