Decompiled source of DR NewEngland v1.0.0

DR_NewEngland.dll

Decompiled 19 hours ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using Atlas;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using UnityEngine;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace Alloy
{
	public static class EnumExtension
	{
		public static bool HasFlag(this Enum keys, Enum flag)
		{
			int num = Convert.ToInt32(keys);
			int num2 = Convert.ToInt32(flag);
			return (num & num2) == num2;
		}
	}
}
namespace JerryDR
{
	public class Lockwithhead : MonoBehaviour
	{
		private void Update()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)GM.CurrentMovementManager != (Object)null)
			{
				((Component)this).gameObject.transform.position = ((Component)GM.CurrentMovementManager.Head).gameObject.transform.position;
				((Component)this).gameObject.transform.rotation = ((Component)GM.CurrentMovementManager.Head).gameObject.transform.rotation;
			}
		}
	}
	public class SpawnVehicle : MonoBehaviour
	{
		public FVRObject id;

		public bool spawned;

		public GameObject car;

		private void FixedUpdate()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if (!spawned && (Object)(object)GM.CurrentPlayerBody != (Object)null && ((Component)GM.CurrentPlayerBody).gameObject.activeInHierarchy)
			{
				if ((Object)(object)car != (Object)null)
				{
					Object.Destroy((Object)(object)car);
				}
				car = Object.Instantiate<GameObject>(((AnvilAsset)id).GetGameObject(), ((Component)this).gameObject.transform.position, ((Component)this).gameObject.transform.rotation);
				spawned = true;
			}
			if ((Object)(object)GM.CurrentPlayerBody != (Object)null && !((Component)GM.CurrentPlayerBody).gameObject.activeInHierarchy)
			{
				spawned = false;
			}
			if ((Object)(object)GM.CurrentPlayerBody == (Object)null)
			{
				spawned = false;
			}
		}
	}
}
namespace MeatKit
{
	public class HideInNormalInspectorAttribute : PropertyAttribute
	{
	}
}
namespace JerryAr.DR_NewEngland
{
	[BepInPlugin("JerryAr.DR_NewEngland", "DR_NewEngland", "1.0.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("nrgill28.Atlas", "1.0.1")]
	public class DR_NewEnglandPlugin : BaseUnityPlugin
	{
		private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		internal static ManualLogSource Logger;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			LoadAssets();
		}

		private void LoadAssets()
		{
			AtlasPlugin.RegisterScene(Path.Combine(BasePath, "newengland"));
		}
	}
}
namespace SimpleLightProbePlacer
{
	[RequireComponent(typeof(LightProbeGroup))]
	[AddComponentMenu("Rendering/Light Probe Group Control")]
	public class LightProbeGroupControl : MonoBehaviour
	{
		[SerializeField]
		private float m_mergeDistance = 0.5f;

		[SerializeField]
		private bool m_usePointLights = true;

		[SerializeField]
		private float m_pointLightRange = 1f;

		private int m_mergedProbes;

		private LightProbeGroup m_lightProbeGroup;

		public float MergeDistance
		{
			get
			{
				return m_mergeDistance;
			}
			set
			{
				m_mergeDistance = value;
			}
		}

		public int MergedProbes => m_mergedProbes;

		public bool UsePointLights
		{
			get
			{
				return m_usePointLights;
			}
			set
			{
				m_usePointLights = value;
			}
		}

		public float PointLightRange
		{
			get
			{
				return m_pointLightRange;
			}
			set
			{
				m_pointLightRange = value;
			}
		}

		public LightProbeGroup LightProbeGroup
		{
			get
			{
				if ((Object)(object)m_lightProbeGroup != (Object)null)
				{
					return m_lightProbeGroup;
				}
				return m_lightProbeGroup = ((Component)this).GetComponent<LightProbeGroup>();
			}
		}

		public void DeleteAll()
		{
			LightProbeGroup.probePositions = null;
			m_mergedProbes = 0;
		}

