Decompiled source of EFT XM5 SPEAR v1.0.1

EFT_XM5_SPEAR.dll

Decompiled a month 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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using FistVR;
using H3VRUtils.FVRInteractiveObjects;
using MeatKit;
using OtherLoader;
using Sodalite.Api;
using Sodalite.Utilities;
using UnityEditor;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.UI;
using UnityEngine.Windows.Speech;

[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 JerryComponent
{
	public class CountDownFuzeInACase : MonoBehaviour
	{
		public AR15HandleSightFlipper trigger;

		public GameObject CaseOBJ;

		public GameObject ExplosionPrefab;

		public GameObject ExplosionFX;

		public Transform ExplosionPos;

		public float CountDown;

		public bool Activated = false;

		private void FixedUpdate()
		{
			//IL_005a: 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_0086: 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)
			if (!trigger.m_isLargeAperture)
			{
				Activated = true;
			}
			if (Activated)
			{
				CountDown -= Time.deltaTime;
				if (CountDown <= 0f)
				{
					Object.Instantiate<GameObject>(ExplosionPrefab, ((Component)ExplosionPos).transform.position, ((Component)ExplosionPos).transform.rotation);
					Object.Instantiate<GameObject>(ExplosionFX, ((Component)ExplosionPos).transform.position, ((Component)ExplosionPos).transform.rotation);
					Object.Destroy((Object)(object)CaseOBJ);
				}
			}
		}
	}
}
namespace JerryGameMode
{
	public class GRGmode : MonoBehaviour, IFVRDamageable
	{
		public Transform SpawnPoint_Large;

		public List<Transform> SpawnPoints_Small;

		[NonSerialized]
		public int m_curSmallPos;

		[NonSerialized]
		public GameObject CurrentlySpawnedRandomGun;

		[NonSerialized]
		public List<FVRObject> spawnCache = new List<FVRObject>();

		[NonSerialized]
		public FVRObject TestRandRoutineObj;

		[NonSerialized]
		public FVRFireArm fa;

		public float _damageReceived;

		public float _damageRequired = 1E-08f;

		private void Start()
		{
		}

		public void OnCurGunFired(FVRFireArm firearm)
		{
			if ((Object)(object)firearm == (Object)(object)fa)
			{
				if ((Object)(object)CurrentlySpawnedRandomGun != (Object)null)
				{
					Object.Destroy((Object)(object)CurrentlySpawnedRandomGun);
				}
				GM.CurrentMovementManager.Hands[0].m_wristmenu.CleanUpScene_All();
				GM.CurrentMovementManager.Hands[0].m_wristmenu.CleanUpScene_AllMags();
				GM.CurrentMovementManager.Hands[0].m_wristmenu.CleanUpScene_Empties();
				GM.CurrentMovementManager.Hands[0].m_wristmenu.CleanUpScene_Guns();
				TryToSpawnRandomGun();
			}
		}

		private void Awake()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(OnCurGunFired);
			TryToSpawnRandomGun();
		}

		public void TryToSpawnRandomGun()
		{
			spawnCache.Clear();
			List<FVRObject> list = ManagerSingleton<IM>.Instance.odicTagCategory[(ObjectCategory)1];
			Debug.Log((object)(list.Count + " guns found in all"));
			for (int i = 0; i < list.Count; i++)
			{
				FVRObject val = list[i];
				if (val.OSple && val.SpawnedFromId != null && !(val.SpawnedFromId == string.Empty) && IM.HasSpawnedID(val.SpawnedFromId) && IM.GetSpawnerID(val.SpawnedFromId).IsDisplayedInMainEntry && GM.Rewards.RewardUnlocks.IsRewardUnlocked(IM.GetSpawnerID(val.SpawnedFromId)))
				{
					spawnCache.Add(val);
				}
			}
			Debug.Log((object)(spawnCache.Count + " guns post cull"));
			FVRObject o = spawnCache[Random.Range(0, spawnCache.Count)];
			if ((Object)(object)TestRandRoutineObj != (Object)null)
			{
				o = TestRandRoutineObj;
			}
			Debug.Log((object)"Spawning Random gun 1");
			AnvilManager.Run(SpawnRandomGunRoutine(o));
		}

		public IEnumerator SpawnRandomGunRoutine(FVRObject o)
		{
			fa = null;
			Debug.Log((object)"Spawning Random gun 2");
			GameObject tempGO2 = null;
			if ((Object)(object)o == (Object)null)
			{
				yield break;
			}
			yield return ((AnvilAsset)o).GetGameObjectAsync();
			ItemSpawnerID tempID = IM.GetSpawnerID(o.SpawnedFromId);
			m_curSmallPos++;
			if (m_curSmallPos >= SpawnPoints_Small.Count)
			{
				m_curSmallPos = 0;
			}
			if ((Object)(object)tempID.SecondObject != (Object)null)
			{
				yield return ((AnvilAsset)tempID.SecondObject).GetGameObjectAsync();
				if ((Object)(object)((AnvilAsset)tempID.SecondObject).GetGameObject() != (Object)null)
				{
					GameObject val = Object.Instantiate<GameObject>(((AnvilAsset)tempID.SecondObject).GetGameObject(), SpawnPoints_Small[m_curSmallPos].position, SpawnPoints_Small[m_curSmallPos].rotation);
					m_curSmallPos++;
					if (m_curSmallPos >= SpawnPoints_Small.Count)
					{
						m_curSmallPos = 0;
					}
					val.SetActive(true);
				}
			}
			if (tempID.Secondaries.Length > 0)
			{
				for (int i = 0; i < tempID.Secondaries.Length; i++)
				{
					yield return ((AnvilAsset)tempID.Secondaries[i].MainObject).GetGameObjectAsync();
					if ((Object)(object)((AnvilAsset)tempID.Secondaries[i].MainObject).GetGameObject() != (Object)null)
					{
						GameObject val2 = Object.Instantiate<GameObject>(((AnvilAsset)tempID.Secondaries[i].MainObject).GetGameObject(), SpawnPoints_Small[m_curSmallPos].position, SpawnPoints_Small[m_curSmallPos].rotation);
						m_curSmallPos++;
						if (m_curSmallPos >= SpawnPoints_Small.Count)
						{
							m_curSmallPos = 0;
						}
						val2.SetActive(true);
					}
				}
			}
			tempGO2 = (CurrentlySpawnedRandomGun = Object.Instantiate<GameObject>(((AnvilAsset)o).GetGameObject(), SpawnPoint_Large.position + Vector3.up * 0.2f, SpawnPoint_Large.rotation));
			tempGO2.SetActive(true);
			fa = tempGO2.GetComponent<FVRFireArm>();
			if (!((Object)(object)fa == (Object)null))
			{
			}
		}

		private void Update()
		{
			//IL_0030: 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)
			if ((Object)(object)GM.CurrentMovementManager != (Object)null)
			{
				((Component)GM.CurrentMovementManager).gameObject.transform.position = new Vector3(0f, 0f, 0f);
				((Component)GM.CurrentMovementManager).gameObject.transform.eulerAngles = new Vector3(0f, 0f, 0f);
			}
		}

		private void OnDestroy()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			GM.CurrentSceneSettings.ShotFiredEvent -= new ShotFired(OnCurGunFired);
		}

		public void Damage(Damage dam)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = dam.point + dam.hitNormal * Random.Range(0.002f, 0.008f);
			_damageReceived += dam.Dam_Blunt;
			_damageReceived += dam.Dam_TotalEnergetic;
			_damageReceived += dam.Dam_TotalKinetic;
			if (_damageReceived >= _damageRequired)
			{
				if ((Object)(object)fa != (Object)null)
				{
					((FVRInteractiveObject)fa).ForceBreakInteraction();
				}
				GM.CurrentMovementManager.Hands[0].m_wristmenu.CleanUpScene_All();
				GM.CurrentMovementManager.Hands[0].m_wristmenu.CleanUpScene_AllMags();
				GM.CurrentMovementManager.Hands[0].m_wristmenu.CleanUpScene_Empties();
				GM.CurrentMovementManager.Hands[0].m_wristmenu.CleanUpScene_Guns();
				TryToSpawnRandomGun();
			}
		}
	}
}
namespace MeatKit
{
	public class HideInNormalInspectorAttribute : PropertyAttribute
	{
	}
}
namespace JerryAr.EFT_XM5_SPEAR
{
	[BepInPlugin("JerryAr.EFT_XM5_SPEAR", "EFT_XM5_SPEAR", "1.0.1")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class EFT_XM5_SPEARPlugin : 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()
		{
			OtherLoader.RegisterDirectLoad(BasePath, "JerryAr.EFT_XM5_SPEAR", "", "", "m5spear", "");
		}
	}
}
namespace JerryBepPlugin
{
	[BepInPlugin("JerryAr.NVGOffset", "NVGOffset", "1.0.0")]
	[BepInProcess("h3vr.exe")]
	public class BepInExPlugin : BaseUnityPlugin
	{
		public bool moved = false;

