using System; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("McHorse")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a88a3691928d7785c928e992d700ddbbdf72ef57")] [assembly: AssemblyProduct("Cam")] [assembly: AssemblyTitle("Cam")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Cam { [BepInPlugin("McHorse.FreeCam", "FreeCam", "1.2")] public class FreeCam : BaseUnityPlugin { [HarmonyPatch(typeof(PlayerVisionTarget), "Update")] internal static class PatchPlayerVisionTargetUpdate { [HarmonyPostfix] private static void Postfix(PlayerVisionTarget __instance) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) FreeCam instance = Instance; if (!((Object)(object)instance == (Object)null) && instance.CamDetached) { PlayerAvatar instance2 = PlayerAvatar.instance; if (!((Object)(object)instance2 == (Object)null) && !((Object)(object)((Component)__instance).GetComponent() != (Object)(object)instance2) && (Object)(object)CameraAim.Instance != (Object)null && (Object)(object)__instance.VisionTransform != (Object)null) { __instance.VisionTransform.rotation = ((Component)CameraAim.Instance).transform.rotation; } } } } private ConfigEntry _toggleCameraKey = null; private ConfigEntry _setEyesKey = null; private ConfigEntry _toggleHUD = null; private ConfigEntry _screenshot = null; private ConfigEntry _fov = null; private ConfigEntry _moveSpeed = null; private ConfigEntry _lookSensitivity = null; private ConfigEntry _fovSensitivity = null; private ConfigEntry _resetPosition = null; private ConfigEntry _smoothingEnabled = null; private ConfigEntry _smoothingFactor = null; private bool _camDetached; private bool _cameraControlActive; private bool _hudVisible; private float _fovOffset; private float _currentMoveSpeed; private Vector3? _lastDetachedPosition; private Quaternion? _lastDetachedRotation; private float _smoothedFov; private Vector3 _targetPosition; private Quaternion _targetRotation; private const float MoveSpeedMin = 0.5f; private const float MoveSpeedMax = 50f; private Camera? _gameCam; private Transform? _cameraParent; private Vector3 _cameraLocalPosition; private Quaternion _cameraLocalRotation; private Vector3 _eyesLookAtPosition; private GameObject? _aimAnchor; internal static FreeCam Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } internal bool CamDetached => _camDetached; private void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Expected O, but got Unknown //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; _aimAnchor = new GameObject("FreeCam_AimAnchor"); ((Object)_aimAnchor).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)_aimAnchor); Patch(); _toggleCameraKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "ToggleCam", (KeyCode)122, "Toggle camera view"); _setEyesKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "SetEyes", (KeyCode)118, "Set eyes"); _toggleHUD = ((BaseUnityPlugin)this).Config.Bind("Controls", "ToggleHUD", (KeyCode)280, "Toggle HUD"); _screenshot = ((BaseUnityPlugin)this).Config.Bind("Controls", "Screenshot", (KeyCode)281, "Take a screenshot"); _fov = ((BaseUnityPlugin)this).Config.Bind("Options", "FOV", 50, new ConfigDescription("Set FOV", (AcceptableValueBase)(object)new AcceptableValueRange(0, 180), Array.Empty())); _moveSpeed = ((BaseUnityPlugin)this).Config.Bind("Options", "MoveSpeed", 5f, new ConfigDescription("Default free-cam movement speed.", (AcceptableValueBase)null, Array.Empty())); _lookSensitivity = ((BaseUnityPlugin)this).Config.Bind("Options", "LookSensitivity", 2f, new ConfigDescription("Mouse look sensitivity when controlling detached camera.", (AcceptableValueBase)null, Array.Empty())); _fovSensitivity = ((BaseUnityPlugin)this).Config.Bind("Options", "FovSensitivity", 0.5f, new ConfigDescription("Mouse FOV change sensitivity when holding Alt.", (AcceptableValueBase)null, Array.Empty())); _resetPosition = ((BaseUnityPlugin)this).Config.Bind("Options", "ResetPosition", true, new ConfigDescription("When enabled, reset the camera's position and rotation to player's head.", (AcceptableValueBase)null, Array.Empty())); _smoothingEnabled = ((BaseUnityPlugin)this).Config.Bind("Smoothing", "Enabled", false, new ConfigDescription("Smooth camera position, rotation and FOV by lerping toward target values.", (AcceptableValueBase)null, Array.Empty())); _smoothingFactor = ((BaseUnityPlugin)this).Config.Bind("Smoothing", "SmoothingFactor", 0.2f, new ConfigDescription("Lerp factor per frame (higher = snappier, lower = smoother).", (AcceptableValueBase)(object)new AcceptableValueRange(0.01f, 1f), Array.Empty())); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) if (_camDetached) { DriveThirdPersonAvatar(); float num = Mathf.Clamp((float)_fov.Value + _fovOffset, 5f, 120f); bool value = _smoothingEnabled.Value; _smoothedFov = (value ? Mathf.Lerp(_smoothedFov, num, _smoothingFactor.Value) : num); CameraZoom.Instance.OverrideZoomSet(_smoothedFov, 0.1f, 2000f, 2000f, ((Component)this).gameObject, 0); if (Input.GetMouseButtonDown(2) && (Object)(object)_gameCam != (Object)null) { _cameraControlActive = !_cameraControlActive; if (_cameraControlActive) { _targetPosition = ((Component)_gameCam).transform.position; _targetRotation = ((Component)_gameCam).transform.rotation; } } if (_cameraControlActive && (Object)(object)_gameCam != (Object)null) { GameDirector instance = GameDirector.instance; if (instance != null) { instance.SetDisableInput(0.1f); } float axis = Input.GetAxis("Mouse ScrollWheel"); if (axis != 0f) { _currentMoveSpeed += axis * 10f; _currentMoveSpeed = Mathf.Clamp(_currentMoveSpeed, 0.5f, 50f); } Transform transform = ((Component)_gameCam).transform; float unscaledDeltaTime = Time.unscaledDeltaTime; if (Input.GetKey((KeyCode)119)) { _targetPosition += _targetRotation * Vector3.forward * (_currentMoveSpeed * unscaledDeltaTime); } if (Input.GetKey((KeyCode)115)) { _targetPosition -= _targetRotation * Vector3.forward * (_currentMoveSpeed * unscaledDeltaTime); } if (Input.GetKey((KeyCode)100)) { _targetPosition += _targetRotation * Vector3.right * (_currentMoveSpeed * unscaledDeltaTime); } if (Input.GetKey((KeyCode)97)) { _targetPosition -= _targetRotation * Vector3.right * (_currentMoveSpeed * unscaledDeltaTime); } if (Input.GetKey((KeyCode)304)) { _targetPosition += Vector3.up * (_currentMoveSpeed * unscaledDeltaTime); } if (Input.GetKey((KeyCode)306)) { _targetPosition -= Vector3.up * (_currentMoveSpeed * unscaledDeltaTime); } if (Input.GetKey((KeyCode)308)) { _fovOffset -= Input.GetAxis("Mouse Y") * _fovSensitivity.Value; } else { float num2 = Input.GetAxis("Mouse X") * _lookSensitivity.Value; float num3 = (0f - Input.GetAxis("Mouse Y")) * _lookSensitivity.Value; Vector3 eulerAngles = ((Quaternion)(ref _targetRotation)).eulerAngles; float num4 = eulerAngles.x + num3; if (num4 > 180f) { num4 -= 360f; } num4 = Mathf.Clamp(num4, -89f, 89f); _targetRotation = Quaternion.Euler(num4, eulerAngles.y + num2, eulerAngles.z); } transform.position = (value ? Vector3.Lerp(transform.position, _targetPosition, _smoothingFactor.Value) : _targetPosition); transform.rotation = (value ? Quaternion.Slerp(transform.rotation, _targetRotation, _smoothingFactor.Value) : _targetRotation); _eyesLookAtPosition = transform.position; } } if (IsInPlayableLevel(out PlayerController playerController)) { if (Input.GetKeyDown(_toggleCameraKey.Value)) { ToggleCameraDetachment(playerController); } if (Input.GetKeyDown(_setEyesKey.Value) && _camDetached) { PlayerAvatar instance2 = PlayerAvatar.instance; PlayerAvatarVisuals val = instance2?.playerAvatarVisuals; if ((Object)(object)val != (Object)null && (Object)(object)instance2?.localCamera != (Object)null && TryGetHit(val.headUpTransform.position, ((Component)instance2.localCamera).transform.forward, out var hit, 200f)) { _eyesLookAtPosition = ((RaycastHit)(ref hit)).point; } } if (Input.GetKeyDown(_toggleHUD.Value)) { GameObject hUDCanvas = GetHUDCanvas(); if ((Object)(object)hUDCanvas != (Object)null) { _hudVisible = !_hudVisible; hUDCanvas.SetActive(_hudVisible); } } } if (!Input.GetKeyDown(_screenshot.Value)) { return; } try { string text = Path.Combine(Paths.BepInExRootPath, "screenshots"); Directory.CreateDirectory(text); string path = $"screenshot_{DateTime.Now:yyyy-MM-dd_HH-mm-ss_fff}.png"; string text2 = Path.Combine(text, path); MenuManager instance3 = MenuManager.instance; if (instance3 != null) { instance3.MenuEffectClick((MenuClickEffectType)0, (MenuPage)null, -1f, -1f, true); } MenuManager instance4 = MenuManager.instance; if (instance4 != null) { instance4.MenuEffectHover(-1f, -1f); } ScreenCapture.CaptureScreenshot(text2); Logger.LogMessage((object)("Screenshot saved: " + text2)); } catch (IOException arg) { Logger.LogError((object)$"Failed to save screenshot: {arg}"); } catch (UnauthorizedAccessException arg2) { Logger.LogError((object)$"Failed to save screenshot: {arg2}"); } catch (ArgumentException arg3) { Logger.LogError((object)$"Failed to save screenshot: {arg3}"); } } public static bool TryGetHit(Vector3 position, Vector3 forward, out RaycastHit hit, float maxDistance = 100f, int layerMask = -5) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) forward = ((Vector3)(ref forward)).normalized; return Physics.Raycast(position, forward, ref hit, maxDistance, layerMask, (QueryTriggerInteraction)1); } private static GameObject? GetHUDCanvas() { GameObject[] array = (from t in Resources.FindObjectsOfTypeAll() where ((Object)t).name == "HUD Canvas" select ((Component)t).gameObject).ToArray(); return (array.Length == 0) ? null : array[0]; } private static bool IsInPlayableLevel(out PlayerController playerController) { playerController = null; if (!LevelGenerator.Instance.Generated) { return false; } if (!TryGetLocalPlayerController(out playerController)) { return false; } return true; } private static bool TryGetLocalPlayerController(out PlayerController pc) { pc = null; PlayerController instance = PlayerController.instance; if ((Object)(object)instance != (Object)null && ((Behaviour)instance).isActiveAndEnabled && ((Component)instance).gameObject.activeInHierarchy) { pc = instance; return true; } return false; } private void ToggleCameraDetachment(PlayerController player) { _hudVisible = true; if (!_camDetached) { DetachCamera(player); } else { ReattachCamera(); } } private void DetachCamera(PlayerController player) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) if (!TryGetPlayersViewCamera(player, out Camera cam)) { Logger.LogWarning((object)"ToggleDetachGameplayCamera: Couldn't find player's view camera."); return; } _gameCam = cam; _camDetached = true; _fovOffset = 0f; _smoothedFov = _fov.Value; _targetPosition = ((Component)cam).transform.position; _targetRotation = ((Component)cam).transform.rotation; _currentMoveSpeed = _moveSpeed.Value; _cameraParent = ((Component)cam).transform.parent; _cameraLocalPosition = ((Component)cam).transform.localPosition; _cameraLocalRotation = ((Component)cam).transform.localRotation; ((Component)cam).transform.SetParent((Transform)null, true); if (!_resetPosition.Value && _lastDetachedPosition.HasValue && _lastDetachedRotation.HasValue) { ((Component)cam).transform.position = _lastDetachedPosition.Value; ((Component)cam).transform.rotation = _lastDetachedRotation.Value; _targetPosition = _lastDetachedPosition.Value; _targetRotation = _lastDetachedRotation.Value; } _eyesLookAtPosition = ((Component)cam).transform.position; GameObject? hUDCanvas = GetHUDCanvas(); if (hUDCanvas != null) { hUDCanvas.SetActive(_hudVisible); } ManualLogSource logger = Logger; object arg = ((Component)cam).transform.position; Quaternion rotation = ((Component)cam).transform.rotation; logger.LogMessage((object)$"Camera detached at world pos={arg} rot={((Quaternion)(ref rotation)).eulerAngles}"); } private void ReattachCamera() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_gameCam == (Object)null) { _camDetached = false; Logger.LogWarning((object)"ToggleDetachGameplayCamera: Missing cached camera; resetting state."); return; } _lastDetachedPosition = ((Component)_gameCam).transform.position; _lastDetachedRotation = ((Component)_gameCam).transform.rotation; Transform transform = ((Component)_gameCam).transform; if ((Object)(object)_cameraParent != (Object)null) { transform.SetParent(_cameraParent, false); transform.localPosition = _cameraLocalPosition; transform.localRotation = _cameraLocalRotation; } else { Logger.LogWarning((object)"ToggleDetachGameplayCamera: Original parent was null/missing; leaving camera unparented."); } _camDetached = false; _cameraControlActive = false; GameObject? hUDCanvas = GetHUDCanvas(); if (hUDCanvas != null) { hUDCanvas.SetActive(true); } Logger.LogMessage((object)"Camera reattached and restored."); } private static bool TryGetPlayersViewCamera(PlayerController player, out Camera cam) { cam = null; Camera componentInChildren = ((Component)player).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null && ((Behaviour)componentInChildren).isActiveAndEnabled && ((Component)componentInChildren).gameObject.activeInHierarchy) { cam = componentInChildren; return true; } if ((Object)(object)Camera.main != (Object)null && ((Behaviour)Camera.main).isActiveAndEnabled && ((Component)Camera.main).gameObject.activeInHierarchy) { cam = Camera.main; return true; } return false; } private void DriveThirdPersonAvatar() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar instance = PlayerAvatar.instance; if ((Object)(object)instance == (Object)null) { return; } PlayerAvatarVisuals playerAvatarVisuals = instance.playerAvatarVisuals; if (!((Object)(object)playerAvatarVisuals == (Object)null)) { playerAvatarVisuals.ShowSelfOverride(0.1f); if ((Object)(object)CameraPosition.instance != (Object)null) { CameraPosition.instance.OverridePosition(((Component)instance).transform.position, 0.1f); } if ((Object)(object)PhysGrabber.instance != (Object)null && (Object)(object)_aimAnchor != (Object)null && (Object)(object)CameraAim.Instance != (Object)null) { _aimAnchor.transform.rotation = ((Component)CameraAim.Instance).transform.rotation; PhysGrabber.instance.OverrideAimTransform(_aimAnchor.transform, 0.1f); } if ((Object)(object)playerAvatarVisuals.playerEyes != (Object)null) { playerAvatarVisuals.playerEyes.Override(_eyesLookAtPosition, 0.1f, ((Component)this).gameObject); } } } private void OnDestroy() { if ((Object)(object)_aimAnchor != (Object)null) { Object.Destroy((Object)(object)_aimAnchor); _aimAnchor = null; } } } }