		public void Create()
		{
			DeleteAll();
			List<Vector3> list = CreatePositions();
			list.AddRange(CreateAroundPointLights(m_pointLightRange));
			list = MergeClosestPositions(list, m_mergeDistance, out m_mergedProbes);
			ApplyPositions(list);
		}

		public void Merge()
		{
			if (LightProbeGroup.probePositions != null)
			{
				List<Vector3> source = MergeClosestPositions(LightProbeGroup.probePositions.ToList(), m_mergeDistance, out m_mergedProbes);
				source = source.Select((Vector3 x) => ((Component)this).transform.TransformPoint(x)).ToList();
				ApplyPositions(source);
			}
		}

		private void ApplyPositions(List<Vector3> positions)
		{
			LightProbeGroup.probePositions = positions.Select((Vector3 x) => ((Component)this).transform.InverseTransformPoint(x)).ToArray();
		}

		private static List<Vector3> CreatePositions()
		{
			LightProbeVolume[] array = Object.FindObjectsOfType<LightProbeVolume>();
			if (array.Length == 0)
			{
				return new List<Vector3>();
			}
			List<Vector3> list = new List<Vector3>();
			for (int i = 0; i < array.Length; i++)
			{
				list.AddRange(array[i].CreatePositions());
			}
			return list;
		}

		private static List<Vector3> CreateAroundPointLights(float range)
		{
			List<Light> list = (from x in Object.FindObjectsOfType<Light>()
				where (int)x.type == 2
				select x).ToList();
			if (list.Count == 0)
			{
				return new List<Vector3>();
			}
			List<Vector3> list2 = new List<Vector3>();
			for (int num = 0; num < list.Count; num++)
			{
				list2.AddRange(CreatePositionsAround(((Component)list[num]).transform, range));
			}
			return list2;
		}

		private static List<Vector3> MergeClosestPositions(List<Vector3> positions, float distance, out int mergedCount)
		{
			//IL_00a2: 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_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			if (positions == null)
			{
				mergedCount = 0;
				return new List<Vector3>();
			}
			int count = positions.Count;
			bool flag = false;
			while (!flag)
			{
				Dictionary<Vector3, List<Vector3>> dictionary = new Dictionary<Vector3, List<Vector3>>();
				for (int i = 0; i < positions.Count; i++)
				{
					List<Vector3> list = positions.Where(delegate(Vector3 x)
					{
						//IL_0000: 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_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)
						Vector3 val = x - positions[i];
						return ((Vector3)(ref val)).magnitude < distance;
					}).ToList();
					if (list.Count > 0 && !dictionary.ContainsKey(positions[i]))
					{
						dictionary.Add(positions[i], list);
					}
				}
				positions.Clear();
				List<Vector3> list2 = dictionary.Keys.ToList();
				for (int num = 0; num < list2.Count; num++)
				{
					Vector3 center = dictionary[list2[num]].Aggregate(Vector3.zero, (Vector3 result, Vector3 target) => result + target) / (float)dictionary[list2[num]].Count;
					if (!positions.Exists((Vector3 x) => x == center))
					{
						positions.Add(center);
					}
				}
				flag = positions.Select((Vector3 x) => positions.Where(delegate(Vector3 y)
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_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)
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					int result;
					if (y != x)
					{
						Vector3 val = y - x;
						result = ((((Vector3)(ref val)).magnitude < distance) ? 1 : 0);
					}
					else
					{
						result = 0;
					}
					return (byte)result != 0;
				})).All((IEnumerable<Vector3> x) => !x.Any());
			}
			mergedCount = count - positions.Count;
			return positions;
		}

		public static List<Vector3> CreatePositionsAround(Transform transform, float range)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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)
			//IL_00d1: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] source = (Vector3[])(object)new Vector3[8]
			{
				new Vector3(-0.5f, 0.5f, -0.5f),
				new Vector3(-0.5f, 0.5f, 0.5f),
				new Vector3(0.5f, 0.5f, 0.5f),
				new Vector3(0.5f, 0.5f, -0.5f),
				new Vector3(-0.5f, -0.5f, -0.5f),
				new Vector3(-0.5f, -0.5f, 0.5f),
				new Vector3(0.5f, -0.5f, 0.5f),
				new Vector3(0.5f, -0.5f, -0.5f)
			};
			return source.Select((Vector3 x) => transform.TransformPoint(x * range)).ToList();
		}
	}
	public enum LightProbeVolumeType
	{
		Fixed,
		Float
	}
	[AddComponentMenu("Rendering/Light Probe Volume")]
	public class LightProbeVolume : TransformVolume
	{
		[SerializeField]
		private LightProbeVolumeType m_type = LightProbeVolumeType.Fixed;

		[SerializeField]
		private Vector3 m_densityFixed = Vector3.one;

		[SerializeField]
		private Vector3 m_densityFloat = Vector3.one;

		public LightProbeVolumeType Type
		{
			get
			{
				return m_type;
			}
			set
			{
				m_type = value;
			}
		}

		public Vector3 Density
		{
			get
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: 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_0023: Unknown result type (might be due to invalid IL or missing references)
				return (m_type != LightProbeVolumeType.Fixed) ? m_densityFloat : m_densityFixed;
			}
			set
			{
				//IL_0019: 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_000d: 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)
				if (m_type == LightProbeVolumeType.Fixed)
				{
					m_densityFixed = value;
				}
				else
				{
					m_densityFloat = value;
				}
			}
		}

		public static Color EditorColor => new Color(1f, 0.9f, 0.25f);

		public List<Vector3> CreatePositions()
		{
			return CreatePositions(m_type);
		}

		public List<Vector3> CreatePositions(LightProbeVolumeType type)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_0014: 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)
			return (type != LightProbeVolumeType.Fixed) ? CreatePositionsFloat(((Component)this).transform, base.Origin, base.Size, Density) : CreatePositionsFixed(((Component)this).transform, base.Origin, base.Size, Density);
		}

		public static List<Vector3> CreatePositionsFixed(Transform volumeTransform, Vector3 origin, Vector3 size, Vector3 density)
		{
			//IL_0007: 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_004c: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> list = new List<Vector3>();
			Vector3 val = origin;
			float num = size.x / (float)Mathf.FloorToInt(density.x);
			float num2 = size.y / (float)Mathf.FloorToInt(density.y);
			float num3 = size.z / (float)Mathf.FloorToInt(density.z);
			val -= size * 0.5f;
			for (int i = 0; (float)i <= density.x; i++)
			{
				for (int j = 0; (float)j <= density.y; j++)
				{
					for (int k = 0; (float)k <= density.z; k++)
					{
						Vector3 val2 = val + new Vector3((float)i * num, (float)j * num2, (float)k * num3);
						val2 = volumeTransform.TransformPoint(val2);
						list.Add(val2);
					}
				}
			}
			return list;
		}

		public static List<Vector3> CreatePositionsFloat(Transform volumeTransform, Vector3 origin, Vector3 size, Vector3 density)
		{
			//IL_0007: 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_0049: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_0110: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> list = new List<Vector3>();
			Vector3 val = origin;
			int num = Mathf.FloorToInt(size.x / density.x);
			int num2 = Mathf.FloorToInt(size.y / density.y);
			int num3 = Mathf.FloorToInt(size.z / density.z);
			val -= size * 0.5f;
			val.x += (size.x - (float)num * density.x) * 0.5f;
			val.y += (size.y - (float)num2 * density.y) * 0.5f;
			val.z += (size.z - (float)num3 * density.z) * 0.5f;
			for (int i = 0; i <= num; i++)
			{
				for (int j = 0; j <= num2; j++)
				{
					for (int k = 0; k <= num3; k++)
					{
						Vector3 val2 = val + new Vector3((float)i * density.x, (float)j * density.y, (float)k * density.z);
						val2 = volumeTransform.TransformPoint(val2);
						list.Add(val2);
					}
				}
			}
			return list;
		}
	}
	[AddComponentMenu("")]
	public class TransformVolume : MonoBehaviour
	{
		[SerializeField]
		private Volume m_volume = new Volume(Vector3.zero, Vector3.one);

		public Volume Volume
		{
			get
			{
				return m_volume;
			}
			set
			{
				m_volume = value;
			}
		}

		public Vector3 Origin => m_volume.Origin;

		public Vector3 Size => m_volume.Size;

		public bool IsInBounds(Vector3[] points)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//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)
			Bounds bounds = GetBounds();
			return ((Bounds)(ref bounds)).Intersects(GetBounds(points));
		}

		public bool IsOnBorder(Vector3[] points)
		{
			if (points.All((Vector3 x) => !IsInVolume(x)))
			{
				return false;
			}
			return !points.All(IsInVolume);
		}

		public bool IsInVolume(Vector3[] points)
		{
			return points.All(IsInVolume);
		}

		public bool IsInVolume(Vector3 position)
		{
			//IL_000d: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			Plane val = default(Plane);
			for (int i = 0; i < 6; i++)
			{
				((Plane)(ref val))..ctor(GetSideDirection(i), GetSidePosition(i));
				if (((Plane)(ref val)).GetSide(position))
				{
					return false;
				}
			}
			return true;
		}

		public Vector3[] GetCorners()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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)
			//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_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_00dd: 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_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_0123: 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_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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_0196: 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_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[8]
			{
				new Vector3(-0.5f, 0.5f, -0.5f),
				new Vector3(-0.5f, 0.5f, 0.5f),
				new Vector3(0.5f, 0.5f, 0.5f),
				new Vector3(0.5f, 0.5f, -0.5f),
				new Vector3(-0.5f, -0.5f, -0.5f),
				new Vector3(-0.5f, -0.5f, 0.5f),
				new Vector3(0.5f, -0.5f, 0.5f),
				new Vector3(0.5f, -0.5f, -0.5f)
			};
			for (int i = 0; i < array.Length; i++)
			{
				ref Vector3 reference = ref array[i];
				reference.x *= m_volume.Size.x;
				ref Vector3 reference2 = ref array[i];
				reference2.y *= m_volume.Size.y;
				ref Vector3 reference3 = ref array[i];
				reference3.z *= m_volume.Size.z;
				ref Vector3 reference4 = ref array[i];
				reference4 = ((Component)this).transform.TransformPoint(m_volume.Origin + array[i]);
			}
			return array;
		}

		public Bounds GetBounds()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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)
			return GetBounds(GetCorners());
		}

		public Bounds GetBounds(Vector3[] points)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = points.Aggregate(Vector3.zero, (Vector3 val2, Vector3 point) => val2 + point) / (float)points.Length;
			Bounds result = default(Bounds);
			((Bounds)(ref result))..ctor(val, Vector3.zero);
			for (int num = 0; num < points.Length; num++)
			{
				((Bounds)(ref result)).Encapsulate(points[num]);
			}
			return result;
		}

		public GameObject[] GetGameObjectsInBounds(LayerMask layerMask)
		{
			//IL_000e: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer[] array = Object.FindObjectsOfType<MeshRenderer>();
			List<GameObject> list = new List<GameObject>();
			Bounds bounds = GetBounds();
			for (int i = 0; i < array.Length; i++)
			{
				if (!((Object)(object)((Component)array[i]).gameObject == (Object)(object)((Component)((Component)this).transform).gameObject) && !((Object)(object)((Component)array[i]).GetComponent<TransformVolume>() != (Object)null) && ((1 << ((Component)array[i]).gameObject.layer) & ((LayerMask)(ref layerMask)).value) != 0 && ((Bounds)(ref bounds)).Intersects(((Renderer)array[i]).bounds))
				{
					list.Add(((Component)array[i]).gameObject);
				}
			}
			return list.ToArray();
		}

		public Vector3 GetSideDirection(int side)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_0013: 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_0019: 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_0022: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_004d: 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_005f: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008e: 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)
			Vector3[] array = (Vector3[])(object)new Vector3[6];
			Vector3 right = Vector3.right;
			Vector3 up = Vector3.up;
			Vector3 forward = Vector3.forward;
			array[0] = right;
			ref Vector3 reference = ref array[1];
			reference = -right;
			array[2] = up;
			ref Vector3 reference2 = ref array[3];
			reference2 = -up;
			array[4] = forward;
			ref Vector3 reference3 = ref array[5];
			reference3 = -forward;
			return ((Component)this).transform.TransformDirection(array[side]);
		}

		public Vector3 GetSidePosition(int side)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_0013: 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_0019: 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_0022: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_004d: 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_005f: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[6];
			Vector3 right = Vector3.right;
			Vector3 up = Vector3.up;
			Vector3 forward = Vector3.forward;
			array[0] = right;
			ref Vector3 reference = ref array[1];
			reference = -right;
			array[2] = up;
			ref Vector3 reference2 = ref array[3];
			reference2 = -up;
			array[4] = forward;
			ref Vector3 reference3 = ref array[5];
			reference3 = -forward;
			return ((Component)this).transform.TransformPoint(array[side] * GetSizeAxis(side) + m_volume.Origin);
		}

		public float GetSizeAxis(int side)
		{
			//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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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)
			switch (side)
			{
			case 0:
			case 1:
				return m_volume.Size.x * 0.5f;
			case 2:
			case 3:
				return m_volume.Size.y * 0.5f;
			default:
				return m_volume.Size.z * 0.5f;
			}
		}
	}
	[Serializable]
	public struct Volume
	{
		[SerializeField]
		private Vector3 m_origin;

		[SerializeField]
		private Vector3 m_size;

		public Vector3 Origin => m_origin;

		public Vector3 Size => m_size;

		public Volume(Vector3 origin, Vector3 size)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			m_origin = origin;
			m_size = size;
		}

		public static bool operator ==(Volume left, Volume right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(Volume left, Volume right)
		{
			return !left.Equals(right);
		}

		public bool Equals(Volume other)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			return Origin == other.Origin && Size == other.Size;
		}

		public override bool Equals(object obj)
		{
			if (object.ReferenceEquals(null, obj))
			{
				return false;
			}
			return obj is Volume && Equals((Volume)obj);
		}

		public override int GetHashCode()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			return (((object)Origin/*cast due to .constrained prefix*/).GetHashCode() * 397) ^ ((object)Size/*cast due to .constrained prefix*/).GetHashCode();
		}

		public override string ToString()
		{
			//IL_0007: 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)
			return $"Origin: {Origin}, Size: {Size}";
		}
	}
}
namespace DRNewEngland
{
	[RequireComponent(typeof(AudioSource))]
	public sealed class DRPacenotePlayer : MonoBehaviour
	{
		public Transform player;