		public HeadAttachment HA;

		public static ConfigEntry<float> MoveXAxis;

		public static ConfigEntry<float> MoveYAxis;

		public static ConfigEntry<float> MoveZAxis;

		private void SetConfig()
		{
			MoveXAxis = ((BaseUnityPlugin)this).Config.Bind<float>("MoveXAxis", "Offset", 0f, "Offset on X Axis(Right+ / left-)(requires restart)");
			MoveYAxis = ((BaseUnityPlugin)this).Config.Bind<float>("MoveYAxis", "Offset", 0f, "Offset on Y Axis(Up+ / Down-)(requires restart)");
			MoveZAxis = ((BaseUnityPlugin)this).Config.Bind<float>("MoveZAxis", "Offset", 0f, "Offset on Z Axis(Forward+ / Rearward-)(requires restart)");
		}

		private void FixedUpdate()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			SetConfig();
			if ((Object)(object)HA == (Object)null)
			{
				HA = Object.FindObjectOfType<HeadAttachment>();
				moved = false;
			}
			else
			{
				if (!((Object)(object)HA != (Object)null) || moved)
				{
					return;
				}
				HA.Root.localPosition = new Vector3(HA.Root.localPosition.x + MoveXAxis.Value, HA.Root.localPosition.y + MoveYAxis.Value, HA.Root.localPosition.z + MoveZAxis.Value);
				if (((Component)HA).gameObject.GetComponents<CameraRelativeRenderer>().Length > 0)
				{
					for (int i = 0; i < ((Component)HA).gameObject.GetComponents<CameraRelativeRenderer>().Length; i++)
					{
						if (((Component)HA).gameObject.GetComponents<CameraRelativeRenderer>()[i].pipScopes.Length > 0)
						{
							for (int j = 0; j < ((Component)HA).gameObject.GetComponents<CameraRelativeRenderer>()[i].pipScopes.Length; j++)
							{
								((Component)((Component)HA).gameObject.GetComponents<CameraRelativeRenderer>()[i].pipScopes[j]).gameObject.transform.localEulerAngles = Vector3.RotateTowards(((Component)((Component)HA).gameObject.GetComponents<CameraRelativeRenderer>()[i].pipScopes[j]).gameObject.transform.localEulerAngles, ((Component)GM.CurrentMovementManager.Head).gameObject.transform.position, 100f, 100f);
								((Component)((Component)HA).gameObject.GetComponents<CameraRelativeRenderer>()[i].pipScopes[j]).gameObject.transform.localEulerAngles = new Vector3(((Component)((Component)HA).gameObject.GetComponents<CameraRelativeRenderer>()[i].pipScopes[j]).gameObject.transform.localEulerAngles.x, 0f, 0f);
							}
						}
					}
				}
				moved = true;
			}
		}
	}
}
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));
				}
			}
		}
	}
}
namespace JerryComponent
{
	[HelpURL("https://h3vr-modding.github.io/wiki/docs/h3vr/FistVR.FVRFoldingStockYAxis.html")]
	public class QFChamberLatch : FVRInteractiveObject
	{
		public enum StockPos
		{
			Closed,
			Mid,
			Open
		}

