using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using CommonAPI; using DG.Tweening; using Microsoft.CodeAnalysis; using Reptile; using Rewired; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("CarJack.Common")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+378538fa9503b5513da6dbe7c4c8fe62d1c5de3d")] [assembly: AssemblyProduct("CarJack.Common")] [assembly: AssemblyTitle("CarJack.Common")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CarJack.Common { public class CarAssets { public CarBundle MainBundle; public List Bundles; public string MainBundlePath; public string AddonBundlePath; public string PluginDirectoryName; public static CarAssets Instance { get; private set; } public CarAssets() { Bundles = new List(); Instance = this; } public void UnloadAllBundles() { foreach (CarBundle bundle in Bundles) { bundle.Bundle.Unload(true); } Bundles = new List(); } public void LoadBundles() { MainBundle = new CarBundle(MainBundlePath); Bundles.Add(MainBundle); string[] files = Directory.GetFiles(AddonBundlePath, "*.carbundle", SearchOption.AllDirectories); foreach (string text in files) { if (IsPathInsidePluginFolder(text)) { Debug.LogWarning((object)("CarJack Warning: Skipped loading car bundle \"" + text + "\" because it's in the same folder as the CarJack plugin. Car bundles should be placed in their own subfolder inside the plugins folder.")); continue; } try { CarBundle item = new CarBundle(text); Bundles.Add(item); } catch (Exception arg) { Debug.LogError((object)$"CarJack Error: Failed to load car bundle \"{text}\".\nException:\n{arg}"); } } } private bool IsPathInsidePluginFolder(string path) { if (string.IsNullOrEmpty(PluginDirectoryName)) { return false; } path = CleanPath(path); string value = CleanPath(Path.Combine(AddonBundlePath, PluginDirectoryName)); if (path.StartsWith(value)) { return true; } return false; } private string CleanPath(string path) { path = path.Replace('\\', '/').ToLowerInvariant().Trim(); while (path.EndsWith("/") && path.Length > 1) { path = path.Substring(0, path.Length - 1); } return path; } } [RequireComponent(typeof(AudioSource))] public class CarAudioSource : MonoBehaviour { public enum AudioTypes { Master = 0, Music = 4, SFX = 1, UI = 2, Gameplay = 3, Voices = 5, Ambience = 6 } public AudioTypes AudioType = AudioTypes.Gameplay; private DrivableCar _car; private AudioSource _audioSource; private void Awake() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown _car = ((Component)this).GetComponentInParent(); _audioSource = ((Component)this).GetComponent(); _audioSource.outputAudioMixerGroup = Core.Instance.AudioManager.mixerGroups[(int)AudioType]; Core.OnCoreUpdatePaused += new OnCoreUpdateHandler(OnPause); Core.OnCoreUpdateUnPaused += new OnCoreUpdateUnpausedHandler(OnUnPause); } private void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown Core.OnCoreUpdatePaused -= new OnCoreUpdateHandler(OnPause); Core.OnCoreUpdateUnPaused -= new OnCoreUpdateUnpausedHandler(OnUnPause); } private void OnPause() { _audioSource.mute = true; } private void OnUnPause() { _audioSource.mute = false; } private void Update() { if (!Core.Instance.IsCorePaused) { CarCamera instance = CarCamera.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.Target != (Object)(object)_car) { _audioSource.spatialBlend = 1f; } else { _audioSource.spatialBlend = 0f; } } } } public class CarBundle { public string Name; public AssetBundle Bundle; public CarBundle(string path) { Name = Path.GetFileNameWithoutExtension(path); Bundle = AssetBundle.LoadFromFile(path); if ((Object)(object)Bundle == (Object)null) { throw new IOException("AssetBundle.LoadFromFile returned null!"); } } } public class CameraBlocker { public bool Enabled; } public class CarCamera : MonoBehaviour { public static List Blockers = new List(); public float Radius = 0.1f; public float MaxLerpSpeed = 5f; public float MaxLerpSpeedJoystick = 2f; public float FreeCameraTimer = 1f; public LayerMask ObstructionMask; public float LerpMultiplier = 0.15f; public float Distance = 7f; public float Height = 2f; public float Fov = 60f; public DrivableCar Target; private bool _controller; private float _xAxis; private float _yAxis; private bool _wasLookingBehind; private bool _lookBehind; private float _currentFreeCameraTimer; private float _currentJumpAnimation; private bool _inJumpAnimation; public float JumpAnimationDistance = 1f; public float JumpAnimationHeight = 0.5f; public float JumpAnimationMinSpeed = 10f; public float JumpAnimationBeginSpeed = 1f; public float JumpAnimationLandSpeed = 5f; public float JumpAnimationFov = 2f; private float _currentSpeedAnimation; public float SpeedAnimationDistance = 3f; public float SpeedAnimationFov = 10f; public float SpeedAnimationMinSpeed = 20f; public float SpeedAnimationMaxSpeed = 80f; public float SpeedAnimationSpeed = 5f; private float _currentBrakeAnimation; private bool _onBrakeAnimation; public float BrakeAnimationThreshold = 0.5f; public float BrakeAnimationSpeed = 1f; public float BrakeAnimationStopSpeed = 0.2f; public float BrakeAnimationDistance = -1f; public float BrakeAnimationFov = -2f; private Camera _camera; private float _lastFwSpeed; public static bool Enabled => Blockers.Where((CameraBlocker blocker) => blocker.Enabled).Count() == 0; public static CarCamera Instance { get; private set; } private void Awake() { Instance = this; _camera = ((Component)this).GetComponent(); } private void OnDestroy() { _camera.fieldOfView = 64f; } private void ResetInputs() { _controller = false; _xAxis = 0f; _yAxis = 0f; _lookBehind = false; } private void PollInputs() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 ResetInputs(); GameInput gameInput = Core.Instance.GameInput; _xAxis = gameInput.GetAxis(13, 0); _yAxis = gameInput.GetAxis(14, 0); _lookBehind = gameInput.GetButtonHeld(12, 0); if ((int)gameInput.GetCurrentControllerType(0) == 2) { if (!CarController.Config.MouseCameraControlsOnController) { _currentFreeCameraTimer = 0f; } _controller = true; } if ((_xAxis != 0f || _yAxis != 0f) && (!_controller || CarController.Config.MouseCameraControlsOnController)) { _currentFreeCameraTimer = FreeCameraTimer; } } private void UpdateBrakeAnimation() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) Vector3 velocity = Target.Rigidbody.velocity; float magnitude = ((Vector3)(ref velocity)).magnitude; float num = 0f; float num2 = magnitude - _lastFwSpeed; float num3 = 0f - num2; float num4 = num2; if (num4 <= 0f) { num4 = 0f; } if (num3 <= 0f) { num3 = 0f; } if (num3 >= BrakeAnimationThreshold) { _onBrakeAnimation = true; } else if (num4 >= 0f) { _onBrakeAnimation = false; } if (magnitude > 10f && (Target.BrakeHeld || Target.ThrottleAxis < -0.5f)) { _onBrakeAnimation = true; } if (Target.AllWheelsOffGround) { _onBrakeAnimation = false; } if (_onBrakeAnimation) { num = 1f; } if (num == 1f) { _currentBrakeAnimation = Mathf.Lerp(_currentBrakeAnimation, num, BrakeAnimationSpeed * Time.deltaTime); } else { _currentBrakeAnimation = Mathf.Lerp(_currentBrakeAnimation, num, (BrakeAnimationStopSpeed + num4) * Time.deltaTime); } _lastFwSpeed = magnitude; } private void UpdateSpeedAnimation() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) float num = 0f; float num2 = Vector3.Dot(Target.Rigidbody.velocity, ((Component)this).transform.forward); if (num2 >= SpeedAnimationMinSpeed) { float num3 = SpeedAnimationMaxSpeed - SpeedAnimationMinSpeed; float num4 = num2 - SpeedAnimationMinSpeed; num = Mathf.Min(1f, num4 / num3); } _currentSpeedAnimation = Mathf.Lerp(_currentSpeedAnimation, num, SpeedAnimationSpeed * Time.deltaTime); if (_currentSpeedAnimation <= 0f) { _currentSpeedAnimation = 0f; } } private void UpdateJumpAnimation() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (Target is DrivableChopper) { return; } if (Target.AllWheelsOffGround) { if (Target.Rigidbody.velocity.y >= JumpAnimationMinSpeed) { _inJumpAnimation = true; } } else { _inJumpAnimation = false; } if (_inJumpAnimation) { _currentJumpAnimation = Mathf.Lerp(_currentJumpAnimation, 1f, JumpAnimationBeginSpeed * Time.deltaTime); } else { _currentJumpAnimation = Mathf.Lerp(_currentJumpAnimation, 0f, JumpAnimationLandSpeed * Time.deltaTime); } } private void Update() { //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: 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_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0360: 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_0369: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_0507: 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_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: 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_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) if (!Enabled || Core.Instance.IsCorePaused || (Object)(object)Target == (Object)null) { return; } UpdateJumpAnimation(); UpdateBrakeAnimation(); UpdateSpeedAnimation(); PollInputs(); float aimSensitivity = Core.Instance.SaveManager.Settings.gameplaySettings.aimSensitivity; bool invertY = Core.Instance.SaveManager.Settings.gameplaySettings.invertY; float num = Mathf.Lerp(0.75f, 1.8f, aimSensitivity); float num2 = MaxLerpSpeed; _currentFreeCameraTimer = Mathf.Max(_currentFreeCameraTimer - Time.deltaTime, 0f); if (_controller) { _xAxis *= Time.deltaTime * 100f; _yAxis *= Time.deltaTime * 100f; } Quaternion val; if ((_controller && !CarController.Config.MouseCameraControlsOnController) || _currentFreeCameraTimer > 0f) { if (_controller && !CarController.Config.MouseCameraControlsOnController && (_xAxis != 0f || _yAxis != 0f)) { num2 = MaxLerpSpeedJoystick; } val = ((Component)this).transform.rotation; Vector3 eulerAngles = ((Quaternion)(ref val)).eulerAngles; eulerAngles.y += _xAxis * num; eulerAngles.x += _yAxis * num * (float)(invertY ? 1 : (-1)); eulerAngles.z = 0f; eulerAngles.x = ConvertTo180Rotation(eulerAngles.x); eulerAngles.x = Mathf.Max(-80f, eulerAngles.x); eulerAngles.x = Mathf.Min(80f, eulerAngles.x); ((Component)this).transform.rotation = Quaternion.Euler(eulerAngles); } Vector3 velocity = Target.Rigidbody.velocity; float num3 = Vector3.Dot(Target.Rigidbody.velocity, ((Component)Target).transform.forward); if (Target is DrivableChopper) { velocity.y = 0f; } Vector3 normalized = ((Vector3)(ref velocity)).normalized; Quaternion val2 = ((Component)this).transform.rotation; if (num3 > 1f) { Vector3 val3 = Vector3.Lerp(normalized, ((Component)Target).transform.forward, 0.5f); normalized = ((Vector3)(ref val3)).normalized; } if (((Vector3)(ref normalized)).magnitude > float.Epsilon && !Target.Still) { val2 = Quaternion.LookRotation(normalized, Vector3.up); Vector3 eulerAngles2 = ((Quaternion)(ref val2)).eulerAngles; eulerAngles2.x += Target.ExtraPitch; val2 = Quaternion.Euler(eulerAngles2); } val = Quaternion.Lerp(((Component)this).transform.rotation, val2, Mathf.Min(num2, LerpMultiplier * ((Vector3)(ref velocity)).magnitude) * Time.deltaTime); Vector3 eulerAngles3 = ((Quaternion)(ref val)).eulerAngles; if (_currentFreeCameraTimer <= 0f) { ((Component)this).transform.rotation = Quaternion.Euler(eulerAngles3.x, eulerAngles3.y, 0f); } if (_lookBehind) { ((Component)this).transform.rotation = Quaternion.LookRotation(-((Component)Target).transform.forward, Vector3.up); val = ((Component)this).transform.rotation; Vector3 eulerAngles4 = ((Quaternion)(ref val)).eulerAngles; eulerAngles4.x += Target.ExtraPitch; ((Component)this).transform.rotation = Quaternion.Euler(eulerAngles4); _wasLookingBehind = true; } else if (_wasLookingBehind) { ((Component)this).transform.rotation = Quaternion.LookRotation(((Component)Target).transform.forward, Vector3.up); val = ((Component)this).transform.rotation; Vector3 eulerAngles5 = ((Quaternion)(ref val)).eulerAngles; eulerAngles5.x += Target.ExtraPitch; ((Component)this).transform.rotation = Quaternion.Euler(eulerAngles5); _wasLookingBehind = false; } float num4 = Distance + Target.ExtraDistance; float num5 = Height + Target.ExtraHeight; float fov = Fov; num4 += _currentJumpAnimation * JumpAnimationDistance; num5 += _currentJumpAnimation * JumpAnimationHeight; fov += _currentJumpAnimation * JumpAnimationFov; num4 += _currentSpeedAnimation * SpeedAnimationDistance; fov += _currentSpeedAnimation * SpeedAnimationFov; num4 += _currentBrakeAnimation * BrakeAnimationDistance; fov += _currentBrakeAnimation * BrakeAnimationFov; Vector3 val4 = ((Component)Target).transform.position + num5 * Vector3.up; Vector3 position = val4 - ((Component)this).transform.forward * num4; RaycastHit val5 = default(RaycastHit); if (Physics.Raycast(new Ray(val4, -((Component)this).transform.forward), ref val5, num4 + Radius, LayerMask.op_Implicit(ObstructionMask))) { position = val4 - ((Component)this).transform.forward * (((RaycastHit)(ref val5)).distance - Radius); } ((Component)this).transform.position = position; _camera.fieldOfView = fov; } private float ConvertTo180Rotation(float rotation) { if (rotation > 180f) { rotation -= 360f; } return rotation; } public void SetTarget(DrivableCar target) { Target = target; } } public class CarController : MonoBehaviour { [CompilerGenerated] private static class <>O { public static OnStageInitializedDelegate <0>__StageManager_OnStageInitialized; } public static ICarConfig Config; public static Action OnPlayerExitingCar; public static Action OnPlayerEnteredCar; public DrivableCar CurrentCar; public CarPassengerSeat CurrentSeat; public static Action OnPlayerVisualUpdated; public static CarController Instance { get; private set; } public static void Initialize(ICarConfig config) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown Config = config; object obj = <>O.<0>__StageManager_OnStageInitialized; if (obj == null) { OnStageInitializedDelegate val = StageManager_OnStageInitialized; <>O.<0>__StageManager_OnStageInitialized = val; obj = (object)val; } StageManager.OnStageInitialized += (OnStageInitializedDelegate)obj; } private static void StageManager_OnStageInitialized() { Create(); CreateResources(); } private static void CreateResources() { Object.Instantiate(CarAssets.Instance.MainBundle.Bundle.LoadAsset("Car Resources")); } public static CarController Create() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return new GameObject("Car Controller").AddComponent(); } private void Awake() { Instance = this; } private void Update() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (!Core.Instance.IsCorePaused && (Object)(object)CurrentCar != (Object)null) { Player currentPlayer = WorldHandler.instance.GetCurrentPlayer(); if ((Object)(object)CurrentSeat != (Object)null) { ((Component)currentPlayer).transform.position = ((Component)CurrentSeat).transform.position; } else { ((Component)currentPlayer).transform.position = ((Component)CurrentCar).transform.position; } Vector3 val = ((Component)CurrentCar).transform.forward - Vector3.Project(((Component)CurrentCar).transform.forward, Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; currentPlayer.SetRotHard(Quaternion.LookRotation(normalized, Vector3.up)); UpdatePhoneInCar(); } } private void UpdatePhoneInCar() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Invalid comparison between Unknown and I4 //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Invalid comparison between Unknown and I4 GameInput gameInput = Core.Instance.GameInput; Player currentPlayer = WorldHandler.instance.GetCurrentPlayer(); if (currentPlayer.phone.IsOn) { currentPlayer.phone.PhoneUpdate(); } else if ((int)gameInput.GetCurrentControllerType(0) == 0 && CurrentCar.Driving) { if (gameInput.GetButtonNew(17, 0) && !currentPlayer.IsBusyWithSequence() && !currentPlayer.phoneLocked && currentPlayer.phone.m_PhoneAllowed && ((int)currentPlayer.phone.state == 0 || (int)currentPlayer.phone.state == 1 || (int)currentPlayer.phone.state == 3)) { currentPlayer.phone.audioManager.PlaySfxGameplay((SfxCollectionID)23, (AudioClipID)284, 0f); currentPlayer.phone.TurnOn(); } } else { currentPlayer.phone.PhoneUpdate(); } } private CarCamera MakeCamera(GameObject go) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) CarCamera carCamera = go.AddComponent(); carCamera.ObstructionMask = LayerMask.op_Implicit(31); return carCamera; } public void EnterCarAsPassenger(DrivableCar car, int seatIndex) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)CurrentCar != (Object)null) { CurrentCar.Driving = false; CurrentCar.InCar = false; } CarPassengerSeat passengerSeat = car.GetPassengerSeat(seatIndex); CurrentCar = car; CurrentSeat = passengerSeat; car.Driving = false; car.InCar = true; Player currentPlayer = WorldHandler.instance.GetCurrentPlayer(); currentPlayer.phone.TurnOff(false); currentPlayer.StopHoldSpraycan(); currentPlayer.characterVisual.SetPhone(false); car.GroundMask = currentPlayer.motor.groundDetection.groundMask; currentPlayer.DisablePlayer(); currentPlayer.CompletelyStop(); ((Component)currentPlayer).gameObject.SetActive(false); ((Component)currentPlayer.interactionCollider).transform.parent = ((Component)passengerSeat).transform; ((Component)currentPlayer.interactionCollider).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); GameplayCamera instance = GameplayCamera.instance; ((Behaviour)instance).enabled = false; CarCamera carCamera = ((Component)instance).GetComponent(); if ((Object)(object)carCamera == (Object)null) { carCamera = MakeCamera(((Component)instance).gameObject); } carCamera.SetTarget(car); currentPlayer.FlushInput(); passengerSeat.PutInSeat(currentPlayer); OnPlayerEnteredCar?.Invoke(); } public void EnterCar(DrivableCar car) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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) Player currentPlayer = WorldHandler.instance.GetCurrentPlayer(); Vector3 velocity = currentPlayer.GetVelocity(); if ((Object)(object)CurrentCar != (Object)null) { CurrentCar.Driving = false; CurrentCar.InCar = false; velocity = CurrentCar.Rigidbody.velocity; } CurrentCar = car; CurrentSeat = null; car.Driving = true; car.InCar = true; currentPlayer.phone.TurnOff(false); currentPlayer.StopHoldSpraycan(); currentPlayer.characterVisual.SetPhone(false); car.GroundMask = currentPlayer.motor.groundDetection.groundMask; currentPlayer.DisablePlayer(); currentPlayer.CompletelyStop(); ((Component)currentPlayer).gameObject.SetActive(false); ((Component)currentPlayer.interactionCollider).transform.parent = ((Component)car).transform; ((Component)currentPlayer.interactionCollider).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); GameplayCamera instance = GameplayCamera.instance; ((Behaviour)instance).enabled = false; CarCamera component = ((Component)instance).GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } component = MakeCamera(((Component)instance).gameObject); component.SetTarget(car); currentPlayer.FlushInput(); car.EnterCar(currentPlayer); car.Rigidbody.velocity = velocity; OnPlayerEnteredCar?.Invoke(); } public void ExitCar() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) DrivableCar currentCar = CurrentCar; if (!((Object)(object)CurrentCar == (Object)null)) { OnPlayerExitingCar?.Invoke(); Vector3 velocity = CurrentCar.Rigidbody.velocity; bool flag = false; if (CurrentCar.Driving) { CurrentCar.ExitCar(); } else { flag = true; CurrentSeat.ExitSeat(); } CurrentCar.Driving = false; CurrentCar.InCar = false; CurrentSeat = null; CurrentCar = null; GameplayCamera instance = GameplayCamera.instance; ((Behaviour)instance).enabled = true; CarCamera component = ((Component)instance).GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Player currentPlayer = WorldHandler.instance.GetCurrentPlayer(); ((Component)currentPlayer).gameObject.SetActive(true); Transform parent = ((Component)currentPlayer).transform.Find("RootObject"); ((Component)currentPlayer.interactionCollider).transform.parent = parent; ((Component)currentPlayer.interactionCollider).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); ((Component)currentPlayer.characterVisual).transform.SetAsLastSibling(); currentPlayer.EnablePlayer(false); instance.ResetCameraPositionRotation(); currentPlayer.SetVelocity(velocity); if (!flag) { Object.Destroy((Object)(object)((Component)currentCar).gameObject); } } } } public static class CarDatabase { public static Dictionary CarByInternalName; public static void Initialize() { CarByInternalName = new Dictionary(); foreach (CarBundle bundle in CarAssets.Instance.Bundles) { LoadBundle(bundle); } } private static void LoadBundle(CarBundle bundle) { foreach (GameObject item in (from x in bundle.Bundle.LoadAllAssets() where (Object)(object)x.GetComponent() != (Object)null select x).ToList()) { DrivableCar component = item.GetComponent(); CarEntry carEntry = new CarEntry(); carEntry.Bundle = bundle; carEntry.Prefab = item; CarByInternalName[component.InternalName] = carEntry; } } } public class CarDriverSeat : CarSeat { public int HonkLayerIndex = -1; public int ReverseLayerIndex = -1; public float ReverseAnimationLerp = 10f; public float HonkAnimationLerp = 20f; public float SteerAnimationLerp = 5f; private float _currentSteer = 0.5f; private float _currentHonk; private float _currentReverse; private void Update() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)CurrentVisual == (Object)null)) { float num = Car.SteerAxis * 0.5f + 0.5f; _currentSteer = Mathf.Lerp(_currentSteer, num, SteerAnimationLerp * Time.deltaTime); CurrentVisual.anim.SetFloat("Steer", _currentSteer); float num2 = 0f; float num3 = 0f; if (Vector3.Dot(Car.Rigidbody.velocity, ((Component)Car).transform.forward) <= -1f && Car.ThrottleAxis < 0f && Car.Grounded) { num3 = 1f; } if (Car.HornHeld) { num2 = 1f; } _currentHonk = Mathf.Lerp(_currentHonk, num2, HonkAnimationLerp * Time.deltaTime); _currentReverse = Mathf.Lerp(_currentReverse, num3, ReverseAnimationLerp * Time.deltaTime); if (HonkLayerIndex != -1) { CurrentVisual.anim.SetLayerWeight(HonkLayerIndex, _currentHonk); } if (ReverseLayerIndex != -1) { CurrentVisual.anim.SetLayerWeight(ReverseLayerIndex, _currentReverse); } } } } public class CarEntry { public CarBundle Bundle; public GameObject Prefab; } public class CarPassengerSeat : CarSeat { public int SeatIndex; protected override void Awake() { base.Awake(); BoxCollider componentInChildren = ((Component)this).GetComponentInChildren(); if (!((Object)(object)componentInChildren == (Object)null)) { ((Component)componentInChildren).gameObject.AddComponent().Initialize(this); } } } public class CarResources : MonoBehaviour { public AudioClip[] CrashSFX; public static CarResources Instance { get; private set; } private void Awake() { Instance = this; } public AudioClip GetCrashSFX() { return CrashSFX[Random.Range(0, CrashSFX.Length)]; } } public abstract class CarSeat : MonoBehaviour { [CompilerGenerated] private sealed class d__14 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public CarSeat <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown int num = <>1__state; CarSeat carSeat = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; carSeat.CloseEyes(carSeat.CurrentVisual); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; case 1: <>1__state = -1; carSeat.OpenEyes(carSeat.CurrentVisual); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public bool PlayerVisible = true; public RuntimeAnimatorController controller; [NonSerialized] public DrivableCar Car; private float _blinkTimer; private const float BlinkDuration = 0.1f; public Player Player; protected CharacterVisual CurrentVisual; protected virtual void Awake() { Car = ((Component)this).GetComponentInParent(); ResetBlinkTimer(); } private void ResetBlinkTimer() { _blinkTimer = Random.Range(2, 4); } public void PutInSeat(Player player) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) Player = player; if (PlayerVisible) { CurrentVisual = VisualFromPlayer(player, controller); ((Component)CurrentVisual).GetComponentInChildren().runtimeAnimatorController = controller; ((Component)CurrentVisual).transform.SetParent(((Component)this).transform); ((Component)CurrentVisual).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); } } public void ExitSeat() { Player = null; if ((Object)(object)CurrentVisual != (Object)null) { ((MonoBehaviour)this).StopAllCoroutines(); Object.Destroy((Object)(object)((Component)CurrentVisual).gameObject); } } public void UpdateVisual() { Player player = Player; ExitSeat(); PutInSeat(player); } private CharacterVisual VisualFromPlayer(Player player, RuntimeAnimatorController controller) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate(((Component)player.characterVisual).gameObject); obj.SetActive(true); CharacterVisual component = obj.GetComponent(); ((Renderer)component.mainRenderer).enabled = true; component.SetMoveStyleVisualAnim((Player)null, (MoveStyle)0, (GameObject)null); component.SetMoveStyleVisualProps((Player)null, (MoveStyle)0, false); component.SetSpraycan(false, (Characters)(-1)); component.SetPhone(false); component.SetBoostpackEffect((BoostpackEffectMode)0, -1f); component.VFX.boostpackTrail.SetActive(false); component.Init((Characters)(-1), controller, false, 0f); component.canBlink = player.characterVisual.canBlink; component.characterObject.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); OpenEyes(component); return component; } private void LateUpdate() { if (!Core.Instance.IsCorePaused && !((Object)(object)CurrentVisual == (Object)null) && CurrentVisual.canBlink) { _blinkTimer -= Time.deltaTime; if (_blinkTimer <= 0f) { ResetBlinkTimer(); ((MonoBehaviour)this).StartCoroutine(DoBlink()); } } } [IteratorStateMachine(typeof(d__14))] private IEnumerator DoBlink() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__14(0) { <>4__this = this }; } private void CloseEyes(CharacterVisual visual) { if (visual.canBlink && visual.mainRenderer.sharedMesh.blendShapeCount > 0) { visual.mainRenderer.SetBlendShapeWeight(0, 100f); } } private void OpenEyes(CharacterVisual visual) { if (visual.canBlink && visual.mainRenderer.sharedMesh.blendShapeCount > 0) { visual.mainRenderer.SetBlendShapeWeight(0, 0f); } } } public class CarWheel : MonoBehaviour { [NonSerialized] public bool Grounded; [Header("Suspension")] public float Damping; public float Strength; public float StartLength; public float MaxDistance; public float RestDistance; [Header("Visuals")] public GameObject Mesh; public float MeshRadius = 0.5f; public float RotationAcceleration = 100f; public float RotationDeacceleration = 1f; public float RotationMultiplier = 1f; [Header("Stats")] public float Mass = 10f; public float Traction = 0.5f; public float SteerAngle = 45f; public float SteerSpeed = 5f; public float ReverseSpeed = 400f; public float Speed = 10f; [Header("Functionality")] public bool Throttle; public bool Steer; public bool HandBrake; [NonSerialized] public float CurrentSpeed; private float _currentRoll; private float _currentSteerAngle; private DrivableCar _car; private float SlipSpeed = 5f; private const float MinimumSidewaysSpeedForSlip = 4f; private const float SidewaysSlipMultiplier = 0.05f; private const float MaximumSuspensionOffsetForRest = 0.5f; private float _currentSlip; private const float WheelSpinSlip = 0.35f; private const float WheelSpinSlipThreshold = 5f; private const float MaxSlipTractionLoss = 0.9f; public float CurrentDistance { get; private set; } public float Slipping => _currentSlip; public void Initialize(DrivableCar car) { _car = car; } private void OnDrawGizmos() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = Color.white; Gizmos.DrawWireSphere(((Component)this).transform.position, MeshRadius); Gizmos.color = Color.red; Gizmos.DrawLine(((Component)this).transform.position + ((Component)this).transform.up * StartLength, ((Component)this).transform.position - ((Component)this).transform.up * MaxDistance); Gizmos.color = Color.green; Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position - ((Component)this).transform.up * RestDistance); } public void DoPhysics(ref bool resting) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) CalculateSlip(); bool flag = false; if (_car.HasSurfaceAngleLimit && Vector3.Angle(Vector3.up, ((Component)this).transform.up) >= _car.SurfaceAngleLimit) { flag = true; resting = false; } CurrentDistance = MaxDistance; Grounded = false; RaycastHit val = default(RaycastHit); if (Physics.Raycast(new Ray(((Component)this).transform.position + ((Component)this).transform.up * StartLength, -((Component)this).transform.up), ref val, MaxDistance + StartLength, LayerMask.op_Implicit(_car.GroundMask))) { CurrentDistance = ((RaycastHit)(ref val)).distance - StartLength; Grounded = true; float num = RestDistance - CurrentDistance; float num2 = Vector3.Dot(_car.Rigidbody.GetPointVelocity(((Component)this).transform.position), ((Component)this).transform.up); float num3 = num * Strength - num2 * Damping; if (flag) { num3 = Mathf.Max(num3, 0f); } else if (Mathf.Abs(num) > 0.5f) { resting = false; } if (!_car.Still) { _car.Rigidbody.AddForceAtPosition(((Component)this).transform.up * num3, ((Component)this).transform.position); } } if ((Object)(object)Mesh != (Object)null) { Mesh.transform.position = ((Component)this).transform.position - (CurrentDistance - MeshRadius) * ((Component)this).transform.up; } if (Grounded && !flag) { float traction = Traction; Vector3 pointVelocity = _car.Rigidbody.GetPointVelocity(((Component)this).transform.position); Vector3 val2 = pointVelocity - Vector3.Project(pointVelocity, ((Component)this).transform.up); float num4 = Evaluate(value: ((Vector3)(ref val2)).magnitude, curve: _car.TractionCurve, maxValue: _car.TractionCurveMax); traction *= num4; traction *= 0f - _currentSlip + 1f; traction = Mathf.Lerp(traction, 0.1f, _car.DriftingAmount); float num5 = (0f - Vector3.Dot(pointVelocity, ((Component)this).transform.right)) * traction / Time.fixedDeltaTime; _car.Rigidbody.AddForceAtPosition(((Component)this).transform.right * Mass * num5, ((Component)this).transform.position); } DoInput(flag); } private float Evaluate(AnimationCurve curve, float value, float maxValue) { value = Mathf.Abs(value); float num = Mathf.Min(value, maxValue) / maxValue; return curve.Evaluate(num); } private void CalculateSlip() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) Vector3 pointVelocity = _car.Rigidbody.GetPointVelocity(((Component)this).transform.position); float num = Vector3.Dot(pointVelocity, ((Component)this).transform.forward); float num2 = Mathf.Abs(CurrentSpeed - num); float num3 = 0f; if (num2 >= 5f) { num3 = 0.35f; } float num4 = Mathf.Abs(Vector3.Dot(pointVelocity, ((Component)this).transform.right)); num4 = Mathf.Max(0f, num4 - 4f); num3 += num4 * 0.05f * _car.SlipMultiplier; num3 = Mathf.Clamp(num3, 0f, 0.9f); if (_currentSlip < num3) { _currentSlip = num3; } _currentSlip = Mathf.Lerp(_currentSlip, num3, SlipSpeed * Time.deltaTime); } private void DoInput(bool tooSteep) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) Vector3 pointVelocity = _car.Rigidbody.GetPointVelocity(((Component)this).transform.position); Vector3 val = pointVelocity - Vector3.Project(pointVelocity, ((Component)this).transform.up); _ = ((Vector3)(ref val)).magnitude; float num = Vector3.Dot(pointVelocity, ((Component)this).transform.forward); float throttleAxis = _car.ThrottleAxis; float steerAxis = _car.SteerAxis; if (Grounded) { float num2 = 1f - Mathf.Abs(throttleAxis); if (num > 0f) { _car.Rigidbody.AddForceAtPosition(-((Component)this).transform.forward * _car.Deacceleration * num2, ((Component)this).transform.position); } else { _car.Rigidbody.AddForceAtPosition(((Component)this).transform.forward * _car.Deacceleration * num2, ((Component)this).transform.position); } } if (Throttle && (!Grounded || tooSteep) && Mathf.Abs(CurrentSpeed) < 100f) { CurrentSpeed += throttleAxis * RotationAcceleration * Time.deltaTime; } float num3 = Vector3.Dot(pointVelocity, ((Component)this).transform.forward); bool flag = ((num3 > 0.15f && throttleAxis < 0f) || (num3 < -0.15f && throttleAxis > 0f)) && !_car.Still; if (Grounded && !tooSteep) { bool flag2 = false; float speed = Speed; float num4 = Mathf.Min(Mathf.Abs(num), _car.SpeedCurveMax) / _car.SpeedCurveMax; float num5 = _car.SpeedCurve.Evaluate(num4); speed *= num5; if (throttleAxis < 0f) { speed = ReverseSpeed; num4 = Mathf.Min(Mathf.Abs(num), _car.ReverseCurveMax) / _car.ReverseCurveMax; num5 = _car.ReverseCurve.Evaluate(num4); speed *= num5; } Vector3 velocity; if (flag) { speed = _car.BrakeForce; velocity = _car.Rigidbody.velocity; if (((Vector3)(ref velocity)).magnitude <= 0.15f || _car.Still) { speed = 0f; } } float num6 = throttleAxis * speed; if (Throttle) { flag2 = true; } if (flag) { flag2 = true; } if (_car.BrakeHeld && HandBrake) { if (num3 > 0f) { num6 = 0f - _car.HandBrakeForce; } else if (num3 < 0f) { num6 = _car.HandBrakeForce; } velocity = _car.Rigidbody.velocity; if (((Vector3)(ref velocity)).magnitude <= 0.15f || _car.Still) { num6 = 0f; } flag2 = true; } if (flag2) { _car.Rigidbody.AddForceAtPosition(((Component)this).transform.forward * num6, ((Component)this).transform.position); } } if (Steer) { float steerAngle = SteerAngle; float num7 = Evaluate(_car.SteerCurve, num, _car.SteerCurveMax); float num8 = steerAngle * num7 * steerAxis; _ = _currentSteerAngle; float num9 = Mathf.Lerp(0.5f, 0.2f, Mathf.Min(num, 50f) / 50f); if (steerAxis == 0f) { num9 *= 2f; } _currentSteerAngle = Mathf.Lerp(_currentSteerAngle, num8, SteerSpeed * num9 * Time.deltaTime); float num10 = 0f; if (Grounded) { num10 = _car.CounterSteering; } ((Component)this).transform.localRotation = Quaternion.Euler(0f, _currentSteerAngle + num10, 0f); } } public void DoUpdate() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) if (Grounded) { float num = Vector3.Dot(_car.Rigidbody.GetPointVelocity(((Component)this).transform.position), ((Component)this).transform.forward); float num2 = Mathf.Abs(num); float num3 = Mathf.Abs(_car.ThrottleAxis); CurrentSpeed = num; if (num3 >= 0.9f && num2 <= num3 * 4f && Mathf.Sign(num) == Mathf.Sign(_car.ThrottleAxis) && Throttle) { CurrentSpeed = 50f * Mathf.Sign(_car.ThrottleAxis); } } else if (CurrentSpeed > 0f) { CurrentSpeed = Mathf.Max(CurrentSpeed - RotationDeacceleration * Time.deltaTime, 0f); } else { CurrentSpeed = Mathf.Min(CurrentSpeed + RotationDeacceleration * Time.deltaTime, 0f); } if (_car.BrakeHeld && HandBrake) { CurrentSpeed = 0f; } _currentRoll += CurrentSpeed * RotationMultiplier * Time.deltaTime; _currentRoll -= Mathf.Floor(_currentRoll / 360f) * 360f; Mesh.transform.localRotation = Quaternion.Euler(_currentRoll, 0f, 0f); } } public class DrivableCar : MonoBehaviour { [CompilerGenerated] private sealed class d__116 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Teleport teleport; public DrivableCar <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__116(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; DrivableCar drivableCar = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if ((Object)(object)((Component)teleport).GetComponent() == (Object)null) { drivableCar.DoForcedPause(); drivableCar.InputEnabled = false; if (teleport.automaticallyReturnPlayerToLastSafeLocation) { teleport.fadeToBlackDuration = teleport.fadeToBlackDurationDeathzone; teleport.blackDuration = teleport.blackDurationDeathzone; teleport.fadeOpenDuration = teleport.fadeOpenDurationDeathzone; } else { teleport.fadeToBlackDuration = teleport.fadeToBlackDurationDoor; teleport.blackDuration = teleport.blackDurationDoor; teleport.fadeOpenDuration = teleport.fadeOpenDurationDoor; } Tween val = Core.Instance.UIManager.effects.FadeToBlack(teleport.fadeToBlackDuration); <>2__current = TweenExtensions.WaitForCompletion(val); <>1__state = 1; return true; } break; case 1: <>1__state = -1; ((Component)Core.Instance.UIManager.effects.fullScreenFade).gameObject.SetActive(true); ((Graphic)Core.Instance.UIManager.effects.fullScreenFade).color = EffectsUI.niceBlack; <>2__current = (object)new WaitForSeconds(teleport.blackDuration); <>1__state = 2; return true; case 2: <>1__state = -1; drivableCar.UndoForcedPause(); if (teleport.automaticallyReturnPlayerToLastSafeLocation) { drivableCar.PlaceAtLastSafeLocation(); } else if ((Object)(object)teleport.teleportTo != (Object)null) { drivableCar.PlaceAt(teleport.teleportTo.position, teleport.teleportTo.rotation, teleport.giveSpeedAtSpawn); } drivableCar.InputEnabled = true; Core.Instance.UIManager.effects.FadeOpen(teleport.fadeOpenDuration); break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const int CurrentVersion = 1; [HideInInspector] [SerializeField] private int Version; [Header("Unique identifier")] public string InternalName = ""; [Header("How much the car should countersteer to avoid losing control")] public float CounterSteerMultiplier = 0.1f; [Header("How sensible the car is to sliding")] public float SlipMultiplier = 0.75f; public bool HasSurfaceAngleLimit = true; public float SurfaceAngleLimit = 60f; public float Deacceleration = 100f; public float DownForce = 0.5f; [Header("Curves based on the car's speed")] public AnimationCurve ReverseCurve; public float ReverseCurveMax = 50f; public float BrakeForce = 1000f; public float HandBrakeForce = 500f; public AnimationCurve SteerCurve; public float SteerCurveMax = 50f; public AnimationCurve SpeedCurve; public float SpeedCurveMax = 50f; public AnimationCurve TractionCurve; public float TractionCurveMax = 50f; public LayerMask GroundMask; public Transform CenterOfMass; [NonSerialized] public Rigidbody Rigidbody; [NonSerialized] public CarWheel[] Wheels; [NonSerialized] public GameObject Chassis; [NonSerialized] public bool Driving; [NonSerialized] public bool InCar; protected const float ControllerRotationDeadZone = 0.2f; [NonSerialized] public bool InputEnabled = true; [NonSerialized] public float ThrottleAxis; [NonSerialized] public float SteerAxis; [NonSerialized] public bool HornHeld; [NonSerialized] public bool GetOutOfCarButtonNew; [NonSerialized] public float PitchAxis; [NonSerialized] public float YawAxis; [NonSerialized] public float RollAxis; [NonSerialized] public bool BrakeHeld; [NonSerialized] public bool LockDoorsButtonNew; private Vector3 _velocityBeforePause; private Vector3 _angularVelocityBeforePause; private Vector3 _previousVelocity = Vector3.zero; private Vector3 _previousAngularVelocity = Vector3.zero; private OneShotAudioSource _oneShotAudioSource; private ScrapeAudio _scrapeAudio; private float _crashAudioCooldown; [NonSerialized] public CarDriverSeat DriverSeat; public Action OnHandleInput; [Header("Air Control")] public float AirControlStrength = 1f; public float AirControlTopSpeed = 2f; public float AirDeacceleration = 1f; [Header("How much you can alter the car's direction in the air.")] public float AirAerodynamics; [Header("Camera")] public float ExtraDistance; public float ExtraHeight; public float ExtraPitch; private bool _grounded; private bool _steep; private bool _resting; private const float LastSafeLocationInterval = 0.5f; private float _lastSafeLocationTimer = 0.5f; private Vector3 _prevLastSafePosition = Vector3.zero; private Quaternion _prevLastSafeRotation = Quaternion.identity; private Vector3 _lastSafePosition = Vector3.zero; private Quaternion _lastSafeRotation = Quaternion.identity; public const float MaximumSpeedForStill = 0.15f; private const float MaximumAngleForStill = 20f; private const float StillTime = 0.25f; private bool _still; private float _stillTimer; public const float MinimumSidewaysVelocityForDrift = 1f; public const float DriftMinimumAngle = 20f; public const float DriftingLerp = 5f; public const float DriftTraction = 0.1f; [NonSerialized] public float DriftingAmount; [NonSerialized] public float CounterSteering; [NonSerialized] public bool DoorsLocked; [NonSerialized] public bool AllWheelsOffGround; private CarPassengerSeat[] _passengerSeats; [NonSerialized] protected bool AllowAutoRecovery = true; private const float AutoRecoveryVelocityThreshold = 0.1f; private const float AutoRecoveryTime = 1f; private float _autoRecoveryTimer = 1f; private bool _forcedPause; public bool Grounded => _grounded; public bool Still => _still; public bool CustomGravity { get; private set; } public Vector3 CustomGravityInAir { get; private set; } = Vector3.zero; public Vector3 CustomGravityOnGround { get; private set; } = Vector3.zero; private void UpdateAutoRecovery() { if (!PlayerData.Instance.AutoRecover || !AllowAutoRecovery) { _autoRecoveryTimer = 1f; } else if (IsStuck()) { _autoRecoveryTimer -= Time.deltaTime; if (_autoRecoveryTimer <= 0f) { _autoRecoveryTimer = 1f; PlaceAtLastSafeLocation(); } } else { _autoRecoveryTimer = 1f; } } private bool IsStuck() { //IL_0006: 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) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Rigidbody.velocity; float magnitude = ((Vector3)(ref val)).magnitude; val = Rigidbody.angularVelocity; if (magnitude + ((Vector3)(ref val)).magnitude > 0.1f) { return false; } if (!AllWheelsOffGround && !_steep) { return false; } return true; } private void UpdateAirAero() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Dot(Rigidbody.velocity, ((Component)this).transform.forward); Vector3 val = Rigidbody.velocity - Vector3.Project(Rigidbody.velocity, ((Component)this).transform.forward); val = Vector3.Lerp(val, Vector3.zero, AirAerodynamics * Time.deltaTime); Rigidbody.velocity = val + num * ((Component)this).transform.forward; } private void UpdateCounterSteer() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) CounterSteering = 0f; Vector3 velocity = Rigidbody.velocity; if (!(((Vector3)(ref velocity)).magnitude < 5f)) { Vector3 forward = ((Component)this).transform.forward; velocity = Rigidbody.velocity; bool flag = Vector3.Dot(forward, ((Vector3)(ref velocity)).normalized) < 0f; Vector3 val = (flag ? (-((Component)this).transform.forward) : ((Component)this).transform.forward); velocity = Rigidbody.velocity; float num = Vector3.SignedAngle(val, ((Vector3)(ref velocity)).normalized, ((Component)this).transform.up); float num2 = CounterSteerMultiplier * (0f - Mathf.Abs(SteerAxis) + 1f); CounterSteering = num * num2 * (flag ? (-1f) : 1f); } } private void UpdateDrift() { float targetDrift = GetTargetDrift(); if (targetDrift < DriftingAmount) { DriftingAmount = Mathf.Lerp(DriftingAmount, targetDrift, 5f * Time.deltaTime); } else { DriftingAmount = targetDrift; } } private float GetTargetDrift() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Dot(Rigidbody.velocity, ((Component)this).transform.right); Vector3 forward = ((Component)this).transform.forward; Vector3 velocity = Rigidbody.velocity; bool flag = Vector3.Dot(forward, ((Vector3)(ref velocity)).normalized) < 0f; if (flag) { return 0f; } Vector3 val = (flag ? (-((Component)this).transform.forward) : ((Component)this).transform.forward); velocity = Rigidbody.velocity; float num2 = Vector3.Angle(val, ((Vector3)(ref velocity)).normalized); if (Mathf.Abs(num) < 1f) { return 0f; } if (num2 < 20f) { return 0f; } return Mathf.Abs(ThrottleAxis); } private void UpdateStill() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) _still = false; if (IsStill()) { if (_stillTimer >= 0.25f) { Rigidbody.velocity = Vector3.zero; Rigidbody.angularVelocity = Vector3.zero; Rigidbody.Sleep(); _still = true; } else { _stillTimer += Time.deltaTime; } } else { Rigidbody.WakeUp(); _stillTimer = 0f; } } private bool IsStill() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (!_resting) { return false; } if (!_grounded) { return false; } if (_steep) { return false; } if (ThrottleAxis != 0f && !BrakeHeld) { return false; } Vector3 val = Rigidbody.velocity; float magnitude = ((Vector3)(ref val)).magnitude; val = Rigidbody.angularVelocity; if (magnitude + ((Vector3)(ref val)).magnitude > 0.15f) { return false; } if (Vector3.Angle(Vector3.up, ((Component)this).transform.up) >= 20f) { return false; } return true; } public void Initialize() { Driving = false; ResetLastSafeLocation(); } private void FixUp() { ((Component)this).gameObject.layer = 17; Transform val = ((Component)this).transform.Find("Interaction"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.layer = 9; } FixUpVersion(); } private void FixUpVersion() { if (Version < 1) { CarWheel[] componentsInChildren = ((Component)this).GetComponentsInChildren(); foreach (CarWheel obj in componentsInChildren) { obj.HandBrake = obj.Throttle; } } } private void PlaceAtLastSafeLocation() { //IL_0002: 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) PlaceAt(_prevLastSafePosition, _prevLastSafeRotation); ResetLastSafeLocation(); } private void RecordLastSafeLocation() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) _lastSafeLocationTimer = 0.5f; _prevLastSafePosition = _lastSafePosition; _prevLastSafeRotation = _lastSafeRotation; _lastSafePosition = Rigidbody.position; _lastSafeRotation = Rigidbody.rotation; } private void ResetLastSafeLocation() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) _lastSafeLocationTimer = 0.5f; _lastSafePosition = Rigidbody.position; _lastSafeRotation = Rigidbody.rotation; _prevLastSafePosition = _lastSafePosition; _prevLastSafeRotation = _lastSafeRotation; } private void OnCrash(float force, Vector3 point) { if (!(force < 4f) && !(_crashAudioCooldown > 0f)) { AudioClip crashSFX = CarResources.Instance.GetCrashSFX(); _oneShotAudioSource.Play(crashSFX); _crashAudioCooldown = 0.5f; } } private void OnCollisionStay(Collision other) { if ((Object)(object)_scrapeAudio != (Object)null) { _scrapeAudio.OnScrape(other); } } private void OnCollisionEnter(Collision other) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_020a: 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) Vector3 val = Rigidbody.velocity - _previousVelocity; float magnitude = ((Vector3)(ref val)).magnitude; val = Rigidbody.angularVelocity - _previousAngularVelocity; float force = magnitude + ((Vector3)(ref val)).magnitude; OnCrash(force, ((ContactPoint)(ref other.contacts[0])).point); float magnitude2 = ((Vector3)(ref _previousVelocity)).magnitude; BreakableObject component = other.gameObject.GetComponent(); if ((Object)(object)component != (Object)null && magnitude2 >= 5f) { Rigidbody.velocity = _previousVelocity; Rigidbody.angularVelocity = _previousAngularVelocity; component.Break(false); return; } if (other.gameObject.layer == 17) { BasicCop componentInParent = other.gameObject.GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { Rigidbody.velocity = _previousVelocity; Rigidbody.angularVelocity = _previousAngularVelocity; if (magnitude2 >= 5f && (int)componentInParent.hitBoxResponse.State == 0) { val = ((Component)componentInParent).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; componentInParent.hitBoxResponse.ManualDamage((HitType)5, normalized, magnitude2 * 0.1f, 1f, 2f, 2); TimedCollisionIgnore.Create(other.collider, Chassis.GetComponentInChildren(), 1.5f); } return; } } if (other.gameObject.layer != 21) { return; } JunkHolder componentInParent2 = other.gameObject.GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null) { if (!componentInParent2.moved) { Rigidbody.velocity = _previousVelocity; Rigidbody.angularVelocity = _previousAngularVelocity; } componentInParent2.FallApart(((ContactPoint)(ref other.contacts[0])).point, false); return; } Junk component2 = other.gameObject.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { if (component2.rigidBody.isKinematic) { Rigidbody.velocity = _previousVelocity; Rigidbody.angularVelocity = _previousAngularVelocity; } if ((int)component2.interactOn == 0) { component2.FallApart(false); } else { component2.FallApart(true); } } } private void OnTriggerStay(Collider other) { if (((Component)other).gameObject.layer == 19) { Teleport componentInParent = ((Component)other).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && InputEnabled && InCar) { ((MonoBehaviour)this).StartCoroutine(DoTeleport(componentInParent)); } } else if (((Component)other).CompareTag("MovingObject")) { ((Component)other).GetComponentInParent().TriggerDetectLayer(9); } } public void PlaceAt(Vector3 position, Quaternion rotation, bool keepSpeed = false) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Dot(((Component)this).transform.right, Rigidbody.velocity); float num2 = Vector3.Dot(((Component)this).transform.up, Rigidbody.velocity); float num3 = Vector3.Dot(((Component)this).transform.forward, Rigidbody.velocity); float num4 = Vector3.Dot(((Component)this).transform.right, Rigidbody.angularVelocity); float num5 = Vector3.Dot(((Component)this).transform.up, Rigidbody.angularVelocity); float num6 = Vector3.Dot(((Component)this).transform.forward, Rigidbody.angularVelocity); ((Component)this).transform.position = position; ((Component)this).transform.rotation = rotation; if (!keepSpeed) { Rigidbody.velocity = Vector3.zero; Rigidbody.angularVelocity = Vector3.zero; } else { Rigidbody.velocity = num * ((Component)this).transform.right + num2 * ((Component)this).transform.up + num3 * ((Component)this).transform.forward; Rigidbody.angularVelocity = num4 * ((Component)this).transform.right + num5 * ((Component)this).transform.up + num6 * ((Component)this).transform.forward; } } private void ResetInputs() { ThrottleAxis = 0f; SteerAxis = 0f; HornHeld = false; GetOutOfCarButtonNew = false; PitchAxis = 0f; YawAxis = 0f; RollAxis = 0f; BrakeHeld = false; LockDoorsButtonNew = false; } [IteratorStateMachine(typeof(d__116))] private IEnumerator DoTeleport(Teleport teleport) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__116(0) { <>4__this = this, teleport = teleport }; } protected float GetAxisDeadZone(GameInput gameInput, int actionId, float deadzone) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 ControllerType currentControllerType = gameInput.GetCurrentControllerType(0); float axis = gameInput.GetAxis(actionId, 0); if ((int)currentControllerType != 2) { return axis; } if (Mathf.Abs(axis) <= deadzone) { return 0f; } return axis; } protected virtual void PollDrivingInputs() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Invalid comparison between Unknown and I4 GameInput gameInput = Core.Instance.GameInput; BrakeHeld = gameInput.GetButtonHeld(7, 0); SteerAxis = gameInput.GetAxis(5, 0); if (BrakeHeld) { RollAxis = GetAxisDeadZone(gameInput, 5, 0.2f); } else { YawAxis = GetAxisDeadZone(gameInput, 5, 0.2f); } if ((int)gameInput.GetCurrentControllerType(0) == 2) { PitchAxis = GetAxisDeadZone(gameInput, 6, 0.2f); ThrottleAxis += gameInput.GetAxis(8, 0); ThrottleAxis -= gameInput.GetAxis(18, 0); } else { ThrottleAxis = gameInput.GetAxis(6, 0); if (BrakeHeld) { PitchAxis = GetAxisDeadZone(gameInput, 6, 0.2f); } } HornHeld = gameInput.GetButtonHeld(10, 0); } private void PollInputs() { ResetInputs(); if (!InputEnabled) { return; } OnHandleInput?.Invoke(); if (!WorldHandler.instance.GetCurrentPlayer().IsBusyWithSequence() || !InCar) { GameInput gameInput = Core.Instance.GameInput; if (InCar) { GetOutOfCarButtonNew = gameInput.GetButtonNew(11, 0); } if (Driving) { PollDrivingInputs(); } } } protected virtual void Awake() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown Chassis = ((Component)this).gameObject; _passengerSeats = Chassis.GetComponentsInChildren(); DriverSeat = Chassis.GetComponentInChildren(); _scrapeAudio = Chassis.GetComponentInChildren(); _oneShotAudioSource = Chassis.GetComponentInChildren(); Rigidbody = Chassis.GetComponent(); Wheels = Chassis.GetComponentsInChildren(); if ((Object)(object)CenterOfMass != (Object)null) { Rigidbody.centerOfMass = CenterOfMass.localPosition; } CarWheel[] wheels = Wheels; for (int i = 0; i < wheels.Length; i++) { wheels[i].Initialize(this); } ResetLastSafeLocation(); FixUp(); Core.OnCoreUpdatePaused += new OnCoreUpdateHandler(OnPause); Core.OnCoreUpdateUnPaused += new OnCoreUpdateUnpausedHandler(OnUnPause); bool continuousCollisionDetection = CarController.Config.ContinuousCollisionDetection; Rigidbody.collisionDetectionMode = (CollisionDetectionMode)(continuousCollisionDetection ? 1 : 0); Rigidbody.interpolation = (RigidbodyInterpolation)1; } public CarPassengerSeat GetPassengerSeat(int index) { CarPassengerSeat[] passengerSeats = _passengerSeats; foreach (CarPassengerSeat carPassengerSeat in passengerSeats) { if (carPassengerSeat.SeatIndex == index) { return carPassengerSeat; } } return null; } public void EnterCar(Player player) { if (!((Object)(object)DriverSeat == (Object)null)) { DriverSeat.PutInSeat(player); } } public void ExitCar() { if (!((Object)(object)DriverSeat == (Object)null)) { DriverSeat.ExitSeat(); } } private void DoForcedPause() { OnPause(); _forcedPause = true; } private void UndoForcedPause() { _forcedPause = false; OnUnPause(); } private void OnPause() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (!_forcedPause && !((Object)(object)Rigidbody == (Object)null)) { _velocityBeforePause = Rigidbody.velocity; _angularVelocityBeforePause = Rigidbody.angularVelocity; Rigidbody.isKinematic = true; } } private void OnUnPause() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (!_forcedPause && !((Object)(object)Rigidbody == (Object)null)) { Rigidbody.isKinematic = false; Rigidbody.velocity = _velocityBeforePause; Rigidbody.angularVelocity = _angularVelocityBeforePause; } } protected virtual bool CheckGrounded() { CarWheel[] wheels = Wheels; for (int i = 0; i < wheels.Length; i++) { if (!wheels[i].Grounded) { return false; } } return true; } private bool IsSuspensionRestingOrAbove() { CarWheel[] wheels = Wheels; foreach (CarWheel carWheel in wheels) { if (carWheel.CurrentDistance < carWheel.RestDistance) { return false; } } return true; } protected virtual void FixedUpdateCar() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (!Core.Instance.IsCorePaused && !AllWheelsOffGround && !IsStill() && IsSuspensionRestingOrAbove()) { Rigidbody rigidbody = Rigidbody; Vector3 val = -((Component)this).transform.up * DownForce; Vector3 velocity = Rigidbody.velocity; rigidbody.AddForce(val * ((Vector3)(ref velocity)).magnitude, (ForceMode)5); } } public void SetCustomGravity(Vector3 groundGravity, Vector3 airGravity) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Rigidbody.useGravity = false; CustomGravity = true; CustomGravityInAir = airGravity; CustomGravityOnGround = groundGravity; } public void RestoreGravity() { //IL_0014: 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) Rigidbody.useGravity = true; CustomGravity = false; CustomGravityInAir = Vector3.zero; CustomGravityOnGround = Vector3.zero; } private void FixedUpdate() { //IL_00d2: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: 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) if (Core.Instance.IsCorePaused) { return; } AllWheelsOffGround = true; _resting = true; _grounded = false; _steep = false; PollInputs(); if (LockDoorsButtonNew) { PlayerData.Instance.DoorsLocked = !PlayerData.Instance.DoorsLocked; PlayerData.Instance.Save(); Core.Instance.UIManager.ShowNotification("Car doors are now " + (PlayerData.Instance.DoorsLocked ? "Locked" : "Unlocked") + "", Array.Empty()); } UpdateCounterSteer(); CarWheel[] wheels = Wheels; foreach (CarWheel obj in wheels) { obj.DoPhysics(ref _resting); if (obj.Grounded) { AllWheelsOffGround = false; } } _previousAngularVelocity = Rigidbody.angularVelocity; _previousVelocity = Rigidbody.velocity; _grounded = CheckGrounded(); if (Vector3.Angle(Vector3.up, ((Component)this).transform.up) >= 50f) { _steep = true; } _lastSafeLocationTimer = Mathf.Max(0f, _lastSafeLocationTimer - Time.deltaTime); if (_grounded && !_steep && _lastSafeLocationTimer <= 0f) { RecordLastSafeLocation(); } if (!_grounded) { AirControl(1f); UpdateAirAero(); } UpdateStill(); UpdateDrift(); UpdateAutoRecovery(); FixedUpdateCar(); if (CustomGravity) { if (AllWheelsOffGround) { Rigidbody.AddForce(CustomGravityInAir, (ForceMode)5); } else { Rigidbody.AddForce(CustomGravityOnGround, (ForceMode)5); } } if (GetOutOfCarButtonNew && InCar) { CarController.Instance.ExitCar(); } } private void AirControl(float multiplier) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) float num = AirControlStrength * multiplier; Vector3 val = ((Component)this).transform.right * (num * PitchAxis); Vector3 val2 = ((Component)this).transform.up * (num * YawAxis); Vector3 val3 = -((Component)this).transform.forward * (num * RollAxis); float num2 = Vector3.Dot(((Component)this).transform.right, Rigidbody.angularVelocity); float num3 = Vector3.Dot(((Component)this).transform.up, Rigidbody.angularVelocity); float num4 = Vector3.Dot(-((Component)this).transform.forward, Rigidbody.angularVelocity); if (num2 >= AirControlTopSpeed && PitchAxis > 0f) { val = Vector3.zero; } if (num2 <= 0f - AirControlTopSpeed && PitchAxis < 0f) { val = Vector3.zero; } if (num3 >= AirControlTopSpeed && YawAxis > 0f) { val2 = Vector3.zero; } if (num3 <= 0f - AirControlTopSpeed && YawAxis < 0f) { val2 = Vector3.zero; } if (num4 >= AirControlTopSpeed && RollAxis > 0f) { val3 = Vector3.zero; } if (num4 <= 0f - AirControlTopSpeed && RollAxis < 0f) { val3 = Vector3.zero; } Rigidbody.AddTorque(val, (ForceMode)5); Rigidbody.AddTorque(val2, (ForceMode)5); Rigidbody.AddTorque(val3, (ForceMode)5); Rigidbody.angularVelocity = Vector3.Lerp(Rigidbody.angularVelocity, Vector3.zero, AirDeacceleration * Time.deltaTime); } private void Update() { if (!Core.Instance.IsCorePaused) { if (Driving) { DoorsLocked = PlayerData.Instance.DoorsLocked; } _crashAudioCooldown = Mathf.Max(0f, _crashAudioCooldown - Time.deltaTime); CarWheel[] wheels = Wheels; for (int i = 0; i < wheels.Length; i++) { wheels[i].DoUpdate(); } } } private void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown Core.OnCoreUpdatePaused -= new OnCoreUpdateHandler(OnPause); Core.OnCoreUpdateUnPaused -= new OnCoreUpdateUnpausedHandler(OnUnPause); CarController instance = CarController.Instance; if (!((Object)(object)instance == (Object)null) && (Object)(object)instance.CurrentCar == (Object)(object)this) { CarController.Instance.ExitCar(); } } } public class DrivableChopper : DrivableCar { private const int LandingLayerMask = 1; private const float LandingRayDistance = 0.1f; private const float NoseDownMultiplier = 1.5f; [Header("Helicopter")] public Transform[] LandingSensors; public float ThrottleSpeed = 1f; public float LiftAcceleration = 10f; public float LiftLerp = 5f; public float UprightForce = 1f; public float MovementAcceleration = 10f; public float IdleAcceleration = 1f; public float AirVerticalFriction = 1f; [NonSerialized] public float ThrottleAmount; [NonSerialized] public float LiftAmount; protected override void Awake() { base.Awake(); AllowAutoRecovery = false; } protected override void PollDrivingInputs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 GameInput gameInput = Core.Instance.GameInput; ControllerType currentControllerType = gameInput.GetCurrentControllerType(0); ChopperControlTypes chopperControlType = CarController.Config.ChopperControlType; if ((int)currentControllerType == 2) { PitchAxis = GetAxisDeadZone(gameInput, 6, 0.2f); ThrottleAxis += gameInput.GetAxis(8, 0); ThrottleAxis -= gameInput.GetAxis(18, 0); if (chopperControlType == ChopperControlTypes.A) { YawAxis += (gameInput.GetButtonHeld(65, 0) ? 1f : 0f); YawAxis -= (gameInput.GetButtonHeld(15, 0) ? 1f : 0f); RollAxis = GetAxisDeadZone(gameInput, 5, 0.2f); } else { RollAxis += (gameInput.GetButtonHeld(65, 0) ? 1f : 0f); RollAxis -= (gameInput.GetButtonHeld(15, 0) ? 1f : 0f); YawAxis = GetAxisDeadZone(gameInput, 5, 0.2f); } } else { YawAxis = gameInput.GetAxis(5, 0); ThrottleAxis = gameInput.GetAxis(6, 0); RollAxis += (gameInput.GetButtonHeld(29, 0) ? 1f : 0f); RollAxis -= (gameInput.GetButtonHeld(57, 0) ? 1f : 0f); PitchAxis += (gameInput.GetButtonHeld(21, 0) ? 1f : 0f); PitchAxis -= (gameInput.GetButtonHeld(56, 0) ? 1f : 0f); } } protected override bool CheckGrounded() { Transform[] landingSensors = LandingSensors; foreach (Transform sensor in landingSensors) { if (!CheckSensorGrounded(sensor)) { return false; } } return true; } protected override void FixedUpdateCar() { //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0251: 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_0272: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) float num = ThrottleAxis; if (num > 0f) { num = 1f; } if (num < 0f) { num = -1f; } if (!base.Grounded) { num = Mathf.Max(0f, num); } if (ThrottleAmount != 0f && ThrottleAmount != 1f && ThrottleAxis == 0f) { num = -1f; } if (ThrottleAmount >= 0.5f && base.Grounded && ThrottleAxis == 0f) { num = 0f; if (0.9f > ThrottleAmount) { num = 1f; } if (ThrottleAmount > 0.99f) { ThrottleAmount = 0.99f; } } ThrottleAmount += num * ThrottleSpeed * Time.deltaTime; ThrottleAmount = Mathf.Clamp(ThrottleAmount, 0f, 1f); if (base.Grounded) { LiftAmount = 0f; } else { LiftAmount = Mathf.Lerp(LiftAmount, ThrottleAxis, LiftLerp * Time.deltaTime); } float num2 = LiftAcceleration * ThrottleAmount; if (base.Grounded && ThrottleAmount < 1f) { num2 = 0f; } float num3 = (0f - Mathf.Abs(Vector3.Dot(((Component)this).transform.up, Vector3.up)) + 1f) * 1.5f; num3 = Mathf.Min(1f, num3); num3 *= Mathf.Min(0f, ThrottleAxis) + 1f; if (!base.Grounded) { num2 = LiftAmount * LiftAcceleration * (0f - num3 + 1f); } Rigidbody.AddForce(Vector3.up * num2, (ForceMode)5); if (ThrottleAmount >= 1f) { Rigidbody.useGravity = false; } else { Rigidbody.useGravity = true; } if (!base.Grounded && ThrottleAmount >= 1f) { float num4 = Vector3.SignedAngle(((Component)this).transform.up, Vector3.up, ((Component)this).transform.forward); Rigidbody.AddTorque(num4 * ((Component)this).transform.forward * UprightForce, (ForceMode)5); float num5 = Vector3.SignedAngle(((Component)this).transform.up, Vector3.up, ((Component)this).transform.right); Rigidbody.AddTorque(num5 * ((Component)this).transform.right * UprightForce, (ForceMode)5); Vector3 val = Rigidbody.velocity - Vector3.Project(Rigidbody.velocity, Vector3.up); Rigidbody.velocity = Vector3.Lerp(Rigidbody.velocity, val, AirVerticalFriction * num3 * Time.deltaTime); Vector3 val2 = new Vector3(((Component)this).transform.up.x, 0f, ((Component)this).transform.up.z); Vector3 normalized = ((Vector3)(ref val2)).normalized; Rigidbody.AddForce(normalized * (MovementAcceleration * Mathf.Max(0f, ThrottleAxis)) * num3, (ForceMode)5); Rigidbody.AddForce(normalized * IdleAcceleration * num3, (ForceMode)5); } } private bool CheckSensorGrounded(Transform sensor) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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) return Physics.Raycast(new Ray(sensor.position, Vector3.down), 0.1f, 1); } } [RequireComponent(typeof(AudioSource))] public class EngineAudio : MonoBehaviour { public float MinimumSpeed; public float PitchLerp = 5f; public AnimationCurve PitchCurve; public float PitchCurveMax = 100f; public float AddPitch = 1f; private DrivableCar _car; private AudioSource _audioSource; private float _currentPitch = 1f; private void Awake() { _car = ((Component)this).GetComponentInParent(); _audioSource = ((Component)this).GetComponent(); } private float EvaluatePitchCurve(float value) { float num = Mathf.Min(PitchCurveMax, Mathf.Abs(value)) / PitchCurveMax; return PitchCurve.Evaluate(num); } private void Update() { if (Core.Instance.IsCorePaused) { return; } float num = 1f; float num2 = 0f; CarWheel[] wheels = _car.Wheels; foreach (CarWheel carWheel in wheels) { if (carWheel.Throttle) { float num3 = Mathf.Abs(carWheel.CurrentSpeed); if (num3 > num2) { num2 = num3; } } } float volume = 1f; if (MinimumSpeed > 0f) { volume = Mathf.Min(MinimumSpeed, num2) / MinimumSpeed; } float num4 = EvaluatePitchCurve(num2) * AddPitch; num += num4; _currentPitch = Mathf.Lerp(_currentPitch, num, PitchLerp * Time.deltaTime); _audioSource.pitch = _currentPitch; _audioSource.volume = volume; } } [RequireComponent(typeof(AudioSource))] public class EngineRestingAudio : MonoBehaviour { public float MaximumSpeed = 1f; private DrivableCar _car; private AudioSource _audioSource; private void Awake() { _car = ((Component)this).GetComponentInParent(); _audioSource = ((Component)this).GetComponent(); } private void Update() { if (Core.Instance.IsCorePaused) { return; } float num = 0f; CarWheel[] wheels = _car.Wheels; foreach (CarWheel carWheel in wheels) { if (carWheel.Throttle) { float num2 = Mathf.Abs(carWheel.CurrentSpeed); if (num2 > num) { num = num2; } } } float volume = 0f; if (MaximumSpeed > 0f) { volume = 0f - Mathf.Min(MaximumSpeed, num) / MaximumSpeed + 1f; } _audioSource.volume = volume; } } [RequireComponent(typeof(AudioSource))] public class Horn : MonoBehaviour { public float LerpSpeed = 5f; private DrivableCar _car; private AudioSource _audioSource; private float _currentVolume; private void Awake() { _car = ((Component)this).GetComponentInParent(); _audioSource = ((Component)this).GetComponent(); } private void Update() { if (!Core.Instance.IsCorePaused) { float num = 0f; if (_car.HornHeld) { num = 1f; } if (_currentVolume <= 0.1f) { _audioSource.Stop(); _audioSource.Play(); } _currentVolume = Mathf.Lerp(_currentVolume, num, LerpSpeed * Time.deltaTime); _audioSource.volume = _currentVolume; } } } public enum ChopperControlTypes { A, B } public interface ICarConfig { bool AllCityNetworkIntegration { get; set; } bool ContinuousCollisionDetection { get; set; } bool DeveloperMode { get; set; } KeyCode ReloadBundlesKey { get; set; } ChopperControlTypes ChopperControlType { get; set; } bool MouseCameraControlsOnController { get; set; } } public class OneShotAudioSource : MonoBehaviour { private AudioSource[] _pooledAudioSources; private void Awake() { _pooledAudioSources = ((Component)this).GetComponentsInChildren(); } private AudioSource GetPooledAudioSource() { AudioSource[] pooledAudioSources = _pooledAudioSources; foreach (AudioSource val in pooledAudioSources) { if (!val.isPlaying) { return val; } } return _pooledAudioSources[0]; } public void Play(AudioClip clip) { AudioSource pooledAudioSource = GetPooledAudioSource(); pooledAudioSource.Stop(); pooledAudioSource.clip = clip; pooledAudioSource.Play(); } } public class PassengerSeatInteractable : CustomInteractable { private CarPassengerSeat _seat; public void Initialize(CarPassengerSeat seat) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) _seat = seat; base.Icon = (InteractableIcon)0; } public override bool Test(Player player) { if ((Object)(object)_seat.Player == (Object)null) { return !_seat.Car.DoorsLocked; } return false; } public override void Interact(Player player) { CarController.Instance.EnterCarAsPassenger(_seat.Car, _seat.SeatIndex); } } public class PlayerData { [Serializable] public class SerializedData { public bool DoorsLocked; public bool MutePlayers; public bool AutoRecover = true; } private SerializedData _data; public static PlayerData Instance { get; private set; } public bool DoorsLocked { get { return _data.DoorsLocked; } set { _data.DoorsLocked = value; } } public bool MutePlayers { get { return _data.MutePlayers; } set { _data.MutePlayers = value; } } public bool AutoRecover { get { return _data.AutoRecover; } set { _data.AutoRecover = value; } } public PlayerData() { Instance = this; } public void LoadOrCreate() { try { _data = JsonUtility.FromJson(File.ReadAllText(GetSaveLocation())); } catch (Exception) { _data = new SerializedData(); } } public void Save() { string contents = JsonUtility.ToJson((object)_data, true); Directory.CreateDirectory(Path.GetDirectoryName(GetSaveLocation())); File.WriteAllText(GetSaveLocation(), contents); } private string GetSaveLocation() { return Path.Combine(Paths.ConfigPath, "CarJack", "playerdata.json"); } } public class Rotor : MonoBehaviour { public float Speed = 1f; private DrivableChopper _chopper; private void Awake() { _chopper = ((Component)this).GetComponentInParent(); } private void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.Rotate(Vector3.up, Speed * _chopper.ThrottleAmount * Time.deltaTime, (Space)1); } } [RequireComponent(typeof(AudioSource))] public class RotorAudio : MonoBehaviour { public float MinimumPitch = -2f; public float MaximumPitch = 1f; public float PitchLerp = 5f; private DrivableChopper _chopper; private AudioSource _audioSource; private float _currentPitch = 1f; public float MaxVolumeThreshold = 0.5f; private void Awake() { _chopper = ((Component)this).GetComponentInParent(); _audioSource = ((Component)this).GetComponent(); } private void Update() { if (!Core.Instance.IsCorePaused) { float num = Mathf.Lerp(MinimumPitch, MaximumPitch, _chopper.ThrottleAmount); _currentPitch = Mathf.Lerp(_currentPitch, num, PitchLerp * Time.deltaTime); _audioSource.pitch = _currentPitch; _audioSource.volume = Mathf.Max(0f, _chopper.ThrottleAmount / MaxVolumeThreshold); } } } [RequireComponent(typeof(AudioSource))] public class ScrapeAudio : MonoBehaviour { public float SpeedMultiplier = 0.1f; public float MinimumSpeed = 5f; public float LerpSpeed = 10f; private AudioSource _audioSource; private DrivableCar _car; private float _targetVolume; private void Awake() { _car = ((Component)this).GetComponentInParent(); _audioSource = ((Component)this).GetComponent(); _audioSource.volume = 0f; } public void OnScrape(Collision other) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!(((Object)other.gameObject).name == "rocket ball")) { Vector3 val = _car.Rigidbody.velocity; if ((Object)(object)other.rigidbody != (Object)null) { val += other.rigidbody.velocity; } Vector3 normal = ((ContactPoint)(ref other.contacts[0])).normal; Vector3 val2 = val - Vector3.Project(_car.Rigidbody.velocity, normal); float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude > MinimumSpeed) { magnitude -= MinimumSpeed; magnitude = Mathf.Min(0.5f, magnitude * SpeedMultiplier); _targetVolume = magnitude; } } } private void FixedUpdate() { _targetVolume = 0f; } private void Update() { if (!Core.Instance.IsCorePaused) { _audioSource.volume = Mathf.Lerp(_audioSource.volume, _targetVolume, LerpSpeed * Time.deltaTime); } } } public class TimedCollisionIgnore : MonoBehaviour { private Collider _owner; private Collider _other; private float _time; public static TimedCollisionIgnore Create(Collider owner, Collider other, float duration) { TimedCollisionIgnore timedCollisionIgnore = ((Component)owner).gameObject.AddComponent(); timedCollisionIgnore.Initialize(owner, other, duration); return timedCollisionIgnore; } public void Initialize(Collider owner, Collider other, float duration) { _owner = owner; _other = other; _time = duration; Physics.IgnoreCollision(_owner, _other, true); } private void Update() { if (Core.Instance.IsCorePaused) { return; } _time -= Time.deltaTime; if (_time <= 0f) { if ((Object)(object)_owner != (Object)null && (Object)(object)_other != (Object)null) { Physics.IgnoreCollision(_owner, _other, false); } Object.Destroy((Object)(object)this); } } } [RequireComponent(typeof(AudioSource))] public class TyreAudio : MonoBehaviour { public float LerpSpeed = 5f; private DrivableCar _car; private AudioSource _audioSource; private float _currentVolume; private void Awake() { _car = ((Component)this).GetComponentInParent(); _audioSource = ((Component)this).GetComponent(); } private void Update() { if (Core.Instance.IsCorePaused) { return; } float num = 0f; CarWheel[] wheels = _car.Wheels; foreach (CarWheel carWheel in wheels) { if (carWheel.Slipping >= 0.3f && carWheel.Grounded) { num = 1f; break; } } _currentVolume = Mathf.Lerp(_currentVolume, num, LerpSpeed * Time.deltaTime); _audioSource.volume = _currentVolume; } } public static class PluginInfo { public const string PLUGIN_GUID = "CarJack.Common"; public const string PLUGIN_NAME = "CarJack.Common"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace CarJack.Common.WhipRemix { public class Recolor : IDisposable { public class RecolorProperties { public string RecolorGUID; public string RecolorDisplayName; public string CarInternalName; } public class RecolorMaterial { public string OriginalMaterialName; public Material Material; public Texture2D MainTexture; public Texture2D EmissionTexture; } private const char SplitSymbol = '$'; public RecolorProperties Properties; public Dictionary RecoloredMaterialByName; private List _objects; public void AddResourceToCleanUp(Object resource) { _objects.Add(resource); } public void CreateDefault(RecolorableCar car) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) Properties = new RecolorProperties(); Properties.CarInternalName = car.Car.InternalName; Properties.RecolorGUID = Guid.NewGuid().ToString(); Properties.RecolorDisplayName = "New Recolor"; RecoloredMaterialByName = new Dictionary(); _objects = new List(); Material[] recolorableMaterials = car.RecolorableMaterials; foreach (Material val in recolorableMaterials) { RecolorMaterial recolorMaterial = new RecolorMaterial(); recolorMaterial.OriginalMaterialName = ((Object)val).name; Texture2D val2 = null; Texture2D val3 = null; Texture texture = val.GetTexture("_MainTex"); if ((Object)(object)texture != (Object)null) { val2 = new Texture2D(texture.width, texture.height); ((Texture)val2).filterMode = texture.filterMode; val2.SetPixels(((Texture2D)((texture is Texture2D) ? texture : null)).GetPixels()); val2.Apply(); } Texture texture2 = val.GetTexture("_Emission"); if ((Object)(object)texture2 != (Object)null) { val3 = new Texture2D(texture2.width, texture2.height); ((Texture)val3).filterMode = texture2.filterMode; val3.SetPixels(((Texture2D)((texture2 is Texture2D) ? texture2 : null)).GetPixels()); val3.Apply(); } recolorMaterial.MainTexture = val2; recolorMaterial.EmissionTexture = val3; if ((Object)(object)val2 != (Object)null) { _objects.Add((Object)(object)val2); } if ((Object)(object)val3 != (Object)null) { _objects.Add((Object)(object)val3); } RecoloredMaterialByName[((Object)val).name] = recolorMaterial; } } public void Save(string path) { ZipArchive zipArchive = ZipFile.Open(path, ZipArchiveMode.Create); using (Stream stream = zipArchive.CreateEntry("properties.json", CompressionLevel.Optimal).Open()) { using StreamWriter streamWriter = new StreamWriter(stream); string value = JsonUtility.ToJson((object)Properties, true); streamWriter.Write(value); } foreach (KeyValuePair item in RecoloredMaterialByName) { Texture2D mainTexture = item.Value.MainTexture; Texture2D emissionTexture = item.Value.EmissionTexture; if ((Object)(object)mainTexture != (Object)null) { byte[] buffer = ImageConversion.EncodeToPNG(mainTexture); using Stream output = zipArchive.CreateEntry($"{item.Value.OriginalMaterialName}{'$'}Main.png").Open(); using BinaryWriter binaryWriter = new BinaryWriter(output); binaryWriter.Write(buffer); } if (!((Object)(object)emissionTexture != (Object)null)) { continue; } byte[] buffer2 = ImageConversion.EncodeToPNG(emissionTexture); using Stream output2 = zipArchive.CreateEntry($"{item.Value.OriginalMaterialName}{'$'}Emission.png").Open(); using BinaryWriter binaryWriter2 = new BinaryWriter(output2); binaryWriter2.Write(buffer2); } zipArchive.Dispose(); } public void FromFile(string path) { //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown ZipArchive zipArchive = ZipFile.Open(path, ZipArchiveMode.Read); using (Stream stream = zipArchive.GetEntry("properties.json").Open()) { using StreamReader streamReader = new StreamReader(stream); string text = streamReader.ReadToEnd(); Properties = JsonUtility.FromJson(text); } RecoloredMaterialByName = new Dictionary(); _objects = new List(); foreach (ZipArchiveEntry entry in zipArchive.Entries) { if (!entry.Name.ToLowerInvariant().EndsWith(".png") || !Enumerable.Contains(entry.Name, '$')) { continue; } string[] array = Path.GetFileNameWithoutExtension(entry.Name).Split(new char[1] { '$' }); string text2 = array[0]; string text3 = array[1].ToLowerInvariant(); byte[] array2 = new byte[0]; using (Stream stream2 = entry.Open()) { using MemoryStream memoryStream = new MemoryStream(); stream2.CopyTo(memoryStream); array2 = memoryStream.ToArray(); } Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array2); _objects.Add((Object)(object)val); if (!RecoloredMaterialByName.TryGetValue(text2, out var value)) { value = new RecolorMaterial(); value.OriginalMaterialName = text2; RecoloredMaterialByName[text2] = value; } if (!(text3 == "main")) { if (text3 == "emission") { value.EmissionTexture = val; } } else { value.MainTexture = val; } } zipArchive.Dispose(); } public void Dispose() { foreach (Object @object in _objects) { Object.DestroyImmediate(@object); } } } [RequireComponent(typeof(DrivableCar))] public class RecolorableCar : MonoBehaviour { public class RecolorableRenderer { public Renderer Renderer; public int MaterialIndex; public Material OriginalMaterial; } public Material[] RecolorableMaterials; [NonSerialized] public DrivableCar Car; [NonSerialized] public Recolor CurrentRecolor; private List _recolorableRenderers; private void Awake() { Car = ((Component)this).GetComponent(); _recolorableRenderers = new List(); Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren(); foreach (Renderer val in componentsInChildren) { Material[] sharedMaterials = val.sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; for (int k = 0; k < RecolorableMaterials.Length; k++) { Material val3 = RecolorableMaterials[k]; if ((Object)(object)val2 == (Object)(object)val3) { RecolorableRenderer recolorableRenderer = new RecolorableRenderer(); recolorableRenderer.Renderer = val; recolorableRenderer.MaterialIndex = j; recolorableRenderer.OriginalMaterial = val3; _recolorableRenderers.Add(recolorableRenderer); } } } } } public void ApplyDefaultColor() { CurrentRecolor = null; foreach (RecolorableRenderer recolorableRenderer in _recolorableRenderers) { Material[] sharedMaterials = recolorableRenderer.Renderer.sharedMaterials; sharedMaterials[recolorableRenderer.MaterialIndex] = recolorableRenderer.OriginalMaterial; recolorableRenderer.Renderer.sharedMaterials = sharedMaterials; } } public void ApplyRecolor(Recolor recolor) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown CurrentRecolor = recolor; foreach (RecolorableRenderer recolorableRenderer in _recolorableRenderers) { foreach (KeyValuePair item in recolor.RecoloredMaterialByName) { if (item.Key == ((Object)recolorableRenderer.OriginalMaterial).name) { Material val = item.Value.Material; if ((Object)(object)val == (Object)null) { val = new Material(recolorableRenderer.OriginalMaterial); val.SetTexture("_MainTex", (Texture)(object)item.Value.MainTexture); val.SetTexture("_Emission", (Texture)(object)item.Value.EmissionTexture); val.shader = recolorableRenderer.OriginalMaterial.shader; item.Value.Material = val; recolor.AddResourceToCleanUp((Object)(object)val); } Material[] sharedMaterials = recolorableRenderer.Renderer.sharedMaterials; sharedMaterials[recolorableRenderer.MaterialIndex] = val; recolorableRenderer.Renderer.sharedMaterials = sharedMaterials; } } } } public void ApplySavedRecolor() { RecolorSaveData instance = RecolorSaveData.Instance; if (instance == null) { return; } string recolorGUIDForCar = instance.GetRecolorGUIDForCar(Car.InternalName); Recolor value; if (string.IsNullOrEmpty(recolorGUIDForCar)) { ApplyDefaultColor(); } else if (RecolorManager.RecolorsByGUID.TryGetValue(recolorGUIDForCar, out value)) { if (value.Properties.CarInternalName == Car.InternalName) { ApplyRecolor(value); } else { ApplyDefaultColor(); } } else { ApplyDefaultColor(); } } } public static class RecolorManager { public static string RecolorFolder; public static Dictionary RecolorsByGUID; public static void Initialize(string recolorFolder) { RecolorFolder = recolorFolder; } public static void UnloadRecolors() { foreach (KeyValuePair item in RecolorsByGUID) { item.Value.Dispose(); } RecolorsByGUID = new Dictionary(); } public static void LoadRecolors() { RecolorsByGUID = new Dictionary(); string[] files = Directory.GetFiles(RecolorFolder, "*.whipremix", SearchOption.AllDirectories); foreach (string text in files) { try { Recolor recolor = new Recolor(); recolor.FromFile(text); RecolorsByGUID[recolor.Properties.RecolorGUID] = recolor; } catch (Exception arg) { Debug.LogError((object)$"CarJack WhipRemix: Failed to load recolor {text}!\nException:\n{arg}"); } } } } public class RecolorSaveData : CustomSaveData { private const byte Version = 0; private Dictionary _recolorGUIDByCarInternalName = new Dictionary(); public static RecolorSaveData Instance { get; private set; } public RecolorSaveData() : base("CarJack", "Slot{0}.cjs") { Instance = this; } public void SetRecolorForCar(string carInternalName, string recolorGUID) { if (string.IsNullOrEmpty(recolorGUID)) { _recolorGUIDByCarInternalName.Remove(carInternalName); } else { _recolorGUIDByCarInternalName[carInternalName] = recolorGUID; } } public string GetRecolorGUIDForCar(string carInternalName) { if (_recolorGUIDByCarInternalName.TryGetValue(carInternalName, out var value)) { return value; } return string.Empty; } public override void Initialize() { _recolorGUIDByCarInternalName = new Dictionary(); } public override void Read(BinaryReader reader) { reader.ReadByte(); int num = reader.ReadInt32(); for (int i = 0; i < num; i++) { string key = reader.ReadString(); string value = reader.ReadString(); _recolorGUIDByCarInternalName[key] = value; } } public override void Write(BinaryWriter writer) { writer.Write((byte)0); writer.Write(_recolorGUIDByCarInternalName.Count); foreach (KeyValuePair item in _recolorGUIDByCarInternalName) { writer.Write(item.Key); writer.Write(item.Value); } } } } namespace CarJack.Common.Runtime { public class CarAudioLOD : MonoBehaviour { private const float LODDistance = 80f; private DrivableCar _car; private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown _car = ((Component)this).GetComponentInParent(); Core.OnUpdate += new OnUpdateHandler(CoreUpdate); } private void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Core.OnUpdate -= new OnUpdateHandler(CoreUpdate); } private void SetActive(bool set) { if (((Component)this).gameObject.activeSelf && !set) { ((Component)this).gameObject.SetActive(false); } else if (!((Component)this).gameObject.activeSelf && set) { ((Component)this).gameObject.SetActive(true); } } private void CoreUpdate() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (PlayerData.Instance.MutePlayers && !_car.InCar) { SetActive(set: false); return; } CarCamera instance = CarCamera.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.Target == (Object)(object)_car) { SetActive(set: true); return; } Camera currentCamera = WorldHandler.instance.CurrentCamera; if (!((Object)(object)currentCamera == (Object)null)) { if (Vector3.Distance(((Component)currentCamera).transform.position, ((Component)this).transform.position) > 80f) { SetActive(set: false); } else { SetActive(set: true); } } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }