Decompiled source of rp downtown ryze sandbox v0.1.0

rp_downtown_ryze_sandbox.dll

Decompiled 2 months ago
using System;
using System.Collections;
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 HarmonyLib;
using Sodalite.Api;
using Sodalite.Utilities;
using Technie.PhysicsCreator.QHull;
using UnityEditor;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.UI;

[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 MeatKit
{
	public class HideInNormalInspectorAttribute : PropertyAttribute
	{
	}
}
namespace brackets.rp_downtown_ryze_sandbox
{
	[BepInPlugin("brackets.rp_downtown_ryze_sandbox", "rp_downtown_ryze_sandbox", "0.1.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("nrgill28.Atlas", "1.0.1")]
	public class rp_downtown_ryze_sandboxPlugin : 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()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "brackets.rp_downtown_ryze_sandbox");
			AtlasPlugin.RegisterScene(Path.Combine(BasePath, "ryze_tnh"));
		}
	}
}
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 i = 0; i < list.Count; i++)
			{
				list2.AddRange(CreatePositionsAround(((Component)list[i]).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 val2 = x - positions[i];
						return ((Vector3)(ref val2)).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 j = 0; j < list2.Count; j++)
				{
					Vector3 center = dictionary[list2[j]].Aggregate(Vector3.zero, (Vector3 result, Vector3 target) => result + target) / (float)dictionary[list2[j]].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 result2;
					if (y != x)
					{
						Vector3 val = y - x;
						result2 = ((((Vector3)(ref val)).magnitude < distance) ? 1 : 0);
					}
					else
					{
						result2 = 0;
					}
					return (byte)result2 != 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 != 0) ? 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 != 0) ? 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 result, Vector3 point) => result + point) / (float)points.Length;
			Bounds result2 = default(Bounds);
			((Bounds)(ref result2))..ctor(val, Vector3.zero);
			for (int i = 0; i < points.Length; i++)
			{
				((Bounds)(ref result2)).Encapsulate(points[i]);
			}
			return result2;
		}

		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;
			}
		}

		public static Volume EditorVolumeControl(TransformVolume transformVolume, float handleSize, Color color)
		{
			//IL_000f: 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_0052: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//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_00de: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Expected O, but got Unknown
			//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_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Expected O, but got Unknown
			//IL_0198: 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)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Expected O, but got Unknown
			//IL_01de: 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_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: 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_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: 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_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			Vector3[] array = (Vector3[])(object)new Vector3[6];
			Transform transform = ((Component)transformVolume).transform;
			Handles.color = color;
			for (int i = 0; i < array.Length; i++)
			{
				ref Vector3 reference = ref array[i];
				reference = transformVolume.GetSidePosition(i);
			}
			ref Vector3 reference2 = ref array[0];
			reference2 = Handles.Slider(array[0], transform.right, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
			ref Vector3 reference3 = ref array[1];
			reference3 = Handles.Slider(array[1], transform.right, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
			ref Vector3 reference4 = ref array[2];
			reference4 = Handles.Slider(array[2], transform.up, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
			ref Vector3 reference5 = ref array[3];
			reference5 = Handles.Slider(array[3], transform.up, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
			ref Vector3 reference6 = ref array[4];
			reference6 = Handles.Slider(array[4], transform.forward, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
			ref Vector3 reference7 = ref array[5];
			reference7 = Handles.Slider(array[5], transform.forward, handleSize, new CapFunction(Handles.DotHandleCap), 1f);
			Vector3 origin = default(Vector3);
			origin.x = transform.InverseTransformPoint((array[0] + array[1]) * 0.5f).x;
			origin.y = transform.InverseTransformPoint((array[2] + array[3]) * 0.5f).y;
			origin.z = transform.InverseTransformPoint((array[4] + array[5]) * 0.5f).z;
			Vector3 size = default(Vector3);
			size.x = transform.InverseTransformPoint(array[0]).x - transform.InverseTransformPoint(array[1]).x;
			size.y = transform.InverseTransformPoint(array[2]).y - transform.InverseTransformPoint(array[3]).y;
			size.z = transform.InverseTransformPoint(array[4]).z - transform.InverseTransformPoint(array[5]).z;
			return new Volume(origin, size);
		}
	}
	[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)
			Vector3 origin = Origin;
			int num = ((object)(Vector3)(ref origin)).GetHashCode() * 397;
			Vector3 size = Size;
			return num ^ ((object)(Vector3)(ref size)).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 nrgill28.AtlasSampleScene
{
	public class CTF_CaptureZone : MonoBehaviour
	{
		public CTF_Manager Manager;

		public CTF_Team Team;

		public void OnTriggerEnter(Collider other)
		{
			CTF_Flag component = ((Component)other).GetComponent<CTF_Flag>();
			if (Object.op_Implicit((Object)(object)component) && component.Team != Team)
			{
				Manager.FlagCaptured(component);
			}
		}
	}
	public class CTF_Flag : FVRPhysicalObject
	{
		[Header("Flag stuffs")]
		public CTF_Team Team;

		public float RespawnDelay = 10f;

		public Vector3 FloorOffset = new Vector3(0f, 0.25f, 0f);

		private Vector3 _resetPosition;

		private Quaternion _resetRotation;

		private Transform _followTransform;

		private bool _isHeld;

		private bool _isTaken;

		private float _timer;

		private CTF_Sosig _heldBy;

		public override void Awake()
		{
			//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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			((FVRPhysicalObject)this).Awake();
			_resetPosition = ((Component)this).transform.position;
			_resetRotation = ((Component)this).transform.rotation;
		}

		private void Update()
		{
			if (_isTaken && !_isHeld)
			{
				_timer -= Time.deltaTime;
				if (_timer < 0f)
				{
					ReturnFlag();
				}
			}
		}

		public void Take()
		{
			_isHeld = true;
			_isTaken = true;
		}

		public void Drop()
		{
			//IL_001a: 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_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_0050: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).IsHeld = false;
			_timer = RespawnDelay;
			NavMeshHit val = default(NavMeshHit);
			NavMesh.SamplePosition(((Component)this).transform.position, ref val, 100f, -1);
			((Component)this).transform.position = ((NavMeshHit)(ref val)).position + FloorOffset;
			((Component)this).transform.rotation = Quaternion.identity;
		}

		public void ReturnFlag()
		{
			//IL_0035: 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)
			if (((FVRInteractiveObject)this).IsHeld)
			{
				((FVRInteractiveObject)this).ForceBreakInteraction();
			}
			if (Object.op_Implicit((Object)(object)_heldBy))
			{
				_heldBy.HeldFlag = null;
			}
			((Component)this).transform.SetPositionAndRotation(_resetPosition, _resetRotation);
			_isTaken = false;
		}

		private void OnTriggerEnter(Collider other)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (_isHeld)
			{
				return;
			}
			CTF_Sosig componentInParent = ((Component)other).GetComponentInParent<CTF_Sosig>();
			if (Object.op_Implicit((Object)(object)componentInParent) && (int)componentInParent.Sosig.BodyState == 0)
			{
				if (componentInParent.Team == Team)
				{
					ReturnFlag();
					return;
				}
				_heldBy = componentInParent;
				componentInParent.HeldFlag = this;
				Take();
			}
		}

		public override void BeginInteraction(FVRViveHand hand)
		{
			((FVRPhysicalObject)this).BeginInteraction(hand);
			Take();
		}

		public override void EndInteraction(FVRViveHand hand)
		{
			((FVRPhysicalObject)this).EndInteraction(hand);
			Drop();
		}
	}
	public class CTF_Manager : MonoBehaviour
	{
		[Header("References")]
		public Text[] ScoreTexts;

		public Transform[] AttackPoints;

		public Text StartButtonText;

		[Header("Red Team")]
		public CTF_Flag RedFlag;

		public int RedTeamSize;

		public Transform[] RedSpawns;

		public SosigEnemyID[] RedTeam;

		[Header("Blue Team")]
		public CTF_Flag BlueFlag;

		public int BlueTeamSize;

		public Transform[] BlueSpawns;

		public SosigEnemyID[] BlueTeam;

		private int _blueScore;

		private int _redScore;

		private bool _running;

		private readonly List<CTF_Sosig> _sosigs = new List<CTF_Sosig>();

		private readonly SpawnOptions _spawnOptions;

		public CTF_Manager()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			SpawnOptions val = new SpawnOptions();
			val.SpawnState = (SosigOrder)7;
			val.SpawnActivated = true;
			val.EquipmentMode = (EquipmentSlots)7;
			val.SpawnWithFullAmmo = true;
			_spawnOptions = val;
			((MonoBehaviour)this)..ctor();
		}

		private void Start()
		{
			UpdateScoreText();
		}

		public void ToggleGame()
		{
			if (_running)
			{
				EndGame();
				StartButtonText.text = "Start Game";
			}
			else
			{
				StartGame();
				StartButtonText.text = "Stop Game";
			}
		}

		private void StartGame()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			ResetGame();
			_running = true;
			GM.CurrentSceneSettings.SosigKillEvent += new SosigKill(CurrentSceneSettingsOnSosigKillEvent);
			((MonoBehaviour)this).StartCoroutine(DoInitialSpawns());
		}

		private void EndGame()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			GM.CurrentSceneSettings.SosigKillEvent -= new SosigKill(CurrentSceneSettingsOnSosigKillEvent);
			foreach (CTF_Sosig sosig in _sosigs)
			{
				sosig.Sosig.ClearSosig();
			}
			_running = false;
		}

		private void CurrentSceneSettingsOnSosigKillEvent(Sosig s)
		{
			CTF_Sosig cTF_Sosig = _sosigs.FirstOrDefault((CTF_Sosig x) => (Object)(object)x.Sosig == (Object)(object)s);
			if (Object.op_Implicit((Object)(object)cTF_Sosig))
			{
				((MonoBehaviour)this).StartCoroutine(RespawnSosig(cTF_Sosig));
			}
		}

		private void SpawnSosig(CTF_Team team)
		{
			//IL_001e: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			_spawnOptions.IFF = (int)team;
			_spawnOptions.SosigTargetPosition = SodaliteUtils.GetRandom<Transform>((IList<Transform>)AttackPoints).position;
			Transform transform;
			SosigEnemyID random;
			if (team == CTF_Team.Red)
			{
				transform = ((Component)SodaliteUtils.GetRandom<Transform>((IList<Transform>)RedSpawns)).transform;
				random = SodaliteUtils.GetRandom<SosigEnemyID>((IList<SosigEnemyID>)RedTeam);
			}
			else
			{
				transform = ((Component)SodaliteUtils.GetRandom<Transform>((IList<Transform>)BlueSpawns)).transform;
				random = SodaliteUtils.GetRandom<SosigEnemyID>((IList<SosigEnemyID>)BlueTeam);
			}
			Sosig val = SosigAPI.Spawn(ManagerSingleton<IM>.Instance.odicSosigObjsByID[random], _spawnOptions, transform.position, transform.rotation);
			CTF_Sosig cTF_Sosig = ((Component)val).gameObject.AddComponent<CTF_Sosig>();
			_sosigs.Add(cTF_Sosig);
			cTF_Sosig.Sosig = val;
			cTF_Sosig.Team = team;
		}

		private IEnumerator DoInitialSpawns()
		{
			int i = 0;
			while (i < Mathf.Max(RedTeamSize, BlueTeamSize))
			{
				if (i < RedTeamSize)
				{
					SpawnSosig(CTF_Team.Red);
				}
				if (i < BlueTeamSize)
				{
					SpawnSosig(CTF_Team.Blue);
				}
				i++;
				yield return (object)new WaitForSeconds(2.5f);
			}
		}

		private IEnumerator RespawnSosig(CTF_Sosig sosig)
		{
			yield return (object)new WaitForSeconds(5f);
			sosig.Sosig.ClearSosig();
			_sosigs.Remove(sosig);
			yield return (object)new WaitForSeconds(5f);
			if (_running)
			{
				int sosigsLeft = _sosigs.Count((CTF_Sosig x) => x.Team == sosig.Team);
				int teamSize = ((sosig.Team != 0) ? BlueTeamSize : RedTeamSize);
				if (sosigsLeft < teamSize)
				{
					SpawnSosig(sosig.Team);
				}
			}
		}

		public void ResetGame()
		{
			_blueScore = 0;
			_redScore = 0;
			UpdateScoreText();
			if (Object.op_Implicit((Object)(object)RedFlag))
			{
				RedFlag.ReturnFlag();
			}
			if (Object.op_Implicit((Object)(object)BlueFlag))
			{
				BlueFlag.ReturnFlag();
			}
		}

		public void FlagCaptured(CTF_Flag flag)
		{
			if (flag.Team == CTF_Team.Red)
			{
				_blueScore++;
			}
			else
			{
				_redScore++;
			}
			UpdateScoreText();
			flag.ReturnFlag();
		}

		public void UpdateScoreText()
		{
			Text[] scoreTexts = ScoreTexts;
			foreach (Text val in scoreTexts)
			{
				val.text = "<color=red>" + _redScore + "</color> - <color=blue>" + _blueScore + "</color>";
			}
		}

		private void OnDrawGizmos()
		{
			//IL_0001: 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_003b: 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_007d: 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)
			Gizmos.color = Color.red;
			Transform[] redSpawns = RedSpawns;
			foreach (Transform val in redSpawns)
			{
				Gizmos.DrawSphere(val.position, 0.15f);
			}
			Gizmos.color = Color.blue;
			Transform[] blueSpawns = BlueSpawns;
			foreach (Transform val2 in blueSpawns)
			{
				Gizmos.DrawSphere(val2.position, 0.15f);
			}
			Gizmos.color = Color.green;
			Transform[] attackPoints = AttackPoints;
			foreach (Transform val3 in attackPoints)
			{
				Gizmos.DrawSphere(val3.position, 0.15f);
			}
		}
	}
	public class CTF_Sosig : MonoBehaviour
	{
		public CTF_Team Team;

		public CTF_Flag HeldFlag;

		public Sosig Sosig;

		private void Awake()
		{
			Sosig = ((Component)this).GetComponent<Sosig>();
		}

		private void Update()
		{
			//IL_001d: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0059: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)HeldFlag))
			{
				Vector3 val = ((Component)Sosig).transform.position - ((Component)Sosig).transform.forward * 0.1f;
				((Component)HeldFlag).transform.SetPositionAndRotation(val, ((Component)Sosig).transform.rotation);
			}
		}
	}
	public enum CTF_Team
	{
		Red,
		Blue
	}
	public class PopupTarget : MonoBehaviour, IFVRDamageable
	{
		[Flags]
		public enum TargetRange
		{
			Near = 1,
			Mid = 2,
			Far = 4,
			All = 7
		}

		public PopupTargetManager Manager;

		public TargetRange Range;

		public Transform Pivot;

		public Vector3 SetRotation;

		private Quaternion _startRotation;

		private Quaternion _endRotation;

		private bool _set;

		public bool Set
		{
			get
			{
				return _set;
			}
			set
			{
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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_002d: Unknown result type (might be due to invalid IL or missing references)
				if (_set != value)
				{
					_set = value;
					((MonoBehaviour)this).StartCoroutine((!_set) ? RotateTo(_endRotation, _startRotation) : RotateTo(_startRotation, _endRotation));
				}
			}
		}

		private void Awake()
		{
			//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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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)
			_startRotation = Pivot.rotation;
			_endRotation = Quaternion.Euler(SetRotation + ((Quaternion)(ref _startRotation)).eulerAngles);
		}

		void IFVRDamageable.Damage(Damage dam)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			if (Set && (int)dam.Class == 1)
			{
				Set = false;
				Manager.TargetHit(this);
			}
		}

		private IEnumerator RotateTo(Quaternion from, Quaternion to)
		{
			//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_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			float elapsed = 0f;
			while (elapsed < 0.25f)
			{
				yield return null;
				elapsed += Time.deltaTime;
				Pivot.localRotation = Quaternion.Slerp(from, to, elapsed / 0.25f);
			}
			Pivot.rotation = to;
		}
	}
	public class PopupTargetManager : MonoBehaviour
	{
		public List<PopupTarget> Targets;

		private readonly List<PopupTarget> _setTargets = new List<PopupTarget>();

		private void Awake()
		{
			((MonoBehaviour)this).StartCoroutine(StartSetAsync(3f, 8f, 5, PopupTarget.TargetRange.All));
		}

		private IEnumerator StartSetAsync(float minDelay, float maxDelay, int numTargets, PopupTarget.TargetRange ranges)
		{
			yield return (object)new WaitForSeconds(Random.Range(minDelay, maxDelay));
			IListExtensions.Shuffle<PopupTarget>((IList<PopupTarget>)Targets);
			_setTargets.Clear();
			foreach (PopupTarget target in Targets)
			{
				if ((target.Range & ranges) != 0)
				{
					target.Set = true;
					_setTargets.Add(target);
					numTargets--;
				}
				if (numTargets == 0)
				{
					break;
				}
			}
		}

		public void TargetHit(PopupTarget target)
		{
			if (_setTargets.Contains(target))
			{
				_setTargets.Remove(target);
				if (_setTargets.Count == 0)
				{
					((MonoBehaviour)this).StartCoroutine(StartSetAsync(3f, 8f, 5, PopupTarget.TargetRange.All));
				}
			}
		}
	}
}
public class Door : MonoBehaviour
{
	public float Speed = 1f;