		public Transform Root;

		public Transform Stock;

		[NonSerialized]
		[HideInNormalInspector]
		public float rotAngle;

		public float MinRot;

		public float MaxRot;

		public StockPos m_curPos;

		public StockPos m_lastPos;

		public bool isMinClosed = true;

		public FVRFireArm FireArm;

		public FVRFireArmChamber FireArmChamber;

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_000e: 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_0024: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0061: 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_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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: 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_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Invalid comparison between Unknown and I4
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Invalid comparison between Unknown and I4
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).UpdateInteraction(hand);
			Vector3 val = ((HandInput)(ref hand.Input)).Pos - Root.position;
			Vector3 val2 = Vector3.ProjectOnPlane(val, Root.up);
			val = ((Vector3)(ref val2)).normalized;
			Vector3 val3 = -((Component)Root).transform.forward;
			rotAngle = Mathf.Atan2(Vector3.Dot(Root.up, Vector3.Cross(val3, val)), Vector3.Dot(val3, val)) * 57.29578f;
			if (Mathf.Abs(rotAngle - MinRot) < 5f)
			{
				rotAngle = MinRot;
			}
			if (Mathf.Abs(rotAngle - MaxRot) < 5f)
			{
				rotAngle = MaxRot;
			}
			if (!(rotAngle >= MinRot) || !(rotAngle <= MaxRot))
			{
				return;
			}
			Stock.localEulerAngles = new Vector3(0f, rotAngle, 0f);
			float num = Mathf.InverseLerp(MinRot, MaxRot, rotAngle);
			if (isMinClosed)
			{
				if (num < 0.02f)
				{
					m_curPos = (StockPos)0;
					FireArmChamber.IsManuallyExtractable = false;
					FireArmChamber.IsManuallyChamberable = false;
					FireArmChamber.IsAccessible = true;
				}
				else if (num > 0.9f)
				{
					m_curPos = (StockPos)2;
					FireArmChamber.IsManuallyExtractable = true;
					FireArmChamber.IsManuallyChamberable = true;
					FireArmChamber.IsAccessible = false;
				}
				else
				{
					m_curPos = (StockPos)1;
					FireArmChamber.IsManuallyExtractable = false;
					FireArmChamber.IsManuallyChamberable = false;
					FireArmChamber.IsAccessible = false;
				}
			}
			else if (num < 0.1f)
			{
				m_curPos = (StockPos)2;
				FireArmChamber.IsManuallyExtractable = true;
				FireArmChamber.IsManuallyChamberable = true;
				FireArmChamber.IsAccessible = false;
			}
			else if (num > 0.98f)
			{
				m_curPos = (StockPos)0;
				FireArmChamber.IsManuallyExtractable = false;
				FireArmChamber.IsManuallyChamberable = false;
				FireArmChamber.IsAccessible = true;
			}
			else
			{
				m_curPos = (StockPos)1;
				FireArmChamber.IsManuallyExtractable = false;
				FireArmChamber.IsManuallyChamberable = false;
				FireArmChamber.IsAccessible = false;
			}
			if ((int)m_curPos == 2 && (int)m_lastPos != 2)
			{
				FireArm.PlayAudioEvent((FirearmAudioEventType)30, 1f);
			}
			if ((int)m_curPos == 0 && (int)m_lastPos != 0)
			{
				FireArm.PlayAudioEvent((FirearmAudioEventType)31, 1f);
			}
			m_lastPos = m_curPos;
		}
	}
}
namespace JerryNPC
{
	public class SOSIGHMGUNNER : MonoBehaviour
	{
		[NonSerialized]
		public GameObject itemTar;

		public GameObject heightTweak;

		public float fireCD = 0f;

		public bool isContious = true;

		public NavMeshAgent NMA;

		[NonSerialized]
		public FVRFireArm curGun;

		[NonSerialized]
		public FVRFireArmMagazine curMag;

		[NonSerialized]
		public FVRFireArmMagazine newMag;

		public Transform handL;

		public Vector3 refHandL;

		public Transform handR;

		public Vector3 refHandR;

		public Collider detectCol;

		public Transform aimPos;

		public Transform reloadPos;

		public Transform idlePos;

		public Transform magPouch;

		public Transform backpackpos;

		[NonSerialized]
		public List<SosigLink> currentAI = new List<SosigLink>();

		[NonSerialized]
		public Transform nearestAI;

		public bool cocked = false;

		public bool pouched = false;

		public Transform aimRoot;

		public Vector3 refSlide;

		private void OnTriggerStay(Collider other)
		{
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: 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_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: 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_01d4: 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_0315: 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_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0428: Unknown result type (might be due to invalid IL or missing references)
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			if (!isContious)
			{
				return;
			}
			if (((Object)((Component)other).gameObject).name == "Sosig_Torso" && (Object)(object)((Component)other).gameObject.GetComponent<SosigLink>() != (Object)null && !currentAI.Contains(((Component)other).gameObject.GetComponent<SosigLink>()))
			{
				currentAI.Add(((Component)other).gameObject.GetComponent<SosigLink>());
			}
			if ((Object)(object)((Component)other).gameObject.GetComponent<FVRFireArm>() != (Object)null && (Object)(object)curGun == (Object)null && (Object)(object)((Component)other).gameObject.GetComponent<Handgun>() != (Object)null && (Object)(object)((FVRPhysicalObject)((Component)other).gameObject.GetComponent<FVRFireArm>()).m_quickbeltSlot == (Object)null && !((FVRInteractiveObject)((Component)other).gameObject.GetComponent<FVRFireArm>()).m_isHeld)
			{
				if (Vector3.Distance(((Component)NMA).gameObject.transform.position, ((Component)other).gameObject.transform.position) > 1f)
				{
					itemTar = ((Component)other).gameObject;
					NMA.SetDestination(((Component)other).gameObject.transform.position);
				}
				else if (Vector3.Distance(((Component)NMA).gameObject.transform.position, ((Component)other).gameObject.transform.position) <= 1f)
				{
					if (Vector3.Distance(((Component)handR).gameObject.transform.position, ((Component)other).gameObject.transform.position) > 0.15f)
					{
						((Component)handR).transform.position = Vector3.SmoothDamp(((Component)handR).transform.position, ((Component)other).gameObject.transform.position, ref refHandR, 0.25f);
					}
					else if (Vector3.Distance(((Component)handR).gameObject.transform.position, ((Component)other).gameObject.transform.position) <= 0.15f)
					{
						curGun = ((Component)other).gameObject.GetComponent<FVRFireArm>();
					}
				}
			}
			if (!((Object)(object)((Component)other).gameObject.GetComponent<FVRFireArmMagazine>() != (Object)null) || !((Object)(object)curGun != (Object)null) || !((Object)(object)curMag == (Object)null) || !curGun.UsesMagazines || ((Component)other).gameObject.GetComponent<FVRFireArmMagazine>().m_numRounds <= 0 || ((Component)other).gameObject.GetComponent<FVRFireArmMagazine>().MagazineType != curGun.MagazineType || !((Object)(object)((FVRPhysicalObject)((Component)other).gameObject.GetComponent<FVRFireArmMagazine>()).m_quickbeltSlot == (Object)null) || ((FVRInteractiveObject)((Component)other).gameObject.GetComponent<FVRFireArmMagazine>()).m_isHeld || !((Object)(object)curGun.Magazine == (Object)null))
			{
				return;
			}
			if (Vector3.Distance(((Component)NMA).gameObject.transform.position, ((Component)other).gameObject.transform.position) > 1f)
			{
				itemTar = ((Component)other).gameObject;
				NMA.SetDestination(((Component)other).gameObject.transform.position);
			}
			else
			{
				if (!(Vector3.Distance(((Component)NMA).gameObject.transform.position, ((Component)other).gameObject.transform.position) <= 1f))
				{
					return;
				}
				if (Vector3.Distance(((Component)handL).gameObject.transform.position, ((Component)other).gameObject.transform.position) > 0.15f)
				{
					((Component)handL).transform.position = Vector3.SmoothDamp(((Component)handL).transform.position, ((Component)other).gameObject.transform.position, ref refHandL, 0.25f);
				}
				else if (Vector3.Distance(((Component)handL).gameObject.transform.position, ((Component)other).gameObject.transform.position) <= 0.15f)
				{
					curMag = ((Component)other).gameObject.GetComponent<FVRFireArmMagazine>();
					if ((Object)(object)itemTar != (Object)null)
					{
						itemTar = null;
					}
				}
			}
		}

		private void AxisLookAt(Transform tr_self, Vector3 lookPos, Vector3 directionAxis)
		{
			//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_0008: 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)
			//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)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0023: 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_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_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_003f: 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_0046: 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)
			//IL_0061: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			Quaternion rotation = tr_self.rotation;
			Vector3 val = lookPos - tr_self.position;
			Vector3 val2 = tr_self.rotation * directionAxis;
			Vector3 val3 = Vector3.Cross(val2, val);
			Vector3 normalized = ((Vector3)(ref val3)).normalized;
			float num = Vector3.Angle(val2, val);
			tr_self.rotation = Quaternion.AngleAxis(num, normalized) * rotation;
			tr_self.localEulerAngles = new Vector3(tr_self.localEulerAngles.x, tr_self.localEulerAngles.y, 0f);
		}

		private void AxisLookAtY(Transform tr_self, Vector3 lookPos, Vector3 directionAxis)
		{
			//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_0008: 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)
			//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)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0023: 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_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_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_003f: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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)
			Quaternion rotation = tr_self.rotation;
			Vector3 val = lookPos - tr_self.position;
			Vector3 val2 = tr_self.rotation * directionAxis;
			Vector3 val3 = Vector3.Cross(val2, val);
			Vector3 normalized = ((Vector3)(ref val3)).normalized;
			float num = Vector3.Angle(val2, val);
			tr_self.rotation = Quaternion.AngleAxis(num, normalized) * rotation;
			tr_self.localEulerAngles = new Vector3(0f, tr_self.localEulerAngles.y, 0f);
		}