		public DRPacenoteTrack track;

		public AudioSource voice;

		public float extraLookAheadSeconds = 0f;

		public float maximumLookAheadMeters = 60f;

		public float distanceOffset = 0f;

		public float maximumRouteDistance = 40f;

		public float teleportDistance = 40f;

		public float maximumLateMeters = 100f;

		public float progress;

		public string lastCall;

		private int segment;

		private int nextCue;

		private bool initialized;

		private Vector3 lastPosition;

		private readonly Queue<int> queue = new Queue<int>();

		private void Awake()
		{
			if ((Object)(object)voice == (Object)null)
			{
				voice = ((Component)this).GetComponent<AudioSource>();
			}
			voice.playOnAwake = false;
			voice.loop = false;
			voice.spatialBlend = 0f;
		}

		private bool Valid()
		{
			return (Object)(object)player != (Object)null && (Object)(object)track != (Object)null && track.points != null && track.points.Length > 1 && track.distances != null && track.distances.Length == track.points.Length && track.cues != null;
		}

		public void Resynchronize()
		{
			//IL_0040: 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)
			if (Valid())
			{
				queue.Clear();
				if ((Object)(object)voice != (Object)null)
				{
					voice.Stop();
				}
				progress = Project(player.position, global: true, out var _);
				nextCue = 0;
				while (nextCue < track.cues.Length && track.cues[nextCue].distance + distanceOffset < progress - 5f)
				{
					nextCue++;
				}
				lastPosition = player.position;
				initialized = true;
			}
		}