	private void Update()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.Rotate(new Vector3(0f, 1f, 0f) * Time.deltaTime * Speed);
	}
}
public class Gun : MonoBehaviour
{
	private bool MousePrev = false;

	public GameObject GunObject;

	private Animation GunAnimation;

	private AudioSource SoundEmmiter;

	private void Start()
	{
		GunAnimation = GunObject.GetComponent<Animation>();
		SoundEmmiter = ((Component)this).gameObject.GetComponent<AudioSource>();
	}

	private void Update()
	{
		//IL_0056: 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_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: 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)
		bool mouseButton = Input.GetMouseButton(0);
		if (mouseButton && !MousePrev)
		{
			GunAnimation.Stop();
			GunAnimation.Play("Fire");
			SoundEmmiter.Play();
			Ray val = Camera.main.ScreenPointToRay(Vector2.op_Implicit(new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2))));
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, ref val2) && ((Component)((RaycastHit)(ref val2)).transform).gameObject.tag == "ShatterableGlass")
			{
				ShatterableGlassInfo shatterableGlassInfo = new ShatterableGlassInfo(((RaycastHit)(ref val2)).point, ((Component)this).gameObject.transform.forward);
				((Component)((RaycastHit)(ref val2)).transform).gameObject.SendMessage("Shatter3D", (object)shatterableGlassInfo);
			}
		}
		MousePrev = mouseButton;
	}
}
public class Player : MonoBehaviour
{
	public float MoveSpeed = 6f;