		private void Update()
		{
			//IL_0987: Unknown result type (might be due to invalid IL or missing references)
			//IL_098c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b14: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b19: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b36: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a10: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a15: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a29: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_09bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a91: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aaa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a58: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a71: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aed: Unknown result type (might be due to invalid IL or missing references)
			//IL_081e: Unknown result type (might be due to invalid IL or missing references)
			//IL_082e: 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_013b: 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_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0869: Unknown result type (might be due to invalid IL or missing references)
			//IL_0889: Unknown result type (might be due to invalid IL or missing references)
			//IL_0899: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0928: Unknown result type (might be due to invalid IL or missing references)
			//IL_094d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0747: Unknown result type (might be due to invalid IL or missing references)
			//IL_0757: Unknown result type (might be due to invalid IL or missing references)
			//IL_0767: Unknown result type (might be due to invalid IL or missing references)
			//IL_0624: Unknown result type (might be due to invalid IL or missing references)
			//IL_0639: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0559: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0664: Unknown result type (might be due to invalid IL or missing references)
			//IL_0679: Unknown result type (might be due to invalid IL or missing references)
			//IL_0689: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
			if (!isContious)
			{
				detectCol.enabled = false;
				pouched = false;
			}
			else
			{
				if (!isContious)
				{
					return;
				}
				detectCol.enabled = true;
				if ((Object)(object)curGun != (Object)null)
				{
					if (!((FVRInteractiveObject)curGun).m_isHeld && (Object)(object)((FVRPhysicalObject)curGun).m_quickbeltSlot == (Object)null)
					{
						((Component)curGun).gameObject.transform.position = ((Component)handR).transform.position;
						((Component)curGun).gameObject.transform.eulerAngles = ((Component)handR).transform.eulerAngles;
						if (Object.op_Implicit((Object)(object)((Component)curGun).gameObject.GetComponent<Handgun>()))
						{
							Handgun component = ((Component)curGun).gameObject.GetComponent<Handgun>();
							if ((Object)(object)nearestAI == (Object)null && (Object)(object)curGun.Magazine != (Object)null)
							{
								((Component)handR).transform.localPosition = Vector3.SmoothDamp(((Component)handR).transform.localPosition, ((Component)idlePos).transform.localPosition, ref refHandR, 0.2f);
								((Component)handR).transform.localEulerAngles = ((Component)idlePos).transform.localEulerAngles;
							}
							else if ((Object)(object)nearestAI != (Object)null && (Object)(object)curGun.Magazine != (Object)null)
							{
								NMA.SetDestination(((Component)nearestAI).gameObject.transform.position);
								AxisLookAtY(((Component)NMA).gameObject.transform, ((Component)nearestAI).transform.position, Vector3.forward);
								((Component)handR).transform.localPosition = Vector3.SmoothDamp(((Component)handR).transform.localPosition, ((Component)aimPos).transform.localPosition, ref refHandR, 0.1f);
								((Component)handR).transform.localEulerAngles = ((Component)aimPos).transform.localEulerAngles;
								AxisLookAt(((Component)aimRoot).transform, ((Component)nearestAI).gameObject.transform.position, Vector3.forward);
								if (fireCD > 0f)
								{
									fireCD -= Time.deltaTime;
								}
								if (component.Chamber.IsFull && !component.Chamber.IsSpent && fireCD <= 0f)
								{
									component.Fire();
									fireCD = Random.Range(0.1f, 0.5f);
								}
							}
							if (component.m_isSafetyEngaged)
							{
								component.ToggleSafety();
							}
							if (((FVRFireArm)component).UsesMagazines)
							{
								if ((Object)(object)((FVRFireArm)component).Magazine == (Object)null)
								{
									if ((Object)(object)curMag != (Object)null)
									{
										((Component)handR).transform.localPosition = Vector3.SmoothDamp(((Component)handR).transform.localPosition, ((Component)reloadPos).transform.localPosition, ref refHandR, 0.15f);
										((Component)handR).transform.localEulerAngles = ((Component)reloadPos).transform.localEulerAngles;
										if (pouched)
										{
											if ((Object)(object)newMag == (Object)null)
											{
												if (Vector3.Distance(((Component)handL).transform.position, ((Component)curMag).gameObject.transform.position) > 0.05f)
												{
													((Component)handL).transform.position = Vector3.SmoothDamp(((Component)handL).transform.position, ((Component)curMag).transform.position, ref refHandL, 0.1f);
												}
												else if (Vector3.Distance(((Component)handL).transform.position, ((Component)curMag).gameObject.transform.position) <= 0.1f)
												{
													GameObject val = Object.Instantiate<GameObject>(((Component)curMag).gameObject, ((Component)curMag).gameObject.transform.position, ((Component)curMag).gameObject.transform.rotation);
													newMag = val.GetComponent<FVRFireArmMagazine>();
												}
											}
											else if ((Object)(object)newMag != (Object)null)
											{
												((Component)handL).transform.position = Vector3.SmoothDamp(((Component)handL).transform.position, curGun.MagazineMountPos.position, ref refHandL, 0.1f);
												((Component)newMag).gameObject.transform.position = ((Component)handL).transform.position;
												((Component)newMag).gameObject.transform.eulerAngles = curGun.MagazineMountPos.eulerAngles;
												if (Vector3.Distance(((Component)newMag).gameObject.transform.position, curGun.MagazineMountPos.position) <= 0.025f)
												{
													curGun.LoadMag(newMag);
													curGun.Magazine = newMag;
													newMag.FireArm = curGun;
													newMag = null;
												}
											}
										}
									}
								}
								else if ((Object)(object)((FVRFireArm)component).Magazine != (Object)null)
								{
									if ((Object)(object)curMag == (Object)null)
									{
										((FVRFireArm)component).EjectMag(false);
									}
									if (!component.Chamber.IsFull)
									{
										if (((FVRFireArm)component).Magazine.m_numRounds <= 0)
										{
											((FVRFireArm)component).EjectMag(false);
										}
										if (Vector3.Distance(((Component)handL).transform.position, ((Component)component.Slide).gameObject.transform.position) > 0.05f)
										{
											((Component)handL).transform.position = Vector3.SmoothDamp(((Component)handL).transform.position, ((Component)component.Slide).gameObject.transform.position, ref refHandL, 0.2f);
										}
										else if (Vector3.Distance(((Component)handL).transform.position, ((Component)component.Slide).gameObject.transform.position) <= 0.05f)
										{
											((Component)handL).transform.position = ((Component)component.Slide).gameObject.transform.position;
											if (!cocked)
											{
												component.Slide.KnockToRear();
												cocked = true;
											}
										}
									}
									else if (component.Chamber.IsFull)
									{
										cocked = false;
										((Component)handL).transform.localPosition = Vector3.SmoothDamp(((Component)handL).transform.localPosition, ((Component)handR).transform.localPosition, ref refHandL, 0.15f);
									}
								}
							}
						}
					}
					if (((FVRInteractiveObject)curGun).m_isHeld || (Object)(object)((FVRPhysicalObject)curGun).m_quickbeltSlot != (Object)null)
					{
						curGun = null;
					}
				}
				if ((Object)(object)curMag != (Object)null)
				{
					if (((FVRInteractiveObject)curMag).m_isHeld || (Object)(object)((FVRPhysicalObject)curMag).m_quickbeltSlot != (Object)null)
					{
						curMag = null;
					}
					if (!((FVRInteractiveObject)curMag).m_isHeld && (Object)(object)((FVRPhysicalObject)curMag).m_quickbeltSlot == (Object)null)
					{
						if (Vector3.Distance(((Component)curMag).gameObject.transform.position, ((Component)magPouch).transform.position) > 0.1f && !pouched)
						{
							((Component)curMag).gameObject.transform.position = ((Component)handL).transform.position;
							((Component)handL).transform.localPosition = Vector3.SmoothDamp(((Component)handL).transform.localPosition, ((Component)magPouch).transform.localPosition, ref refHandL, 0.15f);
						}
						else if (Vector3.Distance(((Component)curMag).gameObject.transform.position, ((Component)magPouch).transform.position) <= 0.1f && !pouched)
						{
							pouched = true;
						}
						if (pouched)
						{
							((Component)curMag).gameObject.transform.position = ((Component)magPouch).transform.position;
							((Component)curMag).gameObject.transform.eulerAngles = ((Component)magPouch).transform.eulerAngles;
						}
					}
				}
				if ((Object)(object)itemTar == (Object)null)
				{
					NMA.stoppingDistance = 5f;
					if (heightTweak.transform.localPosition.y < 0f)
					{
						heightTweak.transform.localPosition = new Vector3(0f, heightTweak.transform.localPosition.y + Time.deltaTime, 0f);
					}
				}
				else if ((Object)(object)itemTar != (Object)null)
				{
					NMA.stoppingDistance = 0f;
					if (itemTar.transform.position.y > ((Component)handL).transform.position.y)
					{
						heightTweak.transform.localPosition = new Vector3(0f, heightTweak.transform.localPosition.y + Time.deltaTime, 0f);
					}
					else if (itemTar.transform.position.y < ((Component)handL).transform.position.y)
					{
						heightTweak.transform.localPosition = new Vector3(0f, heightTweak.transform.localPosition.y - Time.deltaTime, 0f);
					}
				}
				heightTweak.transform.localPosition = new Vector3(0f, Mathf.Clamp(heightTweak.transform.localPosition.y, -1f, 0f), 0f);
				if (currentAI == null)
				{
					return;
				}
				for (int i = 0; i < currentAI.Count; i++)
				{
					if ((Object)(object)currentAI[i] == (Object)null)
					{
						currentAI.Remove(currentAI[i]);
					}
				}
				nearestAI = GetNearestGameObject(((Component)this).gameObject.transform, currentAI);
			}
		}

