Decompiled source of WeatherGB v1.2.5
Mods/WeatherGB.dll
Decompiled 15 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using Il2CppInterop.Runtime.InteropTypes.Arrays; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using WeatherGB; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(WeatherMod), "WeatherGB", "1.2.7", "Zooks", null)] [assembly: MelonGame("Boneloaf", "Gang Beasts")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("WeatherGB")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Weather mod for Gang Beasts")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WeatherGB")] [assembly: AssemblyTitle("WeatherGB")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 WeatherGB { public enum TimeOfDay { Day, Evening, Night } public enum WeatherType { None, Rain, Snow, Ash } public class WeatherMod : MelonMod { private static WeatherController _controller; private static MelonPreferences_Category _prefCategory; private static MelonPreferences_Entry<string> _prefWeather; private static MelonPreferences_Entry<string> _prefTime; public override void OnInitializeMelon() { _prefCategory = MelonPreferences.CreateCategory("WeatherGB", "WeatherGB Settings"); _prefWeather = _prefCategory.CreateEntry<string>("WeatherOverride", "Random", "Weather (Random, Rain, Snow, Ash)", (string)null, false, false, (ValueValidator)null, (string)null); _prefTime = _prefCategory.CreateEntry<string>("TimeOverride", "Random", "Time of Day (Random, Day, Evening, Night)", (string)null, false, false, (ValueValidator)null, (string)null); ((MelonBase)this).LoggerInstance.Msg("Loaded WeatherGB v1.2.7"); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { if (_controller != null) { _controller.Destroy(); _controller = null; } string text = sceneName.ToLower(); if (text.Contains("incinerator") || text.Contains("chute") || text.Contains("grind") || text.Contains("meat") || text.Contains("vent") || text.Contains("fan") || text.Contains("ring") || text.Contains("subway") || text.Contains("aquarium")) { _controller = new WeatherController(WeatherType.None, TimeOfDay.Night); if (text.Contains("subway")) { ((MelonBase)this).LoggerInstance.Msg("[WeatherGB] Subway detected ('" + sceneName + "') - reflection probes off, normal maps 1.2x."); } else { ((MelonBase)this).LoggerInstance.Msg("[WeatherGB] Indoor map detected ('" + sceneName + "') - interior lighting & normal tweaks."); } return; } bool flag = text.Contains("lighthouse"); bool flag2 = text.Contains("crane"); bool flag3 = text.Contains("trawler"); WeatherType weatherType = WeatherType.None; string a = ((_prefWeather.Value != null) ? _prefWeather.Value.Trim() : "Random"); if (flag2) { weatherType = WeatherType.Rain; } else if (flag3) { weatherType = WeatherType.Rain; } else if (flag) { weatherType = WeatherType.Rain; } else if (string.Equals(a, "Rain", StringComparison.OrdinalIgnoreCase)) { weatherType = WeatherType.Rain; } else if (string.Equals(a, "Snow", StringComparison.OrdinalIgnoreCase)) { weatherType = WeatherType.Snow; } else if (string.Equals(a, "Ash", StringComparison.OrdinalIgnoreCase)) { weatherType = WeatherType.Ash; } else { if (text.Contains("buoy")) { weatherType = WeatherType.Snow; } else if (text.Contains("roof") || text.Contains("blimp") || text.Contains("menu") || text.Contains("customization") || text.Contains("truck") || text.Contains("containers") || text.Contains("tower") || text.Contains("girders")) { weatherType = WeatherType.Rain; } else if (text.Contains("alley") || text.Contains("wheel") || text.Contains("gondola") || text.Contains("billboard") || text.Contains("elevator") || text.Contains("train")) { weatherType = ((Random.value <= 0.5f) ? WeatherType.Rain : WeatherType.Snow); } if (weatherType == WeatherType.Rain && !text.Contains("blimp") && !text.Contains("truck") && !text.Contains("menu") && !text.Contains("alley") && !text.Contains("wheel") && !text.Contains("gondola") && !text.Contains("billboard") && !text.Contains("elevator") && !text.Contains("train") && Random.value <= 0.2f) { weatherType = WeatherType.Snow; } } string a2 = ((_prefTime.Value != null) ? _prefTime.Value.Trim() : "Random"); TimeOfDay timeOfDay = TimeOfDay.Day; if (string.Equals(a2, "Day", StringComparison.OrdinalIgnoreCase)) { timeOfDay = TimeOfDay.Day; } else if (string.Equals(a2, "Evening", StringComparison.OrdinalIgnoreCase)) { timeOfDay = TimeOfDay.Evening; } else if (string.Equals(a2, "Night", StringComparison.OrdinalIgnoreCase)) { timeOfDay = TimeOfDay.Night; } else if (flag2) { timeOfDay = ((!(Random.value <= 0.5f)) ? TimeOfDay.Night : TimeOfDay.Day); } else { float value = Random.value; timeOfDay = ((!(value <= 0.33f)) ? ((value <= 0.66f) ? TimeOfDay.Evening : TimeOfDay.Night) : TimeOfDay.Day); } if (flag2 && timeOfDay == TimeOfDay.Evening) { timeOfDay = TimeOfDay.Night; } if (weatherType != WeatherType.None) { _controller = new WeatherController(weatherType, timeOfDay); ((MelonBase)this).LoggerInstance.Msg($"[WeatherGB] Spawned {weatherType} weather ({timeOfDay}) for {sceneName}"); } } public override void OnUpdate() { if (_controller != null) { _controller.Update(Time.deltaTime); } } } public class WeatherController { private struct ParticleSimData { public Vector3 Position; public float Speed; public float SinOffset; public float Size; public float SwayPhaseX; public float SwayPhaseZ; public float SwayFreqX; public float SwayFreqZ; public float RollRotation; public bool HasCollisionPoint; public Vector3 CollisionPoint; public Vector3 CollisionNormal; public float CollisionY; public float DeathTimer; public Vector3 DeathPosition; } private struct FogData { public Transform Transform; public float Speed; public float Phase; } private struct SplashInstance { public GameObject GameObject; public Transform Transform; public MeshRenderer Renderer; public Vector3 BasePosition; public Vector3 StartScale; public float Life; public float MaxLife; public bool IsActive; } private class BoltSkeleton { public Vector3 top; public Vector3 bot; public float widthPx; public float rough; public int depth; public float dist; public List<BranchSkeleton> branches = new List<BranchSkeleton>(); } private class BranchSkeleton { public float t; public float angleDeg; public float side; public float lenFactor; public float widthPx; public float alphaMul; public float rough; public int depth; public List<BranchSkeleton> children = new List<BranchSkeleton>(); } private static readonly int _colorPropID = Shader.PropertyToID("_Color"); private static readonly int _altColorPropID = Shader.PropertyToID("_BaseColor"); private static readonly int _mainTexPropID = Shader.PropertyToID("_MainTex"); private static readonly int _altMainTexPropID = Shader.PropertyToID("_BaseMap"); private static readonly int idSkyColorProp = Shader.PropertyToID("_SkyColor"); private static readonly int idFogColorProp = Shader.PropertyToID("_FogColor"); private static readonly int idFogLightScatterIntensityProp = Shader.PropertyToID("_FogLightScatterIntensity"); private static readonly int idSkyFogElevationProp = Shader.PropertyToID("_SkyFogElevation"); private static readonly int idSkyFogMaxDepthProp = Shader.PropertyToID("_SkyFogMaxDepth"); private static readonly int idGroundFogElevationProp = Shader.PropertyToID("_GroundFogElevation"); private static readonly int idGroundFogMaxDepthProp = Shader.PropertyToID("_GroundFogMaxDepth"); private readonly WeatherType _type; private readonly TimeOfDay _timeOfDay; private readonly bool _isGirders; private readonly bool _isLighthouse; private readonly bool _isCrane; private readonly bool _isTrawler; private readonly bool _isIndoor; private readonly bool _isSubway; private readonly string _sceneName; private const float RAIN_DEATH_DURATION = 0.32f; private const float RAIN_DEATH_LIFT = 0.22f; private const float FLASH_DURATION = 1.2f; private const float MATERIAL_BLEND = 0.3f; private ParticleSimData[] _simData; private FogData[] _fogBillows; private GameObject _particleMeshGo; private MeshFilter _meshFilter; private MeshRenderer _meshRenderer; private Mesh _particleMesh; private Vector3[] _vertices; private Vector2[] _uvs; private Color[] _colors; private int[] _triangles; private string _cacheFilePath; private int _vertsPerParticle; private string _cachedShaderName = "Sprites/Default"; private SplashInstance[] _splashCircularBuffer; private int _nextSplashIndex; private const int MAX_SPLASHES = 32; private Camera _mainCamera; private Transform _mainCameraTransform; private Texture2D _softCircleTex; private Texture2D _rainStreakTex; private Texture2D _snowflakeTex; private Material _particleMaterial; private Material _splashMaterial; private Material _fogMaterial; private MaterialPropertyBlock _splashPropertyBlock; private GameObject _boltGo; private MeshFilter _boltFilter; private MeshRenderer _boltRenderer; private Mesh _boltMesh; private Material _boltMat; private Light _boltLight; private Texture2D _boltLineTex; private float _boltAnimTimer; private bool _boltIntensityLogged; private const float BOLT_ANIM_INTERVAL = 0.06f; private readonly List<BoltSkeleton> _boltSkeletons = new List<BoltSkeleton>(); private readonly List<Vector3> _gv = new List<Vector3>(4096); private readonly List<Vector2> _guv = new List<Vector2>(4096); private readonly List<Color> _gcol = new List<Color>(4096); private readonly List<int> _gtri = new List<int>(8192); private readonly List<Vector3> _fractA = new List<Vector3>(64); private readonly List<Vector3> _fractB = new List<Vector3>(64); private readonly List<List<Vector3>> _freePolys = new List<List<Vector3>>(); private readonly List<List<Vector3>> _activePolys = new List<List<Vector3>>(64); private static readonly Color BOLT_GLOW = new Color(0.4f, 0.58f, 1f); private static readonly Color BOLT_CORE = new Color(0.97f, 0.99f, 1f); private readonly List<Light> _directionalLights = new List<Light>(); private readonly Dictionary<Light, float> _originalIntensities = new Dictionary<Light, float>(); private readonly Dictionary<Light, Color> _originalColors = new Dictionary<Light, Color>(); private readonly HashSet<Material> _modifiedMaterials = new HashSet<Material>(); private readonly Dictionary<Material, Color> _originalWaterEmission = new Dictionary<Material, Color>(); private readonly Dictionary<Material, Color> _originalWaterFoam = new Dictionary<Material, Color>(); private readonly Dictionary<Material, float> _originalBumpScales = new Dictionary<Material, float>(); private readonly Dictionary<Material, float> _originalNormalScales = new Dictionary<Material, float>(); private readonly Dictionary<Material, float> _originalDetailNormalScales = new Dictionary<Material, float>(); private readonly Dictionary<Material, float> _originalGlossiness = new Dictionary<Material, float>(); private readonly Dictionary<Material, float> _originalSmoothness = new Dictionary<Material, float>(); private readonly Dictionary<Material, float> _originalGlossMapScale = new Dictionary<Material, float>(); private readonly Dictionary<Material, float> _originalMetallic = new Dictionary<Material, float>(); private readonly Dictionary<Material, float> _originalRoughness = new Dictionary<Material, float>(); private float _originalLightIntensity = 1.1f; private Color _originalAmbientColor; private float _originalAmbientIntensity = 1f; private float _originalReflectionIntensity = 1f; private AmbientMode _originalAmbientMode; private bool _lightsCached; private Color _origGameSkyColor; private Color _origGameFogColor; private float _origGameScatter; private float _origGameSkyFogElevation; private float _origGameSkyFogMaxDepth; private float _origGameGroundFogElevation; private float _origGameGroundFogMaxDepth; private bool _thunderActive; private float _thunderStartTime; private float _nextThunderTime; private float _preFlashIntensity = 1f; private Color _preFlashAmbient = Color.white; private GameObject _audioHost; private AudioSource _weatherAudioSource; private AudioSource _thunderAudioSource; private AudioClip _weatherClip; private readonly List<AudioClip> _thunderClips = new List<AudioClip>(); private readonly float _rainSpeed = 40f; private readonly float _rainThickness = 0.055f; private readonly float _rainLongness = 0.45f; private readonly int _particleCount = 2100; private readonly Queue<int> _raycastQueue = new Queue<int>(); private readonly RaycastHit[] _raycastBuffer = (RaycastHit[])(object)new RaycastHit[8]; private const int MAX_RAYCASTS_PER_FRAME = 64; private const float BOX_W = 55f; private const float BOX_H_DOWN = -85f; private const float BOX_H_UP = 45f; private static bool BoltKeyPressed() { Keyboard current = Keyboard.current; if (current != null) { return ((ButtonControl)current.backslashKey).wasPressedThisFrame; } return false; } public WeatherController(WeatherType type, TimeOfDay tod) { //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Expected O, but got Unknown //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) _type = type; _timeOfDay = tod; _nextThunderTime = Time.time + Random.Range(12f, 25f); _mainCamera = Camera.main; _mainCameraTransform = (((Object)(object)_mainCamera != (Object)null) ? ((Component)_mainCamera).transform : null); Scene activeScene = SceneManager.GetActiveScene(); string text = (_sceneName = ((Scene)(ref activeScene)).name.ToLower()); _isGirders = text.Contains("girders"); _isLighthouse = text.Contains("lighthouse"); _isCrane = text.Contains("crane"); _isTrawler = text.Contains("trawler"); _isSubway = text.Contains("subway"); _isIndoor = text.Contains("incinerator") || text.Contains("chute") || text.Contains("grind") || text.Contains("meat") || text.Contains("vent") || text.Contains("fan") || text.Contains("ring") || _isSubway || text.Contains("aquarium"); _vertsPerParticle = ((_type == WeatherType.Rain) ? 4 : 8); FindDirectionalLights(); CacheGameFogGlobals(); if (_type == WeatherType.None) { if (_isSubway) { RemoveSubwayReflectionProbes(); ApplyInteriorMaterialTweaks(1.2f, applySurfaceTweaks: false); return; } ApplyAtmosphericSettings(); if (_isIndoor) { ApplyIndoorLighting(1f); ApplyInteriorMaterialTweaks(1.6f); } else { ApplyTimeOfDayLighting(); } return; } InitializeDiskCache(); _softCircleTex = CreateSoftCircleTexture(); _splashPropertyBlock = new MaterialPropertyBlock(); SetupSharedMaterials(); InitLightning(); ApplyOutdoorSceneTweaks(); ApplyAtmosphericSettings(); SetupAudio(); InitializeDynamicMesh(); _simData = new ParticleSimData[_particleCount]; Vector3 boxCenter = (((Object)(object)_mainCamera != (Object)null) ? (_mainCameraTransform.position + _mainCameraTransform.forward * 15f) : Vector3.zero); for (int i = 0; i < _particleCount; i++) { _simData[i] = new ParticleSimData { Speed = Random.Range(0.91f, 1.13f), SinOffset = Random.Range(0f, 100f), Size = ((_type == WeatherType.Snow) ? Random.Range(0.16f, 0.32f) : ((_type == WeatherType.Rain) ? Random.Range(0.85f, 1.25f) : Random.Range(0.08f, 0.18f))), SwayPhaseX = Random.Range(0f, 100f), SwayPhaseZ = Random.Range(0f, 100f), SwayFreqX = Random.Range(0.8f, 1.5f), SwayFreqZ = Random.Range(0.8f, 1.5f), RollRotation = Random.Range(0f, 360f), DeathTimer = 0f }; ResetParticleSimulation(ref _simData[i], boxCenter, isStartup: true); if (_type == WeatherType.Rain) { _raycastQueue.Enqueue(i); } } _splashCircularBuffer = new SplashInstance[32]; for (int j = 0; j < 32; j++) { _splashCircularBuffer[j] = default(SplashInstance); } int num = ((_type != WeatherType.Snow) ? 9 : 0); _fogBillows = new FogData[num]; for (int k = 0; k < num; k++) { GameObject val = CreateFogBillow(); if ((Object)(object)val != (Object)null) { _fogBillows[k] = new FogData { Transform = val.transform, Speed = Random.Range(0.3f, 0.6f), Phase = Random.Range(0f, 10f) }; } } SpawnHeadlights(); ApplyTimeOfDayLighting(); } private void InitializeDiskCache() { try { string text = Path.Combine(Application.dataPath, "..", "UserData", "WeatherGB"); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } _cacheFilePath = Path.Combine(text, "Cache.dat"); if (!File.Exists(_cacheFilePath)) { return; } string[] array = File.ReadAllLines(_cacheFilePath); foreach (string text2 in array) { if (text2.StartsWith("Shader:")) { _cachedShaderName = text2.Substring(7).Trim(); } } } catch (Exception) { } } private void SaveShaderToDiskCache(string shaderName) { try { if (!string.IsNullOrEmpty(_cacheFilePath)) { File.WriteAllText(_cacheFilePath, $"Shader:{shaderName}\nSavedAt:{DateTime.UtcNow}"); } } catch (Exception) { } } private Shader FindSafeShader() { Shader val = Shader.Find(_cachedShaderName); if ((Object)(object)val != (Object)null) { return val; } string[] array = new string[4] { "Sprites/Default", "UI/Default", "Legacy Shaders/Particles/Alpha Blended", "Unlit/Transparent" }; for (int i = 0; i < array.Length; i++) { Shader val2 = Shader.Find(array[i]); if ((Object)(object)val2 != (Object)null && ((Object)val2).name != "") { _cachedShaderName = ((Object)val2).name; SaveShaderToDiskCache(((Object)val2).name); return val2; } } return Shader.Find("Internal-Colored"); } private void SetupSharedMaterials() { //IL_003a: 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_004c: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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) Shader val = FindSafeShader(); Texture2D val2; if (_type == WeatherType.Rain) { _rainStreakTex = CreateRainStreakTexture(); val2 = _rainStreakTex; } else { _snowflakeTex = CreateSnowflakeTexture(); val2 = _snowflakeTex; } _particleMaterial = new Material(val) { hideFlags = (HideFlags)61 }; _particleMaterial.SetTexture(_mainTexPropID, (Texture)(object)val2); _particleMaterial.SetTexture(_altMainTexPropID, (Texture)(object)val2); _splashMaterial = new Material(val) { hideFlags = (HideFlags)61 }; _splashMaterial.SetTexture(_mainTexPropID, (Texture)(object)_softCircleTex); _splashMaterial.SetTexture(_altMainTexPropID, (Texture)(object)_softCircleTex); _fogMaterial = new Material(val) { hideFlags = (HideFlags)61 }; Color val3 = ((_type == WeatherType.Snow) ? new Color(0.9f, 0.82f, 0.85f, 0.12f) : ((_timeOfDay == TimeOfDay.Night) ? new Color(0.02f, 0.03f, 0.08f, 0.18f) : ((_type == WeatherType.Rain) ? new Color(0.08f, 0.12f, 0.22f, 0.12f) : new Color(0.12f, 0.08f, 0.06f, 0.12f)))); _fogMaterial.SetTexture(_mainTexPropID, (Texture)(object)_softCircleTex); _fogMaterial.SetTexture(_altMainTexPropID, (Texture)(object)_softCircleTex); _fogMaterial.SetColor(_colorPropID, val3); _fogMaterial.SetColor(_altColorPropID, val3); } private Texture2D CreateSoftCircleTexture() { //IL_0007: 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_0015: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) int num = 32; Texture2D val = new Texture2D(num, num, (TextureFormat)4, false) { hideFlags = (HideFlags)61 }; float num2 = (float)num / 2f; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num3 = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num2, num2)); float num4 = Mathf.Clamp01(1f - num3 / num2); num4 = Mathf.Pow(num4, 1.8f); val.SetPixel(j, i, new Color(1f, 1f, 1f, num4)); } } val.Apply(); return val; } private Texture2D CreateRainStreakTexture() { //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_001a: 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_0029: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) int num = 16; int num2 = 128; Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false) { hideFlags = (HideFlags)61, wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; for (int i = 0; i < num2; i++) { float num3 = (float)i / ((float)num2 - 1f); float num4; if (!(num3 > 0.82f)) { num4 = ((!(num3 < 0.45f)) ? 1f : Mathf.Pow(num3 / 0.45f, 0.55f)); } else { float num5 = (num3 - 0.82f) / 0.18f; num4 = Mathf.Sqrt(Mathf.Max(0f, 1f - num5 * num5)); } float num6 = Mathf.Pow(num3, 0.5f); float num7 = num4 * 0.45f; for (int j = 0; j < num; j++) { float num8 = Mathf.Abs((float)j / ((float)num - 1f) - 0.5f); float num9 = 0f; if (num8 < num7 && num7 > 0.0001f) { float num10 = num8 / num7; num9 = Mathf.Sqrt(Mathf.Max(0f, 1f - num10 * num10)) * num6; } val.SetPixel(j, i, new Color(1f, 1f, 1f, Mathf.Clamp01(num9))); } } val.Apply(); return val; } private Texture2D CreateSnowflakeTexture() { //IL_0007: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) int num = 32; Texture2D val = new Texture2D(num, num, (TextureFormat)4, false) { hideFlags = (HideFlags)61, wrapMode = (TextureWrapMode)1 }; float num2 = (float)(num - 1) / 2f; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num3 = ((float)j - num2) / num2; float num4 = ((float)i - num2) / num2; float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4); float num6 = Mathf.Clamp01(1f - num5); num6 = Mathf.Pow(num6, 1.4f); num6 *= Mathf.SmoothStep(0f, 0.15f, num6); val.SetPixel(j, i, new Color(1f, 1f, 1f, num6)); } } val.Apply(); return val; } private void InitializeDynamicMesh() { //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_0018: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: 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_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0211: 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_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) _particleMeshGo = new GameObject("WeatherMeshSystem") { hideFlags = (HideFlags)61 }; _meshFilter = _particleMeshGo.AddComponent<MeshFilter>(); _meshRenderer = _particleMeshGo.AddComponent<MeshRenderer>(); ((Renderer)_meshRenderer).sharedMaterial = _particleMaterial; ((Renderer)_meshRenderer).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)_meshRenderer).receiveShadows = false; _particleMesh = new Mesh { name = "DynamicWeatherMesh", hideFlags = (HideFlags)61 }; _particleMesh.MarkDynamic(); int num = _particleCount * _vertsPerParticle; int num2 = _particleCount * _vertsPerParticle / 4 * 6; _vertices = (Vector3[])(object)new Vector3[num]; _uvs = (Vector2[])(object)new Vector2[num]; _colors = (Color[])(object)new Color[num]; _triangles = new int[num2]; Color val = ((_type == WeatherType.Snow) ? new Color(1f, 1f, 1f, 0.92f) : ((_type == WeatherType.Rain) ? new Color(1f, 1f, 1f, 0.95f) : new Color(0.95f, 0.48f, 0.12f, 0.65f))); int num3 = _particleCount * (_vertsPerParticle / 4); for (int i = 0; i < num3; i++) { int num4 = i * 4; int num5 = i * 6; _uvs[num4] = new Vector2(0f, 0f); _uvs[num4 + 1] = new Vector2(1f, 0f); _uvs[num4 + 2] = new Vector2(0f, 1f); _uvs[num4 + 3] = new Vector2(1f, 1f); _colors[num4] = val; _colors[num4 + 1] = val; _colors[num4 + 2] = val; _colors[num4 + 3] = val; _triangles[num5] = num4; _triangles[num5 + 1] = num4 + 2; _triangles[num5 + 2] = num4 + 1; _triangles[num5 + 3] = num4 + 2; _triangles[num5 + 4] = num4 + 3; _triangles[num5 + 5] = num4 + 1; } _particleMesh.SetVertices(Il2CppStructArray<Vector3>.op_Implicit(_vertices)); _particleMesh.SetUVs(0, Il2CppStructArray<Vector2>.op_Implicit(_uvs)); _particleMesh.SetColors(Il2CppStructArray<Color>.op_Implicit(_colors)); _particleMesh.SetTriangles(Il2CppStructArray<int>.op_Implicit(_triangles), 0); _particleMesh.bounds = new Bounds(Vector3.zero, Vector3.one * 60000f); _meshFilter.sharedMesh = _particleMesh; } private void InitLightning() { //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_026d: 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) //IL_0082: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01e6: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_mainCamera == (Object)null) { _mainCamera = Camera.main; _mainCameraTransform = (((Object)(object)_mainCamera != (Object)null) ? ((Component)_mainCamera).transform : null); } if ((Object)(object)_mainCamera == (Object)null || (Object)(object)_mainCameraTransform == (Object)null) { MelonLogger.Error("[WeatherGB] InitLightning: no camera."); return; } _boltLineTex = CreateBoltLineTexture(); _boltGo = new GameObject("WeatherLightning"); _boltGo.layer = 0; _boltFilter = _boltGo.AddComponent<MeshFilter>(); _boltRenderer = _boltGo.AddComponent<MeshRenderer>(); ((Renderer)_boltRenderer).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)_boltRenderer).receiveShadows = false; ((Renderer)_boltRenderer).lightProbeUsage = (LightProbeUsage)0; ((Renderer)_boltRenderer).reflectionProbeUsage = (ReflectionProbeUsage)0; ((Renderer)_boltRenderer).allowOcclusionWhenDynamic = false; ((Renderer)_boltRenderer).enabled = true; _boltMat = CreateBoltMaterial(); if ((Object)(object)_boltMat == (Object)null) { MelonLogger.Error("[WeatherGB] InitLightning: no material."); return; } ((Renderer)_boltRenderer).sharedMaterial = _boltMat; _boltMesh = new Mesh { name = "LightningMesh", hideFlags = (HideFlags)61 }; _boltMesh.MarkDynamic(); _boltMesh.bounds = new Bounds(Vector3.zero, Vector3.one * 8000f); _boltFilter.sharedMesh = _boltMesh; try { GameObject val = new GameObject("LightningLight"); val.layer = 0; val.transform.SetParent(_boltGo.transform, false); _boltLight = val.AddComponent<Light>(); _boltLight.type = (LightType)2; _boltLight.color = new Color(0.55f, 0.8f, 1f); _boltLight.range = 320f; _boltLight.intensity = 0f; _boltLight.shadows = (LightShadows)0; } catch (Exception) { } _boltGo.transform.SetParent(_mainCameraTransform, false); _boltGo.transform.localPosition = Vector3.zero; _boltGo.transform.localRotation = Quaternion.identity; _boltGo.transform.localScale = Vector3.one; _boltGo.SetActive(false); MelonLogger.Msg("[WeatherGB] InitLightning: done. shader='" + ((Object)_boltMat.shader).name + "'"); } catch (Exception value) { MelonLogger.Error($"[WeatherGB] InitLightning FAILED: {value}"); } } private Material CreateBoltMaterial() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) try { Shader val = FindSafeShader(); if ((Object)(object)val == (Object)null) { MelonLogger.Error("[WeatherGB] CreateBoltMaterial: no shader."); return null; } Material val2 = new Material(val) { hideFlags = (HideFlags)61 }; if ((Object)(object)_boltLineTex != (Object)null) { if (val2.HasProperty("_MainTex")) { val2.SetTexture("_MainTex", (Texture)(object)_boltLineTex); } if (val2.HasProperty("_BaseMap")) { val2.SetTexture("_BaseMap", (Texture)(object)_boltLineTex); } } if (val2.HasProperty("_Color")) { val2.SetColor("_Color", Color.white); } if (val2.HasProperty("_BaseColor")) { val2.SetColor("_BaseColor", Color.white); } val2.renderQueue = 3000; MelonLogger.Msg("[WeatherGB] CreateBoltMaterial: using '" + ((Object)val).name + "'"); return val2; } catch (Exception value) { MelonLogger.Error($"[WeatherGB] CreateBoltMaterial FAILED: {value}"); return null; } } private Texture2D CreateBoltLineTexture() { //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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) int num = 32; int num2 = 4; Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false) { hideFlags = (HideFlags)61, wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; for (int i = 0; i < num2; i++) { for (int j = 0; j < num; j++) { float num3 = Mathf.Abs((float)j / ((float)num - 1f) - 0.5f) * 2f; float num4 = Mathf.Pow(Mathf.Max(0f, 1f - num3), 7f); float num5 = Mathf.Pow(Mathf.Max(0f, 1f - num3), 1.3f) * 0.4f; float num6 = Mathf.Clamp01(num4 + num5); val.SetPixel(j, i, new Color(1f, 1f, 1f, num6)); } } val.Apply(); return val; } private void FireLightning() { //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: 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_02b1: 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_02c5: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)_boltGo == (Object)null) && !((Object)(object)_mainCamera == (Object)null) && !((Object)(object)_boltMesh == (Object)null)) { if ((Object)(object)_mainCameraTransform != (Object)(object)((Component)_mainCamera).transform) { _mainCameraTransform = ((Component)_mainCamera).transform; _boltGo.transform.SetParent(_mainCameraTransform, false); _boltGo.transform.localPosition = Vector3.zero; _boltGo.transform.localRotation = Quaternion.identity; _boltGo.transform.localScale = Vector3.one; } float num = Random.Range(45f, 68f); float num2 = num * Mathf.Tan(_mainCamera.fieldOfView * 0.5f * ((float)Math.PI / 180f)); float num3 = num2 * _mainCamera.aspect; _boltSkeletons.Clear(); BoltSkeleton boltSkeleton = new BoltSkeleton(); float num4 = Random.Range(-0.62f, 0.62f) * num3 + Random.Range(-2f, 2f); float num5 = num2 * Random.Range(1.1f, 1.45f) + 10f; float num6 = (0f - num2) * Random.Range(0.55f, 1f) - 2f; float num7 = num4 + Random.Range((0f - num3) * 0.16f, num3 * 0.16f); boltSkeleton.top = new Vector3(num4, num5, num); boltSkeleton.bot = new Vector3(num7, num6, num + Random.Range(-3f, 3f)); boltSkeleton.dist = num; boltSkeleton.widthPx = Random.Range(11f, 15f); boltSkeleton.rough = Random.Range(0.16f, 0.23f); boltSkeleton.depth = 5; int num8 = Random.Range(3, 6); for (int i = 0; i < num8; i++) { float num9 = Random.Range(0.22f, 0.55f); boltSkeleton.branches.Add(MakeBranch(Random.Range(0.1f, 0.62f), Random.Range(24f, 52f), num9, boltSkeleton.widthPx * Random.Range(0.34f, 0.55f), 0.8f, Random.Range(0.22f, 0.3f), 4, (num9 > 0.4f) ? 2 : 0)); } _boltSkeletons.Add(boltSkeleton); Vector3 val = (boltSkeleton.top + boltSkeleton.bot) * 0.5f; if ((Object)(object)_boltLight != (Object)null) { ((Component)_boltLight).transform.localPosition = new Vector3(val.x, val.y, val.z * 0.85f); } _boltAnimTimer = 0f; ((Renderer)_boltRenderer).enabled = true; _boltGo.SetActive(true); RegenerateBolt(1f, 1f); MelonLogger.Msg($"[WeatherGB] FireLightning: 1 bolt, dist={num:F1}, forks={num8}"); } } catch (Exception value) { MelonLogger.Error($"[WeatherGB] FireLightning FAILED: {value}"); } } private BranchSkeleton MakeBranch(float t, float angle, float lenF, float widthPx, float alphaMul, float rough, int depth, int childCount) { BranchSkeleton branchSkeleton = new BranchSkeleton { t = t, angleDeg = angle, side = ((Random.value < 0.5f) ? (-1f) : 1f), lenFactor = lenF, widthPx = widthPx, alphaMul = alphaMul, rough = rough, depth = depth }; int num = ((childCount > 0) ? Random.Range(0, childCount + 1) : 0); for (int i = 0; i < num; i++) { branchSkeleton.children.Add(MakeBranch(Random.Range(0.25f, 0.8f), Random.Range(28f, 60f), Random.Range(0.25f, 0.55f), widthPx * 0.6f, alphaMul * 0.7f, rough + 0.05f, Mathf.Max(2, depth - 1), 0)); } return branchSkeleton; } private void RegenerateBolt(float crackle, float curve) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0067: Unknown result type (might be due to invalid IL or missing references) try { _gv.Clear(); _guv.Clear(); _gcol.Clear(); _gtri.Clear(); ReleasePolys(); for (int i = 0; i < _boltSkeletons.Count; i++) { BoltSkeleton boltSkeleton = _boltSkeletons[i]; float num = Vector3.Distance(boltSkeleton.top, boltSkeleton.bot); List<Vector3> poly = GetPoly(); Fractal(boltSkeleton.top, boltSkeleton.bot, num * boltSkeleton.rough * crackle, boltSkeleton.depth, poly); EmitChannel(poly, boltSkeleton.widthPx, boltSkeleton.dist, 1f, curve); for (int j = 0; j < boltSkeleton.branches.Count; j++) { BuildBranch(poly, num, boltSkeleton.branches[j], boltSkeleton.dist, crackle, curve); } } UploadBoltMesh(); } catch (Exception value) { MelonLogger.Error($"[WeatherGB] RegenerateBolt FAILED: {value}"); ReleasePolys(); } } private void BuildBranch(List<Vector3> parent, float parentLen, BranchSkeleton br, float dist, float crackle, float curve) { //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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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) //IL_007d: Unknown result type (might be due to invalid IL or missing references) int count = parent.Count; if (count >= 3) { int num = Mathf.Clamp(Mathf.RoundToInt(br.t * (float)(count - 1)), 1, count - 2); Vector3 val = parent[num]; Vector3 val2 = parent[num + 1] - parent[num - 1]; if (((Vector3)(ref val2)).sqrMagnitude < 1E-05f) { val2 = parent[num] - parent[num - 1]; } if (((Vector3)(ref val2)).sqrMagnitude < 1E-05f) { val2 = Vector3.down; } ((Vector3)(ref val2)).Normalize(); Vector3 val3 = Quaternion.AngleAxis(br.side * br.angleDeg, Vector3.forward) * val2; Vector3 val4 = val + val3 * (parentLen * br.lenFactor); List<Vector3> poly = GetPoly(); Fractal(val, val4, parentLen * br.lenFactor * br.rough * crackle, br.depth, poly); EmitChannel(poly, br.widthPx, dist, br.alphaMul, curve); float parentLen2 = Vector3.Distance(val, val4); for (int i = 0; i < br.children.Count; i++) { BuildBranch(poly, parentLen2, br.children[i], dist, crackle, curve); } } } private void Fractal(Vector3 a, Vector3 b, float jitter, int depth, List<Vector3> dest) { //IL_0015: 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_003c: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_005b: 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_006a: 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_006e: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_009a: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = _fractA; List<Vector3> list2 = _fractB; list.Clear(); list.Add(a); list.Add(b); float num = jitter; for (int i = 0; i < depth; i++) { list2.Clear(); for (int j = 0; j < list.Count - 1; j++) { Vector3 val = list[j]; Vector3 val2 = list[j + 1]; list2.Add(val); Vector3 val3 = (val + val2) * 0.5f; Vector3 val4 = val2 - val; float magnitude = ((Vector3)(ref val4)).magnitude; Vector3 val5 = ((magnitude > 0.0001f) ? (val4 / magnitude) : Vector3.down); Vector3 val6 = Vector3.Cross(val5, Vector3.forward); if (((Vector3)(ref val6)).sqrMagnitude < 0.0001f) { val6 = Vector3.right; } else { ((Vector3)(ref val6)).Normalize(); } Vector3 val7 = Vector3.Cross(val5, val6); Vector3 normalized = ((Vector3)(ref val7)).normalized; val3 += val6 * Random.Range(0f - num, num) + normalized * Random.Range((0f - num) * 0.22f, num * 0.22f); list2.Add(val3); } list2.Add(list[list.Count - 1]); List<Vector3> list3 = list; list = list2; list2 = list3; num *= 0.55f; } dest.Clear(); dest.AddRange(list); } private void EmitChannel(List<Vector3> pts, float baseWidthPx, float dist, float alphaMul, float curve) { //IL_000a: 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) AddRibbon(pts, baseWidthPx * 2.6f, dist, BOLT_GLOW, alphaMul * 0.42f, curve); AddRibbon(pts, baseWidthPx * 0.6f, dist, BOLT_CORE, alphaMul * 1f, curve); } private void AddRibbon(List<Vector3> pts, float widthPx, float dist, Color color, float alphaMul, float curve) { //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_0042: 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_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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_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_0075: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00a2: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) int count = pts.Count; if (count < 2) { return; } float num = UnitsPerPixel(dist); float num2 = widthPx * 0.5f * num; int count2 = _gv.Count; for (int i = 0; i < count; i++) { Vector3 val = pts[i]; Vector3 val2 = ((i == 0) ? (pts[1] - pts[0]) : ((i != count - 1) ? (pts[i + 1] - pts[i - 1]) : (pts[i] - pts[i - 1]))); if (((Vector3)(ref val2)).sqrMagnitude < 1E-05f) { val2 = Vector3.down; } ((Vector3)(ref val2)).Normalize(); Vector3 val3 = Vector3.Cross(val2, Vector3.forward); if (((Vector3)(ref val3)).sqrMagnitude < 1E-05f) { val3 = Vector3.right; } else { ((Vector3)(ref val3)).Normalize(); } float num3 = (float)i / (float)(count - 1); float num4 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(Mathf.Min(num3, 1f - num3) / 0.1f)); float num5 = num2 * num4; float num6 = alphaMul * num4 * curve; _gv.Add(val - val3 * num5); _gv.Add(val + val3 * num5); _guv.Add(new Vector2(0f, num3)); _guv.Add(new Vector2(1f, num3)); _gcol.Add(new Color(color.r, color.g, color.b, num6)); _gcol.Add(new Color(color.r, color.g, color.b, num6)); } for (int j = 0; j < count - 1; j++) { int num7 = count2 + j * 2; _gtri.Add(num7); _gtri.Add(num7 + 2); _gtri.Add(num7 + 1); _gtri.Add(num7 + 2); _gtri.Add(num7 + 3); _gtri.Add(num7 + 1); } } private float UnitsPerPixel(float dist) { int num = (((Object)(object)_mainCamera != (Object)null) ? Mathf.Max(1, _mainCamera.pixelHeight) : 1080); float num2 = (((Object)(object)_mainCamera != (Object)null) ? _mainCamera.fieldOfView : 60f); return 2f * dist * Mathf.Tan(num2 * 0.5f * ((float)Math.PI / 180f)) / (float)num; } private void UploadBoltMesh() { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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) if (!((Object)(object)_boltMesh == (Object)null)) { _boltMesh.Clear(); if (_gv.Count > 0) { _boltMesh.SetVertices(Il2CppStructArray<Vector3>.op_Implicit(_gv.ToArray())); _boltMesh.SetUVs(0, Il2CppStructArray<Vector2>.op_Implicit(_guv.ToArray())); _boltMesh.SetColors(Il2CppStructArray<Color>.op_Implicit(_gcol.ToArray())); _boltMesh.SetTriangles(Il2CppStructArray<int>.op_Implicit(_gtri.ToArray()), 0); _boltMesh.RecalculateBounds(); } else { _boltMesh.bounds = new Bounds(Vector3.zero, Vector3.one * 8000f); } } } private List<Vector3> GetPoly() { int count = _freePolys.Count; List<Vector3> list = ((count > 0) ? _freePolys[count - 1] : new List<Vector3>(32)); if (count > 0) { _freePolys.RemoveAt(count - 1); } list.Clear(); _activePolys.Add(list); return list; } private void ReleasePolys() { for (int i = 0; i < _activePolys.Count; i++) { _activePolys[i].Clear(); _freePolys.Add(_activePolys[i]); } _activePolys.Clear(); } private void SetBoltIntensity(float k) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_boltMat != (Object)null) { if (_boltMat.HasProperty("_Color")) { _boltMat.SetColor("_Color", Color.white); } if (_boltMat.HasProperty("_BaseColor")) { _boltMat.SetColor("_BaseColor", Color.white); } } if ((Object)(object)_boltLight != (Object)null) { _boltLight.intensity = Mathf.Clamp01(k) * 8f; } if (!_boltIntensityLogged && k > 0.01f) { _boltIntensityLogged = true; MelonLogger.Msg($"[WeatherGB] SetBoltIntensity: curve={k:F2}"); } } catch (Exception value) { MelonLogger.Error($"[WeatherGB] SetBoltIntensity FAILED: {value}"); } } private void CacheGameFogGlobals() { //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_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) _origGameSkyColor = Shader.GetGlobalColor(idSkyColorProp); _origGameFogColor = Shader.GetGlobalColor(idFogColorProp); _origGameScatter = Shader.GetGlobalFloat(idFogLightScatterIntensityProp); _origGameSkyFogElevation = Shader.GetGlobalFloat(idSkyFogElevationProp); _origGameSkyFogMaxDepth = Shader.GetGlobalFloat(idSkyFogMaxDepthProp); _origGameGroundFogElevation = Shader.GetGlobalFloat(idGroundFogElevationProp); _origGameGroundFogMaxDepth = Shader.GetGlobalFloat(idGroundFogMaxDepthProp); } private static void SetGameFog(Color skyColor, Color fogColor, float scatter, float skyFogElevation, float skyFogMaxDepth, float groundFogElevation, float groundFogMaxDepth) { //IL_0005: 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) Shader.SetGlobalColor(idSkyColorProp, skyColor); Shader.SetGlobalColor(idFogColorProp, fogColor); Shader.SetGlobalFloat(idFogLightScatterIntensityProp, Mathf.Clamp01(scatter)); Shader.SetGlobalFloat(idSkyFogElevationProp, Mathf.Max(0.001f, skyFogElevation)); Shader.SetGlobalFloat(idSkyFogMaxDepthProp, Mathf.Max(0.001f, skyFogMaxDepth)); Shader.SetGlobalFloat(idGroundFogElevationProp, groundFogElevation); Shader.SetGlobalFloat(idGroundFogMaxDepthProp, Mathf.Max(0.001f, groundFogMaxDepth)); } private void RestoreGameFogGlobals() { //IL_0006: 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) Shader.SetGlobalColor(idSkyColorProp, _origGameSkyColor); Shader.SetGlobalColor(idFogColorProp, _origGameFogColor); Shader.SetGlobalFloat(idFogLightScatterIntensityProp, _origGameScatter); Shader.SetGlobalFloat(idSkyFogElevationProp, _origGameSkyFogElevation); Shader.SetGlobalFloat(idSkyFogMaxDepthProp, _origGameSkyFogMaxDepth); Shader.SetGlobalFloat(idGroundFogElevationProp, _origGameGroundFogElevation); Shader.SetGlobalFloat(idGroundFogMaxDepthProp, _origGameGroundFogMaxDepth); } private void FindDirectionalLights() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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 (_lightsCached) { return; } foreach (Light item in Object.FindObjectsOfType<Light>()) { if ((Object)(object)item != (Object)null && (int)item.type == 1) { if (!_directionalLights.Contains(item)) { _directionalLights.Add(item); } if (!_originalIntensities.ContainsKey(item)) { _originalIntensities[item] = item.intensity; _originalColors[item] = item.color; _originalLightIntensity = item.intensity; } } } _originalAmbientColor = RenderSettings.ambientLight; _originalAmbientIntensity = RenderSettings.ambientIntensity; _originalReflectionIntensity = RenderSettings.reflectionIntensity; _originalAmbientMode = RenderSettings.ambientMode; _lightsCached = true; } private void RemoveSubwayReflectionProbes() { Il2CppArrayBase<ReflectionProbe> obj = Object.FindObjectsOfType<ReflectionProbe>(); int num = 0; foreach (ReflectionProbe item in obj) { if (!((Object)(object)item == (Object)null)) { Object.Destroy((Object)(object)item); num++; } } MelonLogger.Msg($"[WeatherGB] Subway: removed {num} reflection probe(s)."); } private void ApplyTrawlerStyleFog(float densityMultiplier) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (densityMultiplier <= 0f) { densityMultiplier = 1f; } Color fogColor = default(Color); ((Color)(ref fogColor))..ctor(0.9f, 0.98f, 1f); float fogDensity = 0.02f * densityMultiplier; RenderSettings.fog = true; RenderSettings.fogMode = (FogMode)3; RenderSettings.fogColor = fogColor; RenderSettings.fogDensity = fogDensity; SetGameFog(new Color(0.95f, 1f, 1f), fogColor, 1f, 500f, 400f, -10f, 60f * densityMultiplier); } private void ApplyDayLighting() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_005d: Unknown result type (might be due to invalid IL or missing references) int count = _directionalLights.Count; for (int i = 0; i < count; i++) { Light val = _directionalLights[i]; if (!((Object)(object)val == (Object)null)) { val.intensity = (_originalIntensities.ContainsKey(val) ? _originalIntensities[val] : 1f); val.color = new Color(1f, 0.96f, 0.88f); } } RenderSettings.ambientMode = (AmbientMode)3; RenderSettings.ambientLight = new Color(0.75f, 0.8f, 0.9f); RenderSettings.ambientIntensity = 1f; RenderSettings.reflectionIntensity = 1f; RenderSettings.fog = false; SetGameFog(new Color(0.65f, 0.78f, 0.95f), new Color(0.75f, 0.85f, 0.98f), 0.15f, 500f, 800f, -5f, 20f); if (_sceneName.Contains("wheel") || _sceneName.Contains("train")) { ApplyTrawlerStyleFog(1f); } else if (_sceneName.Contains("truck")) { ApplyTrawlerStyleFog(0.32f); } else if (_sceneName.Contains("tower")) { ApplyTrawlerStyleFog(1f); } } private void ApplyEveningLighting() { //IL_0068: 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_00c4: 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_0041: Unknown result type (might be due to invalid IL or missing references) int count = _directionalLights.Count; for (int i = 0; i < count; i++) { Light val = _directionalLights[i]; if (!((Object)(object)val == (Object)null)) { val.intensity = 0.65f; val.color = new Color(0.95f, 0.48f, 0.28f); } } RenderSettings.ambientMode = (AmbientMode)3; RenderSettings.ambientLight = new Color(0.38f, 0.22f, 0.28f); RenderSettings.ambientIntensity = 1f; RenderSettings.reflectionIntensity = 0.6f; RenderSettings.fog = true; RenderSettings.fogMode = (FogMode)3; RenderSettings.fogColor = new Color(0.5f, 0.32f, 0.42f); RenderSettings.fogDensity = 0.008f; SetGameFog(new Color(0.95f, 0.65f, 0.55f), new Color(0.62f, 0.42f, 0.52f), 0.5f, 500f, 600f, -5f, 30f); } private void ApplyDuskLighting(float brightness) { //IL_003c: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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) if (brightness <= 0f) { brightness = 1f; } Color color = default(Color); ((Color)(ref color))..ctor(1f, 0.74f, 0.68f); float intensity = 0.2f * brightness; Color ambientLight = new Color(0.11f, 0.1f, 0.19f) * brightness; Color fogColor = default(Color); ((Color)(ref fogColor))..ctor(0.28f, 0.2f, 0.36f); int count = _directionalLights.Count; for (int i = 0; i < count; i++) { Light val = _directionalLights[i]; if (!((Object)(object)val == (Object)null)) { val.intensity = intensity; val.color = color; val.shadowStrength = 0.55f; } } RenderSettings.ambientMode = (AmbientMode)3; RenderSettings.ambientLight = ambientLight; RenderSettings.ambientIntensity = 1f; RenderSettings.reflectionIntensity = Mathf.Clamp01(0.22f * brightness); RenderSettings.fog = true; RenderSettings.fogMode = (FogMode)3; RenderSettings.fogColor = fogColor; RenderSettings.fogDensity = 0.012f; SetGameFog(new Color(0.3f, 0.22f, 0.38f), new Color(0.32f, 0.22f, 0.38f), 0.4f, 500f, 400f, -5f, 30f); } private void ApplyTrawlerNightLighting() { //IL_00a1: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) Color color = default(Color); ((Color)(ref color))..ctor(0.9f, 0.98f, 1f); float intensity = 1.2f; Color ambientLight = default(Color); ((Color)(ref ambientLight))..ctor(0.72f, 0.88f, 0.98f); Color fogColor = default(Color); ((Color)(ref fogColor))..ctor(0.9f, 0.98f, 1f); int count = _directionalLights.Count; for (int i = 0; i < count; i++) { Light val = _directionalLights[i]; if (!((Object)(object)val == (Object)null)) { val.intensity = intensity; val.color = color; val.shadowStrength = 0.3f; } } RenderSettings.ambientMode = (AmbientMode)3; RenderSettings.ambientLight = ambientLight; RenderSettings.ambientIntensity = 1f; RenderSettings.reflectionIntensity = 0.95f; RenderSettings.fog = true; RenderSettings.fogMode = (FogMode)3; RenderSettings.fogColor = fogColor; RenderSettings.fogDensity = 0.02f; SetGameFog(new Color(0.95f, 1f, 1f), new Color(0.9f, 0.98f, 1f), 1f, 500f, 400f, -10f, 60f); } private void ApplyIndoorLighting(float brightness) { //IL_0084: 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_00c4: 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_0052: Unknown result type (might be due to invalid IL or missing references) if (brightness <= 0f) { brightness = 1f; } int count = _directionalLights.Count; for (int i = 0; i < count; i++) { Light val = _directionalLights[i]; if (!((Object)(object)val == (Object)null)) { val.intensity = 0.35f * brightness; val.color = new Color(0.95f, 0.88f, 0.78f); val.shadowStrength = 0.6f; } } RenderSettings.ambientMode = (AmbientMode)3; RenderSettings.ambientLight = new Color(0.16f, 0.15f, 0.18f) * brightness; RenderSettings.ambientIntensity = 1f; RenderSettings.reflectionIntensity = Mathf.Clamp01(0.25f * brightness); RenderSettings.fog = false; SetGameFog(new Color(0.02f, 0.02f, 0.03f), new Color(0.04f, 0.04f, 0.06f), 0f, 500f, 0.001f, -1000f, 0.001f); } private void ApplyNightLighting() { if (_isTrawler) { ApplyTrawlerNightLighting(); } else if (_sceneName.Contains("crane")) { ApplyDuskLighting(1f); } else if (_sceneName.Contains("lighthouse")) { ApplyDuskLighting(1f); } else if (_sceneName.Contains("tower")) { ApplyDuskLighting(1f); } else if (_sceneName.Contains("elevator")) { ApplyDuskLighting(1.5f); } else if (_sceneName.Contains("roof")) { ApplyDuskLighting(1.9f); } else if (_sceneName.Contains("train")) { ApplyDuskLighting(1.6f); } else if (_sceneName.Contains("blimp")) { ApplyDuskLighting(1.3f); } else if (_sceneName.Contains("menu") || _sceneName.Contains("customization")) { ApplyDuskLighting(1.25f); } else { ApplyDuskLighting(1.35f); } } private void ApplyLighthouseLighting() { //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_0081: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0039: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_013f: 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) if (_timeOfDay == TimeOfDay.Night) { ApplyDuskLighting(1f); return; } float intensity; Color color; Color ambientLight; float reflectionIntensity; float shadowStrength; FogMode fogMode; Color fogColor; Color skyColor; float fogDensity; if (_timeOfDay == TimeOfDay.Evening) { intensity = 0.6f; color = HexToColor("#ffa159"); ambientLight = HexToColor("#5d3440"); reflectionIntensity = 0.55f; shadowStrength = 0.95f; fogMode = (FogMode)2; fogColor = HexToColor("#3b3b62"); skyColor = HexToColor("#8b5f78"); fogDensity = 0.014f; } else { intensity = 2f; color = HexToColor("#fff8e6"); ambientLight = HexToColor("#c3cfdf"); reflectionIntensity = 1f; shadowStrength = 0.9f; fogMode = (FogMode)3; fogColor = HexToColor("#a8bcd4"); skyColor = HexToColor("#c3d4e6"); fogDensity = 0.006f; } int count = _directionalLights.Count; for (int i = 0; i < count; i++) { Light val = _directionalLights[i]; if (!((Object)(object)val == (Object)null)) { val.intensity = intensity; val.color = color; val.shadowStrength = shadowStrength; } } RenderSettings.ambientMode = (AmbientMode)3; RenderSettings.ambientLight = ambientLight; RenderSettings.ambientIntensity = 1f; RenderSettings.reflectionIntensity = reflectionIntensity; RenderSettings.fog = true; RenderSettings.fogMode = fogMode; RenderSettings.fogColor = fogColor; RenderSettings.fogDensity = fogDensity; SetGameFog(skyColor, fogColor, (_timeOfDay == TimeOfDay.Evening) ? 0.55f : 0.2f, 500f, (_timeOfDay == TimeOfDay.Evening) ? 550f : 800f, -5f, (_timeOfDay == TimeOfDay.Evening) ? 30f : 20f); } private void ApplyCraneLighting() { if (_timeOfDay == TimeOfDay.Evening) { ApplyDuskLighting(1f); } else if (_timeOfDay == TimeOfDay.Day) { ApplyDayLighting(); ApplyCraneDayFog(); } else { ApplyDuskLighting(1f); } } private void ApplyCraneDayFog() { //IL_001b: 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_0052: Unknown result type (might be due to invalid IL or missing references) RenderSettings.fog = true; RenderSettings.fogMode = (FogMode)3; RenderSettings.fogColor = new Color(0.55f, 0.7f, 0.88f); RenderSettings.fogDensity = 0.008f; SetGameFog(new Color(0.68f, 0.82f, 0.96f), new Color(0.6f, 0.76f, 0.92f), 0.3f, 500f, 700f, -5f, 30f); } private void ApplyTimeOfDayLighting() { if (_isIndoor) { ApplyIndoorLighting(1f); } else if (_isLighthouse) { ApplyLighthouseLighting(); } else if (_isCrane) { ApplyCraneLighting(); } else if (_timeOfDay == TimeOfDay.Day) { ApplyDayLighting(); } else if (_timeOfDay == TimeOfDay.Evening) { ApplyEveningLighting(); } else if (_timeOfDay == TimeOfDay.Night) { ApplyNightLighting(); } } private static Color HexToColor(string hex) { //IL_0086: 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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(hex)) { return Color.white; } if (hex[0] == '#') { hex = hex.Substring(1); } if (hex.Length < 6) { return Color.white; } try { byte num = Convert.ToByte(hex.Substring(0, 2), 16); byte b = Convert.ToByte(hex.Substring(2, 2), 16); byte b2 = Convert.ToByte(hex.Substring(4, 2), 16); return new Color((float)(int)num / 255f, (float)(int)b / 255f, (float)(int)b2 / 255f, 1f); } catch { return Color.white; } } private static bool IsActorRenderer(string rName) { if (rName.IndexOf("Actor", StringComparison.OrdinalIgnoreCase) < 0 && rName.IndexOf("Ragdoll", StringComparison.OrdinalIgnoreCase) < 0 && rName.IndexOf("Player", StringComparison.OrdinalIgnoreCase) < 0) { return rName.IndexOf("Costume", StringComparison.OrdinalIgnoreCase) >= 0; } return true; } private static bool HasNormalMap(Material mat) { if (mat.HasProperty("_BumpMap") && (Object)(object)mat.GetTexture("_BumpMap") != (Object)null) { return true; } if (mat.HasProperty("_NormalMap") && (Object)(object)mat.GetTexture("_NormalMap") != (Object)null) { return true; } return false; } private static bool HasDetailNormalMap(Material mat) { if (mat.HasProperty("_DetailNormalMap")) { return (Object)(object)mat.GetTexture("_DetailNormalMap") != (Object)null; } return false; } private void BlendFloatProperty(Material mat, string prop, float target, float blend, Dictionary<Material, float> store) { if (mat.HasProperty(prop)) { if (!store.TryGetValue(mat, out var value)) { value = (store[mat] = mat.GetFloat(prop)); } mat.SetFloat(prop, Mathf.Lerp(value, target, blend)); } } private void RestoreFloatProperties(Dictionary<Material, float> store, string prop) { foreach (KeyValuePair<Material, float> item in store) { if ((Object)(object)item.Key != (Object)null && item.Key.HasProperty(prop)) { item.Key.SetFloat(prop, item.Value); } } store.Clear(); } private void ApplyInteriorMaterialTweaks(float normalStrength, bool applySurfaceTweaks = true) { foreach (MeshRenderer item in Object.FindObjectsOfType<MeshRenderer>()) { if ((Object)(object)item == (Object)null || (Object)(object)((Component)item).gameObject == (Object)null || IsActorRenderer(((Object)((Component)item).gameObject).name)) { continue; } Il2CppReferenceArray<Material> sharedMaterials = ((Renderer)item).sharedMaterials; if (sharedMaterials == null) { continue; } foreach (Material item2 in (Il2CppArrayBase<Material>)(object)sharedMaterials) { if ((Object)(object)item2 == (Object)null || !_modifiedMaterials.Add(item2)) { continue; } if (HasNormalMap(item2)) { if (item2.HasProperty("_BumpScale")) { if (!_originalBumpScales.ContainsKey(item2)) { _originalBumpScales[item2] = item2.GetFloat("_BumpScale"); } item2.SetFloat("_BumpScale", normalStrength); } if (item2.HasProperty("_NormalScale")) { if (!_originalNormalScales.ContainsKey(item2)) { _originalNormalScales[item2] = item2.GetFloat("_NormalScale"); } item2.SetFloat("_NormalScale", normalStrength); } } if (HasDetailNormalMap(item2) && item2.HasProperty("_DetailNormalMapScale")) { if (!_originalDetailNormalScales.ContainsKey(item2)) { _originalDetailNormalScales[item2] = item2.GetFloat("_DetailNormalMapScale"); } item2.SetFloat("_DetailNormalMapScale", normalStrength); } if (applySurfaceTweaks) { BlendFloatProperty(item2, "_Glossiness", 0.35f, 0.3f, _originalGlossiness); BlendFloatProperty(item2, "_Smoothness", 0.35f, 0.3f, _originalSmoothness); BlendFloatProperty(item2, "_GlossMapScale", 0.35f, 0.3f, _originalGlossMapScale); BlendFloatProperty(item2, "_Metallic", 0.05f, 0.3f, _originalMetallic); BlendFloatProperty(item2, "_Roughness", 0.65f, 0.3f, _originalRoughness); } } } } private void ApplyOutdoorSceneTweaks() { //IL_0185: 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_0203: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: 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_0208: Unknown result type (might be due to invalid IL or missing references) //IL_021f: 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_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0279: 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) bool flag = _sceneName.Contains("roof") || _sceneName.Contains("trawler") || _sceneName.Contains("lighthouse"); float num = 0.96f; if (_type == WeatherType.Snow) { num = 0.05f; } else if (_type == WeatherType.Ash) { num = 0.2f; } float target = ((_type == WeatherType.Rain) ? 0.2f : 0f); foreach (Renderer item in Object.FindObjectsOfType<Renderer>()) { if ((Object)(object)item == (Object)null || (Object)(object)((Component)item).gameObject == (Object)null) { continue; } string name = ((Object)((Component)item).gameObject).name; Il2CppReferenceArray<Material> sharedMaterials = item.sharedMaterials; if (sharedMaterials == null) { continue; } bool flag2 = item is MeshRenderer; foreach (Material item2 in (Il2CppArrayBase<Material>)(object)sharedMaterials) { if ((Object)(object)item2 == (Object)null) { continue; } string text = ((Object)item2).name.ToLower(); if (text.Contains("water") || text.Contains("ocean") || text.Contains("foam") || (text.Contains("sea") && !text.Contains("seat"))) { if (!_originalWaterEmission.ContainsKey(item2) && item2.HasProperty("_EmissionColor")) { _originalWaterEmission[item2] = item2.GetColor("_EmissionColor"); } if (!_originalWaterFoam.ContainsKey(item2) && item2.HasProperty("_FoamColor")) { _originalWaterFoam[item2] = item2.GetColor("_FoamColor"); } item2.EnableKeyword("_EMISSION"); Color val = (_isTrawler ? (new Color(0.3f, 0.85f, 1f) * 1.6f) : (Color.white * 1.25f)); if (item2.HasProperty("_EmissionColor")) { item2.SetColor("_EmissionColor", val); } if (item2.HasProperty("_FoamColor")) { item2.SetColor("_FoamColor", Color.white); } if (item2.HasProperty("_EdgeColor")) { item2.SetColor("_EdgeColor", Color.white); } if (item2.HasProperty("_RimColor")) { item2.SetColor("_RimColor", Color.white); } if (item2.HasProperty("_IntersectionColor")) { item2.SetColor("_IntersectionColor", Color.white); } if (item2.HasProperty("_Foam")) { item2.SetFloat("_Foam", 1f); } if (item2.HasProperty("_FoamAmount")) { item2.SetFloat("_FoamAmount", 0.65f); } } else if (flag && flag2 && !IsActorRenderer(name) && _modifiedMaterials.Add(item2)) { BlendFloatProperty(item2, "_Glossiness", num, 0.75f, _originalGlossiness); BlendFloatProperty(item2, "_Smoothness", num, 0.75f, _originalSmoothness); BlendFloatProperty(item2, "_GlossMapScale", num, 0.75f, _originalGlossMapScale); BlendFloatProperty(item2, "_Metallic", target, 0.75f, _originalMetallic); BlendFloatProperty(item2, "_Roughness", 1f - num, 0.75f, _originalRoughness); item2.EnableKeyword("_GLOSSYREFLECTIONS_ON"); item2.EnableKeyword("_SPECULARHIGHLIGHTS_ON"); } } } } private void ApplyAtmosphericSettings() { RenderSettings.ambientMode = (AmbientMode)3; try { foreach (Volume item in Object.FindObjectsOfType<Volume>()) { if ((Object)(object)item == (Object)null || (Object)(object)item.sharedProfile == (Object)null) { continue; } VolumeProfile sharedProfile = item.sharedProfile; FieldInfo fieldInfo = ((object)sharedProfile).GetType().GetField("components", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? ((object)sharedProfile).GetType().GetField("settings", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (fieldInfo == null || !(fieldInfo.GetValue(sharedProfile) is IList list)) { continue; } foreach (object item2 in list) { if (item2 == null) { continue; } string name = item2.GetType().Name; if (!name.Contains("Vignette") && !name.Contains("ChromaticAberration")) { continue; } FieldInfo field = item2.GetType().GetField("intensity", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(item2); PropertyInfo property = value.GetType().GetProperty("value"); PropertyInfo property2 = value.GetType().GetProperty("overrideState"); float num = (name.Contains("Vignette") ? 0.45f : 0.6f); if (property != null) { property.SetValue(value, num); } if (property2 != null) { property2.SetValue(value, true); } } } } } catch (Exception) { } } private void SpawnHeadlights() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (!_sceneName.Contains("truck")) { return; } Scene activeScene = SceneManager.GetActiveScene(); foreach (GameObject item in (Il2CppArrayBase<GameObject>)(object)((Scene)(ref activeScene)).GetRootGameObjects()) { FindAndSetupTruckHeadlights(item.transform); } } private void FindAndSetupTruckHeadlights(Transform t) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)t == (Object)null)) { string text = ((Object)t).name.ToLower(); if ((text == "cab" || text == "truck") && (Object)(object)t.Find("WeatherHeadlightL") == (Object)null) { CreateHeadlight(t, new Vector3(-1.1f, 0.8f, 2.8f), "WeatherHeadlightL"); CreateHeadlight(t, new Vector3(1.1f, 0.8f, 2.8f), "WeatherHeadlightR"); } for (int i = 0; i < t.childCount; i++) { FindAndSetupTruckHeadlights(t.GetChild(i)); } } } private void CreateHeadlight(Transform parent, Vector3 localPos, string name) { //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_0013: 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_001f: 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_004b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = localPos; val.transform.localRotation = Quaternion.Euler(15f, 0f, 0f); Light obj = val.AddComponent<Light>(); obj.type = (LightType)0; obj.color = Color.white; obj.intensity = 18f; obj.range = 50f; obj.spotAngle = 50f; } private void SetupAudio() { //IL_0017: 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_0029: Expected O, but got Unknown if (_type == WeatherType.None || _isLighthouse) { return; } _audioHost = new GameObject("WeatherAudioHost") { hideFlags = (HideFlags)61 }; _weatherAudioSource = _audioHost.AddComponent<AudioSource>(); _thunderAudioSource = _audioHost.AddComponent<AudioSource>(); _weatherAudioSource.spatialBlend = 0f; _thunderAudioSource.spatialBlend = 0f; string text = Path.Combine(Application.dataPath, "..", "Mods"); if (_type != WeatherType.Ash) { string path = ((_type == WeatherType.Snow) ? "snowloop.wav" : "rainloop.wav"); _weatherClip = LoadWavFromFile(Path.Combine(text, path)); if ((Object)(object)_weatherClip != (Object)null) { _weatherAudioSource.clip = _weatherClip; _weatherAudioSource.loop = true; _weatherAudioSource.volume = 0.45f; _weatherAudioSource.Play(); } } _thunderClips.Clear(); HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase); string[] array = new string[5] { "thunder 1.wav", "thunder 2.wav", "thunder1.wav", "thunder2.wav", "thunder.wav" }; foreach (string path2 in array) { string text2 = Path.Combine(text, path2); if (File.Exists(text2) && hashSet.Add(text2)) { AudioClip val = LoadWavFromFile(text2); if ((Object)(object)val != (Object)null) { _thunderClips.Add(val); } } } if (Directory.Exists(text)) { try { array = Directory.GetFiles(text, "*thunder*.wav", SearchOption.TopDirectoryOnly); foreach (string text3 in array) { if (hashSet.Add(text3)) { AudioClip val2 = LoadWavFromFile(text3); if ((Object)(object)val2 != (Object)null) { _thunderClips.Add(val2); } } } } catch (Exception) { } } MelonLogger.Msg($"[WeatherGB] Loaded {_thunderClips.Count} thunder sound effect(s)."); } private float GetThunderVolume(AudioClip clip) { if ((Object)(object)clip == (Object)null) { return 1f; } string text = ((Object)clip).name.ToLower(); if (text.Contains("2")) { return Random.Range(0.42f, 0.48f); } if (text.Contains("1")) { return Random.Range(1f, 1.15f); } return Random.Range(0.8f, 0.9f); } private AudioClip LoadWavFromFile(string filePath) { if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath)) { return null; } try { byte[] array = File.ReadAllBytes(filePath); if (array.Length < 44) { return null; } if (array[0] != 82 || array[1] != 73 || array[2] != 70 || array[3] != 70 || array[8] != 87 || array[9] != 65 || array[10] != 86 || array[11] != 69) { return null; } int num = 12; int num2 = -1; int num3 = -1; uint num4 = 0u; while (num + 8 <= array.Length) { string text = Encoding.ASCII.GetString(array, num, 4); uint num5 = BitConverter.ToUInt32(array, num + 4); if (text == "fmt ") { num2 = num + 8; } else if (text == "data") { num3 = num + 8; num4 = num5; } num += (int)(8 + num5); if ((num5 & 1) != 0) { num++; } if (num2 != -1 && num3 != -1 && num >= num3 + (int)num4) { break; } } if (num2 == -1 || num3 == -1) { return null; } ushort num6 = BitConverter.ToUInt16(array, num2); ushort num7 = BitConverter.ToUInt16(array, num2 + 2); uint num8 = BitConverter.ToUInt32(array, num2 + 4); ushort num9 = BitConverter.ToUInt16(array, num2 + 14); if (num6 == 65534 && num2 + 26 <= array.Length) { num6 = BitConverter.ToUInt16(array, num2 + 24); } int num10 = num9 / 8; if (num10 <= 0 || num7 == 0 || num8 == 0) { return null; } if (num3 + num4 > array.Length) { num4 = (uint)Math.Max(0, array.Length - num3); } int num11 = (int)(num4 / num10); int num12 = num11 / num7; if (num12 <= 0) { return null; } float[] array2 = new float[num11]; int num13 = num3; if (num6 == 1) { switch (num9) { case 8: { int num20 = 0; while (num20 < num11) { array2[num20] = ((float)(int)array[num13] - 128f) * (1f / 128f); num20++; num13++; } break; } case 16: { int num16 = 0; while (num16 < num11) { short num17 = (short)(array[num13] | (array[num13 + 1] << 8)); array2[num16] = (float)num17 * 3.0517578E-05f; num16++; num13 += 2; } break; } case 24: { int num18 = 0; while (num18 < num11) { int num19 = array[num13] | (array[num13 + 1] << 8) | (array[num13 + 2] << 16); if ((num19 & 0x800000) != 0) { num19 |= -16777216; } array2[num18] = (float)num19 * 1.1920929E-07f; num18++; num13 += 3; } break; } case 32: { int num14 = 0; while (num14 < num11) { int num15 = array[num13] | (array[num13 + 1] << 8) | (array[num13 + 2] << 16) | (array[num13 + 3] << 24); array2[num14] = (float)num15 * 4.656613E-10f; num14++; num13 += 4; } break; } default: return null; } } else { if (num6 != 3 || num9 != 32) { return null; } int num21 = 0; while (num21 < num11) { array2[num21] = Mathf.Clamp(BitConverter.ToSingle(array, num13), -1f, 1f); num21++; num13 += 4; } } AudioClip obj = AudioClip.Create(Path.GetFileNameWithoutExtension(filePath), num12, (int)num7, (int)num8, false); ((Object)obj).hideFlags = (HideFlags)61; obj.SetData(Il2CppStructArray<float>.op_Implicit(array2), 0); return obj; } catch (Exception ex) { MelonLogger.Warning("[WeatherGB] Failed loading audio '" + filePath + "': " + ex.Message); return null; } } private GameObject CreateFogBillow() { //IL_0042: 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) GameObject val = GameObject.CreatePrimitive((PrimitiveType)5); Object.Destroy((Object)(object)val.GetComponent<Collider>()); MeshRenderer component = val.GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).sharedMaterial = _fogMaterial; ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component).receiveShadows = false; } val.transform.localScale = Vector3.one * Random.Range(22f, 42f); ResetFogPosition(val); return val; } private void DestroyGameObject(GameObject go) { if ((Object)(object)go != (Object)null) { Object.Destroy((Object)(object)go); } } private void TriggerSplash(Vector3 hitPoint, Vector3 hitNormal) { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_00ea: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) if (_type != WeatherType.Rain || _isGirders) { return; } ref SplashInstance reference = ref _splashCircularBuffer[_nextSplashIndex]; if ((Object)(object)reference.GameObject == (Object)null) { GameObject val = GameObject.CreatePrimitive((PrimitiveType)5); Object.Destroy((Object)(object)val.GetComponent<Collider>()); reference.Renderer = val.GetComponent<MeshRenderer>(); if ((Object)(object)reference.Renderer != (Object)null) { ((Renderer)reference.Renderer).sharedMaterial = _splashMaterial; ((Renderer)reference.Renderer).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)reference.Renderer).receiveShadows = false; } reference.GameObject = val; reference.Transform = val.transform; } reference.IsActive = true; reference.GameObject.SetActive(true); reference.BasePosition = hitPoint + hitNormal * 0.04f; reference.Transform.position = reference.BasePosition; reference.Transform.rotation = Quaternion.AngleAxis(Random.Range(0f, 360f), hitNormal) * Quaternion.FromToRotation(Vector3.forward, hitNormal); reference.Transform.localScale = Vector3.one * 0.08f; reference.StartScale = Vector3.one * Random.Range(0.85f, 1.25f); reference.Life = 0.32f; reference.MaxLife = 0.32f; _nextSplashIndex = (_nextSplashIndex + 1) % 32; } private void ResetFogPosition(GameObject f) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_mainCameraTransform == (Object)null)) { Vector3 position = _mainCameraTransform.position; f.transform.position = position + new Vector3(Random.Range(-40f, 40f), Random.Range(-5f, 15f), Random.Range(-40f, 40f)); f.transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); } } private void ResetParticleSimulation(ref ParticleSimData p, Vector3 boxCenter, bool isStartup = false) { //IL_007b: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) float num = Random.Range(-55f, 55f); float num2 = Random.Range(-55f, 55f); while (num * num + num2 * num2 < 16f) { num = Random.Range(-55f, 55f); num2 = R