	public float JumpSpeed = 8f;

	public float FallSpeed = 20f;

	private Vector3 MoveDirection = Vector3.zero;

	public float Sensitivity = 2f;

	public bool Smooth = false;

	public Texture Crosshair;

	private int CrosshairSize;

	public UseArea[] UseAreas;

	private float Yaw = 0f;

	private float Pitch = 0f;

	private float[] YawAvg = new float[32];

	private float[] PitchAvg = new float[32];

	private bool PrevUse = false;

	private bool PrevSlowMotion = false;

	private float Avg(float[] AvgValues, float New)
	{
		if (!Smooth)
		{
			return New;
		}
		float num = New;
		for (int num2 = 31; num2 > 0; num2--)
		{
			AvgValues[num2] = AvgValues[num2 - 1];
			num += AvgValues[num2 - 1];
		}
		AvgValues[0] = New;
		return num / 32f;
	}

	private void Start()
	{
		CrosshairSize = Screen.height / 30;
		Screen.lockCursor = true;
	}

	private void OnGUI()
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		GUI.DrawTexture(new Rect((float)(Screen.width / 2 - CrosshairSize), (float)(Screen.height / 2 - CrosshairSize), (float)(CrosshairSize * 2), (float)(CrosshairSize * 2)), Crosshair);
	}

	private void Update()
	{
		//IL_00a7: 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_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: 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_0033: 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_004a: 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_005c: 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)
		CharacterController component = ((Component)this).GetComponent<CharacterController>();
		if (component.isGrounded)
		{
			MoveDirection = new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical"));
			MoveDirection = ((Component)this).transform.TransformDirection(MoveDirection);
			MoveDirection *= MoveSpeed;
			if (Input.GetButton("Jump"))
			{
				MoveDirection.y = JumpSpeed;
			}
		}
		ref Vector3 moveDirection = ref MoveDirection;
		moveDirection.y -= FallSpeed * Time.deltaTime;
		component.Move(MoveDirection * Time.deltaTime);
		Yaw += Sensitivity * Avg(YawAvg, Input.GetAxis("Mouse X"));
		Pitch -= Sensitivity * Avg(PitchAvg, Input.GetAxis("Mouse Y"));
		((Component)Camera.main).transform.eulerAngles = new Vector3(Pitch, Yaw, 0f);
		((Component)this).transform.eulerAngles = new Vector3(0f, Yaw, 0f);
		bool key = Input.GetKey((KeyCode)101);
		if (key && !PrevUse)
		{
			UseArea[] useAreas = UseAreas;
			foreach (UseArea useArea in useAreas)
			{
				useArea.Use();
			}
		}
		PrevUse = key;
		bool key2 = Input.GetKey((KeyCode)113);
		if (key2 && !PrevSlowMotion)
		{
			Time.timeScale = 0.25f;
			Time.fixedDeltaTime /= 4f;
		}
		if (!key2 && PrevSlowMotion)
		{
			Time.timeScale = 1f;
			Time.fixedDeltaTime *= 4f;
		}
		PrevSlowMotion = key2;
	}
}
public class Trigger : MonoBehaviour
{
	public ShatterableGlass Glass;

	private void OnTriggerEnter(Collider Intruder)
	{
		//IL_002d: 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)
		if (((Component)Intruder).tag == "Player")
		{
			if (Object.op_Implicit((Object)(object)Glass))
			{
				Glass.Shatter(Vector2.zero, ((Component)Glass).transform.forward);
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
public class UseArea : MonoBehaviour
{
	private bool PlayerIsHere = false;

	public ShatterableGlass Glass;

	private void OnTriggerEnter(Collider Intruder)
	{
		if (((Component)Intruder).tag == "Player")
		{
			PlayerIsHere = true;
		}
	}

	private void OnTriggerExit(Collider Intruder)
	{
		if (((Component)Intruder).tag == "Player")
		{
			PlayerIsHere = false;
		}
	}

	public void Use()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)Glass) && PlayerIsHere)
		{
			Glass.Shatter(Vector2.zero, ((Component)Glass).transform.forward);
		}
	}
}
public class ShatterableGlass : MonoBehaviour
{
	private class Figure
	{
		public Vector2[] Points;

		public int ForceScale;

		public Figure(Vector2[] Points, int ForceScale)
		{
			this.Points = Points;
			this.ForceScale = ForceScale;
		}

		public void GenerateCollider(float GlassThickness, GameObject Obj)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_004d: 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_0075: 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_0152: Unknown result type (might be due to invalid IL or missing references)
			BoxCollider val = Obj.AddComponent<BoxCollider>();
			float num = Vector2.Distance(Points[2], Points[0]);
			float num2 = Vector2.Distance(Points[2], Points[1]);
			float num3 = Vector2.Distance(Points[1], Points[0]);
			float num4 = num + num2 + num3;
			float num5 = (num * Points[0].x + num2 * Points[1].x + num3 * Points[2].x) / num4;
			float num6 = (num * Points[0].y + num2 * Points[1].y + num3 * Points[2].y) / num4;
			num4 /= 2f;
			float num7 = Mathf.Sqrt((num4 - num) * (num4 - num2) * (num4 - num3) / num4);
			num7 *= Mathf.Sqrt(2f);
			val.center = new Vector3(num5, num6, 0f);
			val.size = new Vector3(num7, num7, GlassThickness);
		}

		public Mesh GenerateMesh(bool GenerateGlassSides, float GlassHalfThickness, Vector2 UVScale)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//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_00ca: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			Mesh val = new Mesh();
			((Object)val).name = "GlassGib";
			if (GenerateGlassSides)
			{
				val.subMeshCount = 2;
			}
			bool flag = Points.Length == 3;
			Vector3[] array = (Vector3[])(object)new Vector3[flag ? ((!GenerateGlassSides) ? 3 : 9) : ((!GenerateGlassSides) ? 4 : 12)];
			Vector2[] array2 = (Vector2[])(object)new Vector2[array.Length];
			for (int i = 0; i < Points.Length; i++)
			{
				ref Vector3 reference = ref array[i];
				reference = Vector2.op_Implicit(Points[i]);
				ref Vector2 reference2 = ref array2[i];
				reference2 = new Vector2(Points[i].x / UVScale.x, Points[i].y / UVScale.y) + new Vector2(0.5f, 0.5f);
			}
			int[] array3 = ((!flag) ? new int[6] { 0, 1, 2, 3, 2, 1 } : new int[3] { 2, 1, 0 });
			if (GenerateGlassSides)
			{
				int[] array4;
				if (flag)
				{
					for (int j = 0; j < 3; j++)
					{
						GlassSideVertex(Points[j], ref array[j * 2 + 3], ref array[j * 2 + 4], GlassHalfThickness);
					}
					array4 = new int[18]
					{
						3, 4, 5, 4, 6, 5, 3, 4, 7, 7,
						8, 4, 5, 6, 8, 8, 7, 5
					};
				}
				else
				{
					for (int k = 0; k < 4; k++)
					{
						GlassSideVertex(Points[k], ref array[k * 2 + 4], ref array[k * 2 + 5], GlassHalfThickness);
					}
					array4 = new int[24]
					{
						7, 5, 4, 6, 7, 4, 11, 7, 6, 10,
						11, 6, 10, 11, 9, 9, 8, 10, 8, 9,
						5, 8, 4, 5
					};
				}
				val.vertices = array;
				val.SetTriangles(array3, 0);
				val.SetTriangles(array4, 1);
			}
			else
			{
				val.vertices = array;
				val.triangles = array3;
			}
			val.uv = array2;
			return val;
		}

		private void GlassSideVertex(Vector2 Ref, ref Vector3 A, ref Vector3 B, float GlassHalfThickness)
		{
			((Vector3)(ref A))..ctor(Ref.x, Ref.y, GlassHalfThickness);
			((Vector3)(ref B))..ctor(Ref.x, Ref.y, 0f - GlassHalfThickness);
		}
	}

	private class BaseLine
	{
		public Vector2[] Points;

		public BaseLine(Vector2 HitPoint, Vector2 End, int Count)
		{
			//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_0033: 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_00d0: 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_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)
			Points = (Vector2[])(object)new Vector2[Count + 1];
			Points[0] = HitPoint;
			Points[Count] = End;
			float num = 1f / (float)Count;
			float num2 = num;
			float num3 = Mathf.Atan2(Mathf.Max(HitPoint.y, End.y) - Mathf.Min(HitPoint.y, End.y), Mathf.Max(End.x, HitPoint.x) - Mathf.Min(HitPoint.x, End.x));
			float num4 = (float)Math.PI / 4f;
			float num5 = (float)Math.PI / 2f;
			if (num3 > num4)
			{
				num3 = num5 - num3;
			}
			float num6 = num3 / num4;
			for (int i = 0; i < Count - 1; i++)
			{
				ref Vector2 reference = ref Points[i + 1];
				reference = Vector2.Lerp(HitPoint, End, num2 * Mathf.Lerp(1f, Mathf.Sqrt(2f) / 2f, num6));
				num2 += num;
			}
		}
	}

	public int Sectors = 3;

	public int DetailsPerSector = 3;

	public float SimplifyThreshold = 0.05f;

	public bool GlassSides = true;

	public Material GlassSidesMaterial;

	public float GlassThickness = 0.01f;

	public bool ShatterButNotBreak = false;

	public bool SlightlyRotateGibs = true;

	public bool DestroyGibs = true;

	public float AfterSeconds = 5f;

	public bool GibsOnSeparateLayer = false;

	public int GibsLayer = 0;

	public float Force = 100f;

	public bool AdoptFragments = false;

	private Vector2[] Bounds = (Vector2[])(object)new Vector2[4];

	private float Area = 1f;

	private Material GlassMaterial;

	private AudioSource SoundEmitter;

	private void Start()
	{
		//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_0026: 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_0056: 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_006f: 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_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_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)
		float num = Mathf.Abs(((Component)this).transform.lossyScale.x / 2f);
		float num2 = Mathf.Abs(((Component)this).transform.lossyScale.y / 2f);
		Area = num * num2;
		ref Vector2 reference = ref Bounds[0];
		reference = new Vector2(num, num2);
		ref Vector2 reference2 = ref Bounds[1];
		reference2 = new Vector2(0f - num, num2);
		ref Vector2 reference3 = ref Bounds[2];
		reference3 = new Vector2(0f - num, 0f - num2);
		ref Vector2 reference4 = ref Bounds[3];
		reference4 = new Vector2(num, 0f - num2);
		SoundEmitter = ((Component)this).GetComponent<AudioSource>();
		if ((Object)(object)((Component)this).GetComponent<Renderer>() == (Object)null || (Object)(object)((Component)this).GetComponent<MeshFilter>() == (Object)null)
		{
			Debug.LogError((object)(((Object)((Component)this).gameObject).name + ": No Renderer and/or MeshFilter components!"));
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		GlassMaterial = ((Component)this).GetComponent<Renderer>().material;
		if (GlassSides && (Object)(object)GlassSidesMaterial == (Object)null)
		{
			Debug.LogError((object)(((Object)((Component)this).gameObject).name + ": GlassSide material must be assigned! Glass will be destroyed."));
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}

	public void Shatter2D(Vector2 HitPoint)
	{
		//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)
		Shatter(HitPoint, ((Component)this).transform.forward);
	}

	public void Shatter3D(ShatterableGlassInfo Inf)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: 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_00ca: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: 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_00ec: 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_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: 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_019a: 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)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: 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)
		Transform parent = ((Component)this).gameObject.transform.parent;
		bool flag = true;
		while ((Object)(object)parent != (Object)null)
		{
			if (parent.localScale.x != 1f || parent.localScale.y != 1f || parent.localScale.y != 1f)
			{
				flag = false;
			}
			parent = parent.parent;
		}
		if (!flag)
		{
			Debug.LogWarning((object)(((Object)((Component)this).gameObject).name + ": scale of all parents in hierarchy recommended to be {1, 1, 1}. Glass may shatter weirdly."));
		}
		Vector3 val = ((Component)this).transform.TransformPoint(new Vector3(-0.5f, -0.5f));
		Vector3 val2 = ((Component)this).transform.TransformPoint(new Vector3(0.5f, -0.5f));
		float num = Vector3.Distance(Inf.HitPoint, val);
		float num2 = Vector3.Distance(val2, val);
		float num3 = Vector3.Distance(Inf.HitPoint, val2);
		float num4 = (num3 + num + num2) / 2f;
		float num5 = Mathf.Sqrt(num4 * (num4 - num3) * (num4 - num) * (num4 - num2));
		float num6 = 2f / num2 * num5;
		float num7 = Mathf.Sqrt(num * num - num6 * num6);
		num6 -= Mathf.Abs(((Component)this).transform.lossyScale.y / 2f);
		num7 -= Mathf.Abs(((Component)this).transform.lossyScale.x / 2f);
		Shatter(new Vector2(num7 * Mathf.Sign(((Component)this).transform.lossyScale.x), num6 * Mathf.Sign(((Component)this).transform.lossyScale.y)), Inf.HitDirrection);
	}

	public void Shatter(Vector2 HitPoint, Vector3 ForceDirrection)
	{
		//IL_0026: 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_006a: 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_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: 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_0118: 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_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_0236: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_0256: Unknown result type (might be due to invalid IL or missing references)
		//IL_0262: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_029c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_030e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0313: Unknown result type (might be due to invalid IL or missing references)
		//IL_036c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0373: Expected O, but got Unknown
		//IL_0380: Unknown result type (might be due to invalid IL or missing references)
		//IL_0397: Unknown result type (might be due to invalid IL or missing references)
		//IL_042b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0430: Unknown result type (might be due to invalid IL or missing references)
		//IL_043f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0444: Unknown result type (might be due to invalid IL or missing references)
		//IL_044d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0488: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_054d: Unknown result type (might be due to invalid IL or missing references)
		int num = 4 + (Sectors - 1) * 4;
		BaseLine[] array = new BaseLine[num];
		for (int i = 0; i < 4; i++)
		{
			array[i * Sectors] = new BaseLine(HitPoint, Bounds[i], DetailsPerSector);
			float num2 = 1f / (float)Sectors;
			float num3 = num2;
			for (int j = 1; j < Sectors; j++)
			{
				array[i * Sectors + j] = new BaseLine(HitPoint, Vector2.Lerp(Bounds[i], Bounds[(i + 1) % 4], num3), DetailsPerSector);
				num3 += num2;
			}
		}
		List<Figure> list = new List<Figure>();
		for (int k = 0; k < num; k++)
		{
			int num4 = (k + 1) % num;
			float num5 = Vector2.Distance(HitPoint, array[k].Points[DetailsPerSector]);
			float num6 = Vector2.Distance(HitPoint, array[num4].Points[DetailsPerSector]);
			float num7 = Vector2.Distance(array[k].Points[DetailsPerSector], array[num4].Points[DetailsPerSector]);
			float num8 = (num5 + num6 + num7) * 0.5f;
			float num9 = Mathf.Sqrt(num8 * (num8 - num5) * (num8 - num6) * (num8 - num7));
			if (num9 < Area * SimplifyThreshold)
			{
				list.Add(new Figure((Vector2[])(object)new Vector2[3]
				{
					array[k].Points[DetailsPerSector],
					array[num4].Points[DetailsPerSector],
					HitPoint
				}, DetailsPerSector / 2));
				continue;
			}
			list.Add(new Figure((Vector2[])(object)new Vector2[3]
			{
				array[k].Points[1],
				array[num4].Points[1],
				HitPoint
			}, 1));
			for (int l = 1; l < DetailsPerSector; l++)
			{
				list.Add(new Figure((Vector2[])(object)new Vector2[4]
				{
					array[k].Points[l],
					array[(k + 1) % num].Points[l],
					array[k].Points[l + 1],
					array[(k + 1) % num].Points[l + 1]
				}, k + 1));
			}
		}
		foreach (Figure item in list)
		{
			GameObject val = new GameObject("GlassGib");
			val.transform.rotation = ((Component)this).transform.rotation;
			val.transform.position = ((Component)this).transform.position;
			if (AdoptFragments)
			{
				val.transform.parent = ((Component)this).transform.parent;
			}
			MeshFilter val2 = val.AddComponent<MeshFilter>();
			MeshRenderer val3 = val.AddComponent<MeshRenderer>();
			if (GlassSides)
			{
				((Renderer)val3).materials = (Material[])(object)new Material[2] { GlassMaterial, GlassSidesMaterial };
			}
			else
			{
				((Renderer)val3).material = GlassMaterial;
			}
			Mesh sharedMesh = item.GenerateMesh(GlassSides, GlassThickness / 2f, new Vector2(((Component)this).transform.lossyScale.x, ((Component)this).transform.lossyScale.y));
			val2.sharedMesh = sharedMesh;
			if (!ShatterButNotBreak)
			{
				item.GenerateCollider(GlassThickness, val);
				Rigidbody val4 = val.AddComponent<Rigidbody>();
				val4.AddForce(ForceDirrection * Random.Range(Force, Force * 1.5f) / (float)item.ForceScale);
				if (GibsOnSeparateLayer)
				{
					val.layer = GibsLayer;
				}
				if (DestroyGibs)
				{
					float num10 = AfterSeconds * 0.1f;
					Object.Destroy((Object)(object)val, Random.Range(AfterSeconds - num10, AfterSeconds + num10));
				}
			}
			else if (SlightlyRotateGibs)
			{
				val.transform.Rotate(new Vector3(Random.Range(-0.5f, 0.5f), Random.Range(-0.5f, 0.5f), Random.Range(-0.5f, 0.5f)));
			}
		}
		if (Object.op_Implicit((Object)(object)SoundEmitter))
		{
			SoundEmitter.Play();
		}
		Object.Destroy((Object)(object)((Component)this).GetComponent<Renderer>());
		Object.Destroy((Object)(object)((Component)this).GetComponent<MeshFilter>());
		Object.Destroy((Object)(object)((Component)this).GetComponent<ShatterableGlass>());
		if (ShatterButNotBreak)
		{
			((Component)this).gameObject.tag = "Untagged";
			return;
		}
		Object.Destroy((Object)(object)((Component)this).GetComponent<MeshCollider>());
		if (Object.op_Implicit((Object)(object)SoundEmitter))
		{
			if (Object.op_Implicit((Object)(object)SoundEmitter.clip))
			{
				Object.Destroy((Object)(object)((Component)this).gameObject, SoundEmitter.clip.length);
			}
			else
			{
				Debug.Log((object)(((Object)((Component)this).gameObject).name + ": AudioSource component is present, but SoundClip is not set."));
			}
		}
		else
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
public class ShatterableGlassInfo
{
	public Vector3 HitPoint;

	public Vector3 HitDirrection;

	public ShatterableGlassInfo(Vector3 HitPoint, Vector3 HitDirrection)
	{
		//IL_0008: 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_000f: 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)
		this.HitPoint = HitPoint;
		this.HitDirrection = HitDirrection;
	}
}
namespace ShatterableGlassScripts
{
	public class ShatterableGlassScripts : MonoBehaviour, IFVRDamageable
	{
		private ShatterableGlass _glass;

		private bool _smashed;

		public float MeleeDamageThreshold = 9999f;

		public float ExplosiveDamageThreshold = 1f;

		public float ProjectileDamageThreshold = 4500f;

		public float AbstractDamageThreshold = 1f;

		public float EnvironmentDamageThreshold = 1f;

		public float MeleeForceMultiplier = 1f;

		public float ExplosiveForceMultiplier = 1f;

		public float ProjectileForceMultiplier = 1f;

		public float AbstractForceMultiplier = 1f;

		public float EnvironmentForceMultiplier = 1f;

		private const float epsilon = 0.001f;

		private void Awake()
		{
			_glass = ((Component)this).GetComponent<ShatterableGlass>();
			_smashed = false;
		}

		public void Damage(Damage dam)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Invalid comparison between Unknown and I4
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Invalid comparison between Unknown and I4
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Invalid comparison between Unknown and I4
			//IL_0059: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Invalid comparison between Unknown and I4
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//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_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			if (!_smashed)
			{
				if ((int)dam.Class == 3 && dam.Dam_TotalKinetic > MeleeDamageThreshold + 0.001f)
				{
					_glass.Force = dam.Dam_TotalKinetic * MeleeForceMultiplier;
					_smashed = true;
					_glass.Shatter3D(new ShatterableGlassInfo(dam.point, -dam.hitNormal));
				}
				else if ((int)dam.Class == 2 && dam.Dam_TotalKinetic > ExplosiveDamageThreshold + 0.001f)
				{
					_glass.Force = dam.Dam_TotalKinetic * ExplosiveForceMultiplier;
					_smashed = true;
					_glass.Shatter3D(new ShatterableGlassInfo(dam.point, -dam.hitNormal));
				}
				else if ((int)dam.Class == 1 && dam.Dam_TotalKinetic > ProjectileDamageThreshold + 0.001f)
				{
					_glass.Force = dam.Dam_TotalKinetic * ProjectileForceMultiplier;
					_smashed = true;
					_glass.Shatter3D(new ShatterableGlassInfo(dam.point, -dam.hitNormal));
				}
				else if ((int)dam.Class == 0 && dam.Dam_TotalKinetic > AbstractDamageThreshold + 0.001f)
				{
					_glass.Force = dam.Dam_TotalKinetic * AbstractForceMultiplier;
					_smashed = true;
					_glass.Shatter3D(new ShatterableGlassInfo(dam.point, -dam.hitNormal));
				}
				else if ((int)dam.Class == 4 && dam.Dam_TotalKinetic > EnvironmentDamageThreshold + 0.001f)
				{
					_glass.Force = dam.Dam_TotalKinetic * EnvironmentForceMultiplier;
					_smashed = true;
					_glass.Shatter3D(new ShatterableGlassInfo(dam.point, -dam.hitNormal));
				}
			}
		}
	}
}
namespace Technie.PhysicsCreator
{
	public class AxisAlignedBoxFitter
	{
		public void Fit(Hull hull, Vector3[] meshVertices, int[] meshIndices)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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)
			Vector3[] selectedVertices = FaceAlignmentBoxFitter.GetSelectedVertices(hull, meshVertices, meshIndices);
			ConstructionPlane plane = new ConstructionPlane(Vector3.zero, Vector3.up, Vector3.right);
			RotatedBox computedBox = RotatedBoxFitter.FindTightestBox(plane, selectedVertices);
			RotatedBoxFitter.ApplyToHull(computedBox, hull);
		}
	}
	public class Pose
	{
		public Vector3 forward;

		public Vector3 up;

		public Vector3 right;
	}
	public class Triangle
	{
		public Vector3 normal;

		public float area;

		public Vector3 center;

		public Triangle(Vector3 p0, Vector3 p1, Vector3 p2)
		{
			//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_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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			Vector3 val = p1 - p0;
			Vector3 val2 = p2 - p0;
			Vector3 val3 = Vector3.Cross(val, val2);
			area = ((Vector3)(ref val3)).magnitude * 0.5f;
			normal = ((Vector3)(ref val3)).normalized;
			center = (p0 + p1 + p2) / 3f;
		}
	}
	public class TriangleBucket
	{
		private List<Triangle> triangles;

		private Vector3 averagedNormal;

		private Vector3 averagedCenter;

		private float totalArea;

		public float Area => totalArea;

		public TriangleBucket(Triangle initialTriangle)
		{
			triangles = new List<Triangle>();
			triangles.Add(initialTriangle);
			CalculateNormal();
			CalcTotalArea();
		}

		public void Add(Triangle t)
		{
			triangles.Add(t);
			CalculateNormal();
			CalcTotalArea();
		}

		public void Add(TriangleBucket otherBucket)
		{
			foreach (Triangle triangle in otherBucket.triangles)
			{
				triangles.Add(triangle);
			}
			CalculateNormal();
			CalcTotalArea();
		}

		private void CalculateNormal()
		{
			//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_0029: 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_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_0044: Unknown result type (might be due to invalid IL or missing references)
			averagedNormal = Vector3.zero;
			foreach (Triangle triangle in triangles)
			{
				averagedNormal += triangle.normal * triangle.area;
			}
			((Vector3)(ref averagedNormal)).Normalize();
		}

		public Vector3 GetAverageNormal()
		{
			//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_000d: Unknown result type (might be due to invalid IL or missing references)
			return averagedNormal;
		}

		public Vector3 GetAverageCenter()
		{
			//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_0018: Unknown result type (might be due to invalid IL or missing references)
			return triangles[0].center;
		}

		private void CalcTotalArea()
		{
			totalArea = 0f;
			foreach (Triangle triangle in triangles)
			{
				totalArea += triangle.area;
			}
		}
	}
	public class TriangleAreaSorter : IComparer<Triangle>
	{
		public int Compare(Triangle lhs, Triangle rhs)
		{
			if (lhs.area < rhs.area)
			{
				return 1;
			}
			if (lhs.area > rhs.area)
			{
				return -1;
			}
			return 0;
		}
	}
	public class TriangleBucketSorter : IComparer<TriangleBucket>
	{
		public int Compare(TriangleBucket lhs, TriangleBucket rhs)
		{
			if (lhs.Area < rhs.Area)
			{
				return 1;
			}
			if (lhs.Area > rhs.Area)
			{
				return -1;
			}
			return 0;
		}
	}
	public class FaceAlignmentBoxFitter
	{
		public void Fit(Hull hull, Vector3[] meshVertices, int[] meshIndices)
		{
			if (meshIndices.Length < 3)
			{
				return;
			}
			List<Triangle> list = FindTriangles(meshVertices, meshIndices, hull.selectedFaces);
			list.Sort(new TriangleAreaSorter());
			List<TriangleBucket> list2 = new List<TriangleBucket>();
			foreach (Triangle item in list)
			{
				TriangleBucket triangleBucket = FindBestBucket(item, 30f, list2);
				if (triangleBucket != null)
				{
					triangleBucket.Add(item);
					continue;
				}
				triangleBucket = new TriangleBucket(item);
				list2.Add(triangleBucket);
			}
			while (list2.Count > 3)
			{
				MergeClosestBuckets(list2);
			}
			list2.Sort(new TriangleBucketSorter());
			Vector3[] selectedVertices = GetSelectedVertices(hull, meshVertices, meshIndices);
			ConstructionPlane plane = CreateConstructionPlane(list2[0], (list2.Count <= 1) ? null : list2[1], (list2.Count <= 2) ? null : list2[2]);
			RotatedBox computedBox = RotatedBoxFitter.FindTightestBox(plane, selectedVertices);
			RotatedBoxFitter.ApplyToHull(computedBox, hull);
		}

		public static List<Triangle> FindTriangles(Vector3[] meshVertices, int[] meshIndices, List<int> selectedFaces)
		{
			//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_004b: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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)
			List<Triangle> list = new List<Triangle>();
			foreach (int selectedFace in selectedFaces)
			{
				int num = meshIndices[selectedFace * 3];
				int num2 = meshIndices[selectedFace * 3 + 1];
				int num3 = meshIndices[selectedFace * 3 + 2];
				Vector3 p = meshVertices[num];
				Vector3 p2 = meshVertices[num2];
				Vector3 p3 = meshVertices[num3];
				Triangle item = new Triangle(p, p2, p3);
				list.Add(item);
			}
			return list;
		}

		public static void FindTriangles(Hull hull, Vector3[] meshVertices, int[] meshIndices, out Vector3[] hullVertices, out int[] hullIndices)
		{
			//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_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_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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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)
			List<Vector3> list = new List<Vector3>();
			foreach (int selectedFace in hull.selectedFaces)
			{
				int num = meshIndices[selectedFace * 3];
				int num2 = meshIndices[selectedFace * 3 + 1];
				int num3 = meshIndices[selectedFace * 3 + 2];
				Vector3 item = meshVertices[num];
				Vector3 item2 = meshVertices[num2];
				Vector3 item3 = meshVertices[num3];
				list.Add(item);
				list.Add(item2);
				list.Add(item3);
			}
			hullVertices = list.ToArray();
			hullIndices = new int[hullVertices.Length];
			for (int i = 0; i < hullIndices.Length; i++)
			{
				hullIndices[i] = i;
			}
		}

		public static Vector3[] GetSelectedVertices(Hull hull, Vector3[] meshVertices, int[] meshIndices)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<int, int> dictionary = new Dictionary<int, int>();
			foreach (int selectedFace in hull.selectedFaces)
			{
				int num = meshIndices[selectedFace * 3];
				int num2 = meshIndices[selectedFace * 3 + 1];
				int num3 = meshIndices[selectedFace * 3 + 2];
				dictionary[num] = num;
				dictionary[num2] = num2;
				dictionary[num3] = num3;
			}
			List<Vector3> list = new List<Vector3>();
			foreach (int key in dictionary.Keys)
			{
				list.Add(meshVertices[key]);
			}
			return list.ToArray();
		}

		private TriangleBucket FindBestBucket(Triangle tri, float thresholdAngleDeg, List<TriangleBucket> buckets)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_005a: 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_007f: 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)
			TriangleBucket result = null;
			float num = float.PositiveInfinity;
			foreach (TriangleBucket bucket in buckets)
			{
				float num2 = Vector3.Angle(tri.normal, bucket.GetAverageNormal());
				if (num2 < thresholdAngleDeg && num2 < num)
				{
					num = num2;
					result = bucket;
					continue;
				}
				float num3 = Vector3.Angle(tri.normal * -1f, bucket.GetAverageNormal());
				if (num3 < thresholdAngleDeg && num3 < num)
				{
					tri.normal *= -1f;
					num = num3;
					result = bucket;
				}
			}
			return result;
		}

		private void MergeClosestBuckets(List<TriangleBucket> buckets)
		{
			//IL_0033: 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)
			TriangleBucket triangleBucket = null;
			TriangleBucket triangleBucket2 = null;
			float num = float.PositiveInfinity;
			for (int i = 0; i < buckets.Count; i++)
			{
				for (int j = i + 1; j < buckets.Count; j++)
				{
					TriangleBucket triangleBucket3 = buckets[i];
					TriangleBucket triangleBucket4 = buckets[j];
					float num2 = Vector3.Angle(triangleBucket3.GetAverageNormal(), triangleBucket4.GetAverageNormal());
					if (num2 < num)
					{
						num = num2;
						triangleBucket = triangleBucket3;
						triangleBucket2 = triangleBucket4;
					}
				}
			}
			if (triangleBucket != null && triangleBucket2 != null)
			{
				buckets.Remove(triangleBucket2);
				triangleBucket.Add(triangleBucket2);
			}
		}

		private ConstructionPlane CreateConstructionPlane(TriangleBucket primaryBucket, TriangleBucket secondaryBucket, TriangleBucket tertiaryBucket)
		{
			//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_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_0050: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)