		public Transform GetNearestGameObject(Transform player, List<SosigLink> objects)
		{
			//IL_0044: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			Transform val = null;
			if (objects == null || (Object)(object)val == (Object)null)
			{
			}
			if (objects.Count > 0 && (Object)(object)objects[0] != (Object)null)
			{
				val = ((Component)objects[0]).transform;
				float num = Vector3.Distance(player.position, ((Component)objects[0]).transform.position);
				for (int i = 1; i < objects.Count; i++)
				{
					float num2 = Vector3.Distance(player.position, ((Component)objects[i]).transform.position);
					if (num > num2)
					{
						num = num2;
						val = ((Component)objects[i]).transform;
					}
				}
			}
			return val;
		}
	}
}
namespace JerryTF
{
	[BepInPlugin("JerryTF", "JTF", "1.0.0")]
	[BepInProcess("h3vr.exe")]
	public class ThngFlingerPGin : BaseUnityPlugin
	{
		public List<ThingFlinger> Flingers = new List<ThingFlinger>();

		private KeywordRecognizer keyword;

		private Dictionary<string, Action> dic = new Dictionary<string, Action>();

		private void Keyword_OnPhraseRecognized(PhraseRecognizedEventArgs args)
		{
			Debug.Log((object)args.text);
			dic[args.text]();
		}