		private float Project(Vector3 p, bool global, out float off)
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00ba: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: 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_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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			int num = ((!global) ? Mathf.Max(0, segment - 5) : 0);
			int num2 = ((!global) ? Mathf.Min(track.points.Length - 2, segment + 20) : (track.points.Length - 2));
			float num3 = float.MaxValue;
			float result = progress;
			int num4 = segment;
			for (int i = num; i <= num2; i++)
			{
				Vector3 val = ((Component)this).transform.TransformPoint(track.points[i]);
				Vector3 val2 = ((Component)this).transform.TransformPoint(track.points[i + 1]);
				Vector3 val3 = val2 - val;
				float num5 = ((!(((Vector3)(ref val3)).sqrMagnitude > 1E-05f)) ? 0f : Mathf.Clamp01(Vector3.Dot(p - val, val3) / ((Vector3)(ref val3)).sqrMagnitude));
				Vector3 val4 = p - (val + val3 * num5);
				float sqrMagnitude = ((Vector3)(ref val4)).sqrMagnitude;
				if (sqrMagnitude < num3)
				{
					num3 = sqrMagnitude;
					num4 = i;
					result = Mathf.Lerp(track.distances[i], track.distances[i + 1], num5);
				}
			}
			segment = num4;
			off = Mathf.Sqrt(num3);
			return result;
		}

