Decompiled source of Vertigone v1.1.0

Vertigone.dll

Decompiled 2 weeks ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("Vertigone")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Vertigone")]
[assembly: AssemblyTitle("Vertigone")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.sanderroli.vertigone", "Fear of Heights Accessibility", "1.1.0")]
public class Vertigone : BaseUnityPlugin
{
	private ConfigEntry<bool> cfgEnabled;

	private ConfigEntry<bool> cfgVolumetric;

	private ConfigEntry<float> cfgHeightOffset;

	private ConfigEntry<float> cfgPlaneSize;

	private ConfigEntry<float> cfgSoftEdgeRatio;

	private ConfigEntry<float> cfgAlpha;

	private ConfigEntry<int> cfgVolumetricLayers;

	private ConfigEntry<KeyCode> cfgToggleKey;

	private ConfigEntry<KeyCode> cfgVolumetricToggleKey;

	private ConfigEntry<KeyCode> cfgQuickToggleKey;

	private ConfigEntry<KeyCode> cfgHUDToggleKey;

	private ConfigEntry<KeyCode> cfgHeightUpKey;

	private ConfigEntry<KeyCode> cfgHeightDownKey;

	private ConfigEntry<KeyCode> cfgPlaneSizeUpKey;

	private ConfigEntry<KeyCode> cfgPlaneSizeDownKey;

	private ConfigEntry<KeyCode> cfgSoftEdgeUpKey;

	private ConfigEntry<KeyCode> cfgSoftEdgeDownKey;

	private ConfigEntry<KeyCode> cfgOpacityUpKey;

	private ConfigEntry<KeyCode> cfgOpacityDownKey;

	private GameObject fogObject;

	private Renderer fogRenderer;

	private Material fogMaterial;

	private Camera mainCam;

	private bool showHUD = false;

	private float stepMultiplier = 1f;

	private int volumetricLayers = 5;

	private List<GameObject> fogLayers = new List<GameObject>();

	private void Awake()
	{
		cfgEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable or disable the barrier");
		cfgVolumetric = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Volumetric", true, "Use layered volumetric barrier (true = volumetric, false = 2D)");
		cfgHeightOffset = ((BaseUnityPlugin)this).Config.Bind<float>("General", "HeightOffset", -7f, "Vertical offset from camera (Range from -1.5 to -30)");
		cfgPlaneSize = ((BaseUnityPlugin)this).Config.Bind<float>("General", "PlaneSize", 50f, "Size of the fog plane (Range from 5 to 300)");
		cfgSoftEdgeRatio = ((BaseUnityPlugin)this).Config.Bind<float>("General", "SoftEdgeRatio", 0.5f, "Blend between solid center and soft edge (Range from 0 to 1)");
		cfgAlpha = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Alpha", 1f, "Fog opacity (Range from 0.25 to 1)");
		cfgVolumetricLayers = ((BaseUnityPlugin)this).Config.Bind<int>("General", "VolumetricLayers", 10, "Amount of volumetric layers (Range from 3 to 20)");
		cfgToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "ToggleKey", (KeyCode)289, "Toggle barrier on/off");
		cfgQuickToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "QuickToggleKey", (KeyCode)102, "Quick hide the barrier when button is held");
		cfgVolumetricToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "VolumetricToggleKey", (KeyCode)288, "Toggle 2D/Volumetric barrier mode");
		cfgHUDToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "HUDToggleKey", (KeyCode)290, "Toggle barrier settings HUD");
		cfgHeightUpKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "HeightUpKey", (KeyCode)273, "Raise the barrier");
		cfgHeightDownKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "HeightDownKey", (KeyCode)274, "Lower the barrier");
		cfgPlaneSizeUpKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "PlaneSizeUpKey", (KeyCode)0, "Increase barrier size");
		cfgPlaneSizeDownKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "PlaneSizeDownKey", (KeyCode)0, "Decrease barrier size");
		cfgSoftEdgeUpKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "SoftEdgeUpKey", (KeyCode)0, "Increase soft edge");
		cfgSoftEdgeDownKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "SoftEdgeDownKey", (KeyCode)0, "Decrease soft edge");
		cfgOpacityUpKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "OpacityUpKey", (KeyCode)0, "Increase barrier opacity");
		cfgOpacityDownKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "OpacityDownKey", (KeyCode)0, "Decrease barrier opacity");
		volumetricLayers = Mathf.Clamp(cfgVolumetricLayers.Value, 3, 20);
		CreateFogObject();
		if (cfgVolumetric.Value)
		{
			CreateFogLayers();
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Vertigone loaded");
	}

	private void CreateFogObject()
	{
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Expected O, but got Unknown
		//IL_017e: 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_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0264: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)fogObject != (Object)null)
		{
			Object.Destroy((Object)(object)fogObject);
			fogObject = null;
		}
		fogObject = GameObject.CreatePrimitive((PrimitiveType)4);
		((Object)fogObject).name = "Vertigone_AccessibilityPlane";
		Collider component = fogObject.GetComponent<Collider>();
		if ((Object)(object)component != (Object)null)
		{
			Object.Destroy((Object)(object)component);
		}
		Shader val = Shader.Find("Universal Render Pipeline/Unlit");
		if ((Object)(object)val == (Object)null)
		{
			val = Shader.Find("Unlit/Transparent");
		}
		fogMaterial = new Material(val);
		if (fogMaterial.HasProperty("_Surface"))
		{
			fogMaterial.SetFloat("_Surface", 1f);
		}
		if (fogMaterial.HasProperty("_Blend"))
		{
			fogMaterial.SetFloat("_Blend", 0f);
		}
		if (fogMaterial.HasProperty("_AlphaClip"))
		{
			fogMaterial.SetFloat("_AlphaClip", 0f);
		}
		fogMaterial.SetInt("_SrcBlend", 5);
		fogMaterial.SetInt("_DstBlend", 10);
		fogMaterial.SetInt("_ZWrite", 0);
		fogMaterial.renderQueue = 3000;
		fogMaterial.color = new Color(0.8f, 0.85f, 0.9f, cfgAlpha.Value);
		Texture2D val2 = GenerateCircularGradient();
		fogMaterial.mainTexture = (Texture)(object)val2;
		fogMaterial.mainTextureScale = new Vector2(1f, 1f);
		fogMaterial.SetTexture("_BaseMap", (Texture)(object)val2);
		fogMaterial.SetTexture("_MainTex", (Texture)(object)val2);
		fogRenderer = fogObject.GetComponent<Renderer>();
		fogRenderer.sharedMaterial = fogMaterial;
		fogRenderer.shadowCastingMode = (ShadowCastingMode)0;
		fogRenderer.receiveShadows = false;
		UpdateFogScale();
		fogObject.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
		fogObject.transform.position = new Vector3(0f, -1000f, 0f);
		Object.DontDestroyOnLoad((Object)(object)fogObject);
	}

	private void CreateFogLayers()
	{
		//IL_0061: 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_0084: Expected O, but got Unknown
		DestroyFogLayers();
		fogLayers.Clear();
		for (int i = 0; i < volumetricLayers; i++)
		{
			GameObject val = GameObject.CreatePrimitive((PrimitiveType)4);
			Object.Destroy((Object)(object)val.GetComponent<Collider>());
			((Object)val).name = $"Vertigone_Layer_{i}";
			val.transform.SetParent(fogObject.transform, false);
			val.transform.localRotation = Quaternion.identity;
			Renderer component = val.GetComponent<Renderer>();
			component.sharedMaterial = new Material(fogMaterial);
			fogLayers.Add(val);
		}
		if ((Object)(object)fogRenderer != (Object)null)
		{
			fogRenderer.enabled = false;
		}
		UpdateFogLayers();
	}

	private void DestroyFogLayers()
	{
		foreach (GameObject fogLayer in fogLayers)
		{
			if ((Object)(object)fogLayer != (Object)null)
			{
				Object.Destroy((Object)(object)fogLayer);
			}
		}
		fogLayers.Clear();
		if ((Object)(object)fogRenderer != (Object)null)
		{
			fogRenderer.enabled = true;
		}
	}

	private void UpdateFogLayers()
	{
		//IL_009b: 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_00e1: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
		if (fogLayers.Count == 0)
		{
			return;
		}
		int count = fogLayers.Count;
		float num = 1f / (float)count * 1.5f;
		float num2 = (cfgAlpha.Value + 1f) / 2f;
		float num3 = 1f - Mathf.Pow(1f - num2, 1f / (float)count);
		for (int i = 0; i < count; i++)
		{
			GameObject val = fogLayers[i];
			float num4 = (0f - num) * (float)i;
			val.transform.localPosition = new Vector3(0f, num4, 0f);
			val.transform.localRotation = Quaternion.identity;
			float num5 = Mathf.Pow((float)(i + 1) / (float)count, 2f);
			float a = num3 * num5;
			Renderer component = val.GetComponent<Renderer>();
			Color color = fogMaterial.color;
			color.a = a;
			component.sharedMaterial.color = color;
			if ((Object)(object)fogMaterial.mainTexture != (Object)null)
			{
				component.sharedMaterial.mainTexture = fogMaterial.mainTexture;
			}
		}
	}

	private void Update()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0196: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: 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_032f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0387: Unknown result type (might be due to invalid IL or missing references)
		//IL_048f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0494: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fd: 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)
		//IL_0504: Unknown result type (might be due to invalid IL or missing references)
		//IL_0542: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyDown(cfgToggleKey.Value))
		{
			cfgEnabled.Value = !cfgEnabled.Value;
		}
		if (Input.GetKeyDown(cfgVolumetricToggleKey.Value))
		{
			cfgVolumetric.Value = !cfgVolumetric.Value;
			if (cfgVolumetric.Value)
			{
				CreateFogLayers();
			}
			else
			{
				DestroyFogLayers();
			}
		}
		if (Input.GetKeyDown(cfgHUDToggleKey.Value))
		{
			showHUD = !showHUD;
		}
		if (cfgQuickToggleKey != null)
		{
			bool key = Input.GetKey(cfgQuickToggleKey.Value);
			if ((Object)(object)fogObject != (Object)null)
			{
				fogObject.SetActive(!key);
			}
			if (key)
			{
				return;
			}
		}
		stepMultiplier = (Input.GetKey((KeyCode)304) ? 2.5f : 1f);
		float num = 40f * Time.deltaTime * stepMultiplier;
		float num2 = 4f * Time.deltaTime * stepMultiplier;
		float num3 = 0.4f * Time.deltaTime * stepMultiplier;
		if (Input.GetKey(cfgHeightUpKey.Value))
		{
			cfgHeightOffset.Value = Mathf.Min(cfgHeightOffset.Value + num2, -1.5f);
		}
		if (Input.GetKey(cfgHeightDownKey.Value))
		{
			cfgHeightOffset.Value = Mathf.Max(cfgHeightOffset.Value - num2, -30f);
		}
		if (Input.GetKey(cfgPlaneSizeUpKey.Value))
		{
			cfgPlaneSize.Value = Mathf.Min(cfgPlaneSize.Value + num, 300f);
			UpdateFogScale();
			if (cfgVolumetric.Value)
			{
				UpdateFogLayers();
			}
		}
		if (Input.GetKey(cfgPlaneSizeDownKey.Value))
		{
			cfgPlaneSize.Value = Mathf.Max(cfgPlaneSize.Value - num, 5f);
			UpdateFogScale();
			if (cfgVolumetric.Value)
			{
				UpdateFogLayers();
			}
		}
		if (Input.GetKey(cfgSoftEdgeUpKey.Value))
		{
			cfgSoftEdgeRatio.Value = Mathf.Clamp01(cfgSoftEdgeRatio.Value + num3);
			UpdateFogTexture();
			if (cfgVolumetric.Value)
			{
				UpdateFogLayers();
			}
		}
		if (Input.GetKey(cfgSoftEdgeDownKey.Value))
		{
			cfgSoftEdgeRatio.Value = Mathf.Clamp01(cfgSoftEdgeRatio.Value - num3);
			UpdateFogTexture();
			if (cfgVolumetric.Value)
			{
				UpdateFogLayers();
			}
		}
		if (Input.GetKey(cfgOpacityUpKey.Value))
		{
			cfgAlpha.Value = Mathf.Clamp(cfgAlpha.Value + num3, 0.25f, 1f);
			if (cfgVolumetric.Value)
			{
				UpdateFogLayers();
			}
		}
		if (Input.GetKey(cfgOpacityDownKey.Value))
		{
			cfgAlpha.Value = Mathf.Clamp(cfgAlpha.Value - num3, 0.25f, 1f);
			if (cfgVolumetric.Value)
			{
				UpdateFogLayers();
			}
		}
		if (!cfgEnabled.Value)
		{
			if ((Object)(object)fogObject != (Object)null && fogObject.activeSelf)
			{
				fogObject.SetActive(false);
			}
			return;
		}
		if ((Object)(object)fogObject != (Object)null && !fogObject.activeSelf)
		{
			fogObject.SetActive(true);
		}
		if ((Object)(object)mainCam == (Object)null)
		{
			mainCam = Camera.main;
		}
		if ((Object)(object)mainCam != (Object)null)
		{
			Vector3 position = ((Component)mainCam).transform.position;
			fogObject.transform.position = new Vector3(position.x, position.y + cfgHeightOffset.Value, position.z);
			fogObject.transform.rotation = Quaternion.identity;
		}
		if ((Object)(object)fogMaterial != (Object)null)
		{
			Color color = fogMaterial.color;
			if (Mathf.Abs(color.a - cfgAlpha.Value) > 0.001f)
			{
				color.a = cfgAlpha.Value;
				fogMaterial.color = color;
			}
		}
		if (cfgEnabled.Value && (Object)(object)fogMaterial != (Object)null)
		{
			UpdateFogColorFromSkybox();
			if (cfgVolumetric.Value)
			{
				UpdateFogLayers();
			}
		}
	}

	private void UpdateFogScale()
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)fogObject != (Object)null)
		{
			float num = cfgPlaneSize.Value / 10f;
			fogObject.transform.localScale = new Vector3(num, 1f, num);
		}
	}

	private Texture2D GenerateCircularGradient(int size = 256)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		//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_00b6: Unknown result type (might be due to invalid IL or missing references)
		Texture2D val = new Texture2D(size, size, (TextureFormat)4, false);
		((Texture)val).wrapMode = (TextureWrapMode)1;
		Vector2 val2 = default(Vector2);
		((Vector2)(ref val2))..ctor((float)size / 2f, (float)size / 2f);
		float num = (float)size / 2f;
		float num2 = num * cfgSoftEdgeRatio.Value;
		for (int i = 0; i < size; i++)
		{
			for (int j = 0; j < size; j++)
			{
				float num3 = Vector2.Distance(val2, new Vector2((float)j, (float)i));
				float num4;
				if (num3 <= num2)
				{
					num4 = 1f;
				}
				else
				{
					float num5 = Mathf.Clamp01((num3 - num2) / (num - num2));
					num4 = Mathf.SmoothStep(1f, 0f, num5);
				}
				val.SetPixel(j, i, new Color(1f, 1f, 1f, num4));
			}
		}
		val.Apply();
		return val;
	}

	private void UpdateFogTexture()
	{
		if ((Object)(object)fogMaterial == (Object)null)
		{
			return;
		}
		Texture mainTexture = fogMaterial.mainTexture;
		Texture2D val = GenerateCircularGradient();
		fogMaterial.mainTexture = (Texture)(object)val;
		fogMaterial.SetTexture("_BaseMap", (Texture)(object)val);
		if (cfgVolumetric.Value)
		{
			foreach (GameObject fogLayer in fogLayers)
			{
				if (Object.op_Implicit((Object)(object)fogLayer))
				{
					fogLayer.GetComponent<Renderer>().sharedMaterial.mainTexture = (Texture)(object)val;
				}
			}
		}
		if ((Object)(object)mainTexture != (Object)null)
		{
			Object.Destroy((Object)(object)mainTexture);
		}
	}

	private void UpdateFogColorFromSkybox()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: 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_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_0106: 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_0139: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)fogMaterial == (Object)null)
		{
			return;
		}
		Color val = RenderSettings.ambientSkyColor;
		if ((Object)(object)RenderSettings.skybox != (Object)null && RenderSettings.skybox.HasProperty("_Tint"))
		{
			val = RenderSettings.skybox.GetColor("_Tint");
		}
		else if ((Object)(object)RenderSettings.skybox != (Object)null && RenderSettings.skybox.HasProperty("_SkyTint"))
		{
			val = RenderSettings.skybox.GetColor("_SkyTint");
		}
		val.a = cfgAlpha.Value;
		fogMaterial.color = Color.Lerp(fogMaterial.color, val, Time.deltaTime * 2f);
		if (!cfgVolumetric.Value)
		{
			return;
		}
		for (int i = 0; i < fogLayers.Count; i++)
		{
			Renderer component = fogLayers[i].GetComponent<Renderer>();
			if ((Object)(object)component != (Object)null)
			{
				Color color = fogMaterial.color;
				color.a = (float)(i + 1) / (float)fogLayers.Count * cfgAlpha.Value;
				component.sharedMaterial.color = color;
			}
		}
	}

	private void OnGUI()
	{
		//IL_0029: 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_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Expected O, but got Unknown
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Expected O, but got Unknown
		//IL_00b2: 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_010d: Unknown result type (might be due to invalid IL or missing references)
		if (showHUD && cfgEnabled.Value)
		{
			GUI.color = new Color(fogMaterial.color.r, fogMaterial.color.g, fogMaterial.color.b, 0.8f);
			GUIStyle val = new GUIStyle(GUI.skin.box)
			{
				fontSize = 18,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)0,
				wordWrap = true
			};
			val.normal.textColor = Color.white;
			GUIStyle val2 = new GUIStyle(val);
			val2.normal.textColor = Color.black;
			Rect val3 = default(Rect);
			((Rect)(ref val3))..ctor(20f, 20f, 280f, 170f);
			GUI.Box(val3, "", val);
			GUI.Label(new Rect(((Rect)(ref val3)).x + 6f, ((Rect)(ref val3)).y + 4f, ((Rect)(ref val3)).width, ((Rect)(ref val3)).height), "Vertigone Settings\n" + $"Height Offset: {cfgHeightOffset.Value:F1}\n" + $"Plane Size: {cfgPlaneSize.Value:F1}\n" + $"Soft Edge Ratio: {cfgSoftEdgeRatio.Value:F2}\n" + $"Opacity: {cfgAlpha.Value:F2}\n" + "Volumetric: " + (cfgVolumetric.Value ? "ON" : "OFF") + "\n\n[Shift] = Faster adjustments", val);
		}
	}

	private void OnDestroy()
	{
		if ((Object)(object)fogObject != (Object)null)
		{
			Object.Destroy((Object)(object)fogObject);
		}
		DestroyFogLayers();
	}
}