		private void Start()
		{
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e8: Expected O, but got Unknown
			//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ff: Expected O, but got Unknown
			dic.Add("Launch.", StartWDelay);
			dic.Add("Launch now.", StartNow);
			dic.Add("Stop.", Stop);
			dic.Add("Scan.", Scan);
			dic.Add("Clear.", Clear);
			dic.Add("Set angle to 0.", Elev0);
			dic.Add("Set angle to 15.", Elev15);
			dic.Add("Set angle to 30.", Elev30);
			dic.Add("Set angle to 45.", Elev45);
			dic.Add("Set angle to 60.", Elev60);
			dic.Add("Set angle to 75.", Elev75);
			dic.Add("Set angle to 90.", Elev90);
			dic.Add("Set speed to 1.", Vel1);
			dic.Add("Set speed to 3.", Vel3);
			dic.Add("Set speed to 6.", Vel6);
			dic.Add("Set speed to 10.", Vel10);
			dic.Add("Set speed to 15.", Vel15);
			dic.Add("Set speed to 25.", Vel25);
			dic.Add("Set speed to 50.", Vel50);
			dic.Add("Set spread to 0.", Spr0);
			dic.Add("Set spread to 0.1.", Spr01);
			dic.Add("Set spread to 0.5.", Spr05);
			dic.Add("Set spread to 1.", Spr1);
			dic.Add("Set spread to 5.", Spr5);
			dic.Add("Set