		private void Update()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			if (!Valid() || Time.deltaTime <= 0f)
			{
				return;
			}
			if (!initialized)
			{
				Resynchronize();
				return;
			}
			float num = Vector3.Distance(player.position, lastPosition);
			if (num > Mathf.Max(1f, teleportDistance))
			{
				Resynchronize();
				return;
			}
			lastPosition = player.position;
			float off;
			float num2 = Project(player.position, global: false, out off);
			float num3 = Mathf.Clamp((num2 - progress) / Time.deltaTime, 0f, 100f);
			progress = num2;
			if (off > maximumRouteDistance || num / Time.deltaTime < 0.2f)
			{
				return;
			}
			float num4 = Mathf.Clamp(num3 * Mathf.Max(0f, extraLookAheadSeconds), 0f, maximumLookAheadMeters);
			while (nextCue < track.cues.Length && track.cues[nextCue].distance + distanceOffset <= progress + num4)
			{
				DRPacenoteCue dRPacenoteCue = track.cues[nextCue];
				if ((Object)(object)dRPacenoteCue.clip != (Object)null && progress <= dRPacenoteCue.distance + distanceOffset + maximumLateMeters && queue.Count < 4)
				{
					queue.Enqueue(nextCue);
				}
				nextCue++;
			}
			if ((Object)(object)voice == (Object)null || voice.isPlaying)
			{
				return;
			}
			while (queue.Count > 0)
			{
				DRPacenoteCue dRPacenoteCue2 = track.cues[queue.Dequeue()];
				if (progress > dRPacenoteCue2.distance + distanceOffset + maximumLateMeters || (Object)(object)dRPacenoteCue2.clip == (Object)null)
				{
					continue;
				}
				voice.clip = dRPacenoteCue2.clip;
				voice.Play();
				lastCall = dRPacenoteCue2.name;
				break;
			}
		}

		private void OnDisable()
		{
			initialized = false;
			queue.Clear();
			if ((Object)(object)voice != (Object)null)
			{
				voice.Stop();
			}
		}

		private void OnDrawGizmosSelected()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)track == (Object)null) && track.points != null)
			{
				Gizmos.color = Color.cyan;
				for (int i = 1; i < track.points.Length; i++)
				{
					Gizmos.DrawLine(((Component)this).transform.TransformPoint(track.points[i - 1]), ((Component)this).transform.TransformPoint(track.points[i]));
				}
			}
		}
	}
	[Serializable]
	public class DRPacenoteCue
	{
		public string name;

		public float distance;

		public string hint;

		public AudioClip clip;
	}
	public sealed class DRPacenoteTrack : ScriptableObject
	{
		public Vector3[] points;

		public float[] distances;

		public DRPacenoteCue[] cues;
	}
	public sealed class DRVegetationDistanceCuller : MonoBehaviour
	{
		public Transform target;

		public bool useMainCameraIfTargetMissing = true;

		public float disableDistance = 100f;

		public float reenableDistance = 95f;

		public float scanInterval = 0.25f;

		public int checksPerFrame = 4096;

		public bool horizontalDistanceOnly = true;

		[Range(0f, 1f)]
		public float fadeDuration = 0.3f;

		public List<GameObject> instances = new List<GameObject>();

		private Vector3[] positions;

		private GameObject[] managed;

		private bool[] originallyActive;

		private bool[] wanted;

		private bool[] sampled;

		private float[] opacity;

		private int cursor;

		private float nextScan;

		private float nextCameraLookup;

		private bool scanning;

		private bool ready;

		private bool hadObserver;

		private Transform cachedCamera;

		private readonly Dictionary<int, Renderer[]> fading = new Dictionary<int, Renderer[]>();

		private readonly List<int> finished = new List<int>();

		private readonly MaterialPropertyBlock block = new MaterialPropertyBlock();

		private static readonly int FadeId = Shader.PropertyToID("_DRFade");

		private void OnEnable()
		{
			ready = false;
		}

		private void Start()
		{
			Rebuild();
		}

		public void Rebuild()
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			Restore();
			managed = instances.ToArray();
			int num = managed.Length;
			positions = (Vector3[])(object)new Vector3[num];
			originallyActive = new bool[num];
			wanted = new bool[num];
			sampled = new bool[num];
			opacity = new float[num];
			for (int i = 0; i < num; i++)
			{
				if (!((Object)(object)managed[i] == (Object)null) && !((Object)(object)managed[i] == (Object)(object)((Component)this).gameObject))
				{
					ref Vector3 reference = ref positions[i];
					reference = managed[i].transform.position;
					bool[] array = wanted;
					int num2 = i;
					bool activeSelf;
					originallyActive[i] = (activeSelf = managed[i].activeSelf);
					array[num2] = activeSelf;
					opacity[i] = 1f;
				}
			}
			cursor = 0;
			nextScan = 0f;
			scanning = false;
			ready = true;
		}

		private void SetOpacity(Renderer[] renderers, float value)
		{
			foreach (Renderer val in renderers)
			{
				if (!((Object)(object)val == (Object)null))
				{
					val.GetPropertyBlock(block);
					block.SetFloat(FadeId, value);
					val.SetPropertyBlock(block);
					block.Clear();
				}
			}
		}

		private void Request(int index, bool active)
		{
			if (wanted[index] != active)
			{
				wanted[index] = active;
				GameObject val = managed[index];
				if (!fading.TryGetValue(index, out var value))
				{
					value = val.GetComponentsInChildren<Renderer>(true);
					fading.Add(index, value);
				}
				if (active)
				{
					SetOpacity(value, opacity[index]);
					val.SetActive(true);
				}
			}
		}

		private void UpdateFades()
		{
			finished.Clear();
			float num = ((!(fadeDuration <= 0f)) ? (Time.deltaTime / fadeDuration) : 1f);
			foreach (KeyValuePair<int, Renderer[]> item in fading)
			{
				int key = item.Key;
				if ((Object)(object)managed[key] == (Object)null)
				{
					finished.Add(key);
					continue;
				}
				float num2 = ((!wanted[key]) ? 0f : 1f);
				opacity[key] = Mathf.MoveTowards(opacity[key], num2, num);
				SetOpacity(item.Value, opacity[key]);
				if (opacity[key] == num2)
				{
					if (!wanted[key])
					{
						managed[key].SetActive(false);
					}
					finished.Add(key);
				}
			}
			foreach (int item2 in finished)
			{
				fading.Remove(item2);
			}
		}

		private void Update()
		{
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			if (!ready || managed.Length != instances.Count)
			{
				Rebuild();
			}
			Transform val = target;
			if ((Object)(object)val == (Object)null && useMainCameraIfTargetMissing)
			{
				if (Time.unscaledTime >= nextCameraLookup)
				{
					Camera main = Camera.main;
					cachedCamera = ((!((Object)(object)main == (Object)null)) ? ((Component)main).transform : null);
					nextCameraLookup = Time.unscaledTime + 0.5f;
				}
				val = cachedCamera;
			}
			if ((Object)(object)val == (Object)null)
			{
				if (hadObserver)
				{
					Restore();
					ready = false;
				}
				hadObserver = false;
				return;
			}
			hadObserver = true;
			UpdateFades();
			if (!scanning)
			{
				if (Time.unscaledTime < nextScan)
				{
					return;
				}
				scanning = true;
				cursor = 0;
			}
			float num = Mathf.Max(1f, disableDistance);
			float num2 = Mathf.Clamp(reenableDistance, 0f, num);
			Vector3 position = val.position;
			for (int num3 = Mathf.Min(managed.Length, cursor + Mathf.Max(1, checksPerFrame)); cursor < num3; cursor++)
			{
				GameObject val2 = managed[cursor];
				if ((Object)(object)val2 == (Object)null || !originallyActive[cursor])
				{
					continue;
				}
				Vector3 val3 = positions[cursor] - position;
				if (horizontalDistanceOnly)
				{
					val3.y = 0f;
				}
				float num4 = ((!wanted[cursor]) ? num2 : num);
				bool flag = ((Vector3)(ref val3)).sqrMagnitude <= num4 * num4;
				if (!sampled[cursor])
				{
					sampled[cursor] = true;
					if (!flag)
					{
						wanted[cursor] = false;
						opacity[cursor] = 0f;
						val2.SetActive(false);
						continue;
					}
				}
				Request(cursor, flag);
			}
			if (cursor == managed.Length)
			{
				scanning = false;
				nextScan = Time.unscaledTime + Mathf.Max(0f, scanInterval);
			}
		}

		private void Restore()
		{
			if (managed == null)
			{
				return;
			}
			foreach (KeyValuePair<int, Renderer[]> item in fading)
			{
				SetOpacity(item.Value, 1f);
			}
			for (int i = 0; i < managed.Length; i++)
			{
				if (!((Object)(object)managed[i] == (Object)null) && !((Object)(object)managed[i] == (Object)(object)((Component)this).gameObject))
				{
					if (sampled[i] && opacity[i] < 1f)
					{
						SetOpacity(managed[i].GetComponentsInChildren<Renderer>(true), 1f);
					}
					managed[i].SetActive(originallyActive[i]);
				}
			}
			fading.Clear();
		}

		private void OnDisable()
		{
			Restore();
			ready = false;
		}
	}
}