Decompiled source of Trepang2 Bolt Launcher v1.0.0

Trepang2_Bolt_Launcher.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using UnityEngine;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace nootarc
{
	public class BreakActionHCBBoltMod : FVRFireArm
	{
		[Serializable]
		public class BreakActionBarrel
		{
			public FVRFireArmChamber Chamber;

			public Transform Hammer;

			public Transform Muzzle;

			public bool HasVisibleHammer;

			public InterpStyle HammerInterpStyle = (InterpStyle)1;

			public Axis HammerAxis;

			public float HammerUncocked;

			public float HammerCocked;

			public int MuzzleIndexBarrelFire;

			public int MuzzleIndexBarrelSmoke;

			public int GasOutIndexBarrel;

			public int GasOutIndexBreach;

			[HideInInspector]
			public bool IsBreachOpenForGasOut;

			[HideInInspector]
			public bool m_isHammerCocked;
		}

		[Serializable]
		public class BreakActionLatch
		{
			public Transform Latch;

			public Axis LatchAxis;

			public InterpStyle LatchInterp;

			public Vector2 LatchRange;
		}

		[Header("Component Connections")]
		public BreakActionBarrel[] Barrels;

		public Transform[] Triggers;

		public InterpStyle TriggerInterpStyle = (InterpStyle)1;

		public Axis TriggerAxis;

		public float TriggerUnpulled;

		public float TriggerPulled;

		public bool FireAllBarrels;

		public bool OnlyOneShotSound;

		[Header("Hinge Params")]
		public HingeJoint Hinge;

		[NonSerialized]
		public Vector3 m_foreStartPos;

		public float HingeLimit = 45f;

		public float HingeEjectLimit = 30f;

		public Transform Ejector;

		public Vector2 EjectorRange;

		[NonSerialized]
		public bool m_hasEjector;

		[NonSerialized]
		public float m_ejectorLerp;

		[Header("Latch Params")]
		public bool m_hasLatch;

		public Transform Latch;

		public Axis LatchAxis = (Axis)1;

		public float MaxRotExtent;

		[NonSerialized]
		public float m_latchRot;

		[NonSerialized]
		public bool m_isLatched = true;

		[Header("ExtraLatchPieces")]
		public List<BreakActionLatch> ExtraLatches;

		[NonSerialized]
		public bool m_hasExtraEjectors;

		[NonSerialized]
		public float m_extraEjectorLerp;

		public float ExtraLatchMaxRot = 5f;

		public float EjectOffset = -0.06f;

		public float EjectSpeed = -2.5f;

		[Header("Control Params")]
		public bool UsesManuallyCockedHammers;

		[NonSerialized]
		public int m_curBarrel;

		[NonSerialized]
		public bool m_EjectsOnOpen = true;

		[NonSerialized]
		public bool m_hasLatchButton = true;

		[HideInInspector]
		public bool IsLatchHeldOpen;

		[HideInInspector]
		public bool HasTriggerReset = true;

		[NonSerialized]
		public float m_triggerFloat;

		[NonSerialized]
		public bool m_isExternallyUnlatched;

		[NonSerialized]
		public bool firedOneShot;

		[NonSerialized]
		[HideInInspector]
		public int ShotCounter;

		public int MaxShotCounter = 3;

		public FVRFireArmRound EvilRound;

		[HideInInspector]
		private float TrepangBoltCounter = 0f;

		public float TrepangBurstDelay = 0f;

		public bool IsLatched => m_isLatched;

		public void SetEjectOnOpen(bool b)
		{
			m_EjectsOnOpen = b;
		}

		public void SetHasLatchButton(bool b)
		{
			m_hasLatchButton = b;
		}

		public override void Awake()
		{
			//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)
			((FVRFireArm)this).Awake();
			BreakActionBarrel[] barrels = Barrels;
			foreach (BreakActionBarrel breakActionBarrel in barrels)
			{
				base.FChambers.Add(breakActionBarrel.Chamber);
			}
			m_foreStartPos = ((Component)Hinge).transform.localPosition;
			if ((Object)(object)Ejector != (Object)null)
			{
				m_hasEjector = true;
			}
			if (ExtraLatches != null && ExtraLatches.Count > 0)
			{
				m_hasExtraEjectors = true;
			}
		}

		public override Transform GetMuzzle()
		{
			return Barrels[m_curBarrel].Muzzle;
		}

		public void Unlatch()
		{
		}

		public void SetIsExternallyUnlatched(bool b)
		{
			m_isExternallyUnlatched = b;
		}

		public void PopOutEmpties()
		{
			for (int i = 0; i < Barrels.Length; i++)
			{
				if (Barrels[i].Chamber.IsFull && Barrels[i].Chamber.IsSpent)
				{
					PopOutRound(Barrels[i].Chamber);
				}
			}
		}

		public void PopOutRound(FVRFireArmChamber chamber)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_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)
			((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f);
			chamber.EjectRound(((Component)chamber).transform.position + ((Component)chamber).transform.forward * EjectOffset, ((Component)chamber).transform.forward * EjectSpeed, Vector3.right, false);
		}

		public void CockHammer()
		{
			for (int i = 0; i < Barrels.Length; i++)
			{
				if (!Barrels[i].m_isHammerCocked)
				{
					Barrels[i].m_isHammerCocked = true;
					((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
					break;
				}
			}
			UpdateVisualHammers();
		}

		public void CockAllHammers()
		{
			bool flag = false;
			for (int i = 0; i < Barrels.Length; i++)
			{
				if (!Barrels[i].m_isHammerCocked)
				{
					Barrels[i].m_isHammerCocked = true;
					flag = true;
				}
			}
			if (flag)
			{
				((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
				UpdateVisualHammers();
			}
		}

		public void DropHammer()
		{
			if (!m_isLatched)
			{
				return;
			}
			firedOneShot = false;
			for (int i = 0; i < Barrels.Length; i++)
			{
				if (Barrels[i].m_isHammerCocked)
				{
					((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
					Barrels[i].m_isHammerCocked = false;
					UpdateVisualHammers();
					Fire(i, FireAllBarrels, i);
					if (!FireAllBarrels)
					{
						break;
					}
				}
			}
		}

		public bool Fire(int b, bool FireAllBarrels, int index)
		{
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			m_curBarrel = b;
			if (!Barrels[b].Chamber.Fire())
			{
				return false;
			}
			((FVRFireArm)this).Fire(Barrels[b].Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f);
			((FVRFireArm)this).FireMuzzleSmoke(Barrels[b].MuzzleIndexBarrelFire);
			((FVRFireArm)this).FireMuzzleSmoke(Barrels[b].MuzzleIndexBarrelSmoke);
			((FVRFireArm)this).AddGas(Barrels[b].GasOutIndexBarrel);
			((FVRFireArm)this).AddGas(Barrels[b].GasOutIndexBreach);
			bool flag = ((FVRFireArm)this).IsTwoHandStabilized();
			bool flag2 = ((FVRFireArm)this).IsForegripStabilized();
			bool flag3 = ((FVRFireArm)this).IsShoulderStabilized();
			((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f);
			ShotCounter--;
			TrepangBoltCounter = 0f;
			if (!OnlyOneShotSound || !firedOneShot)
			{
				firedOneShot = true;
				((FVRFireArm)this).PlayAudioGunShot(Barrels[b].Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
			}
			if (ShotCounter > 0 || GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo)
			{
				Barrels[b].m_isHammerCocked = true;
				Barrels[b].Chamber.IsSpent = false;
				Barrels[b].Chamber.UpdateProxyDisplay();
			}
			return true;
		}

		public void UpdateVisualHammers()
		{
			//IL_0093: 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_0052: 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)
			for (int i = 0; i < Barrels.Length; i++)
			{
				if (Barrels[i].HasVisibleHammer)
				{
					if (Barrels[i].m_isHammerCocked)
					{
						((FVRPhysicalObject)this).SetAnimatedComponent(Barrels[i].Hammer, Barrels[i].HammerCocked, Barrels[i].HammerInterpStyle, Barrels[i].HammerAxis);
					}
					else
					{
						((FVRPhysicalObject)this).SetAnimatedComponent(Barrels[i].Hammer, Barrels[i].HammerUncocked, Barrels[i].HammerInterpStyle, Barrels[i].HammerAxis);
					}
				}
			}
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			((FVRPhysicalObject)this).UpdateInteraction(hand);
			UpdateInputAndAnimate(hand);
		}

		public override void EndInteraction(FVRViveHand hand)
		{
			((FVRFireArm)this).EndInteraction(hand);
			IsLatchHeldOpen = false;
		}

		public void UpdateInputAndAnimate(FVRViveHand hand)
		{
			//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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: 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_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_0530: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_050e: Unknown result type (might be due to invalid IL or missing references)
			if (m_hasEjector)
			{
				float num = 0f;
				if (!m_isLatched && ((Component)Hinge).transform.localEulerAngles.x > 15f)
				{
					num = Mathf.InverseLerp(15f, 25f, Mathf.Abs(((Component)Hinge).transform.localEulerAngles.x));
				}
				if (Mathf.Abs(num - m_ejectorLerp) > 1E-05f)
				{
					m_ejectorLerp = num;
					((FVRPhysicalObject)this).SetAnimatedComponent(Ejector, Mathf.Lerp(EjectorRange.x, EjectorRange.y, m_ejectorLerp), (InterpStyle)0, (Axis)2);
				}
			}
			if (m_hasExtraEjectors)
			{
				float num2 = 0f;
				if (!m_isLatched && ((Component)Hinge).transform.localEulerAngles.x > 0.1f)
				{
					num2 = Mathf.InverseLerp(0f, ExtraLatchMaxRot, Mathf.Abs(((Component)Hinge).transform.localEulerAngles.x));
				}
				if (Mathf.Abs(num2 - m_extraEjectorLerp) > 1E-05f)
				{
					m_extraEjectorLerp = num2;
					for (int i = 0; i < ExtraLatches.Count; i++)
					{
						((FVRPhysicalObject)this).SetAnimatedComponent(ExtraLatches[i].Latch, Mathf.Lerp(ExtraLatches[i].LatchRange.x, ExtraLatches[i].LatchRange.y, m_extraEjectorLerp), ExtraLatches[i].LatchInterp, ExtraLatches[i].LatchAxis);
					}
				}
			}
			IsLatchHeldOpen = false;
			if (((FVRPhysicalObject)this).IsAltHeld)
			{
				return;
			}
			if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin)
			{
				m_triggerFloat = hand.Input.TriggerFloat;
			}
			else
			{
				m_triggerFloat = 0f;
			}
			if (!HasTriggerReset && m_triggerFloat <= 0.45f)
			{
				HasTriggerReset = true;
				((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)16, 1f);
			}
			Vector2 touchpadAxes = hand.Input.TouchpadAxes;
			if (hand.IsInStreamlinedMode)
			{
				if (hand.Input.BYButtonPressed && m_hasLatchButton)
				{
					IsLatchHeldOpen = true;
					m_latchRot = 1f * MaxRotExtent;
				}
				else
				{
					m_latchRot = Mathf.MoveTowards(m_latchRot, 0f, Time.deltaTime * 100f);
				}
				if (hand.Input.AXButtonDown && UsesManuallyCockedHammers)
				{
					if (FireAllBarrels)
					{
						CockAllHammers();
					}
					else
					{
						CockHammer();
					}
				}
			}
			else
			{
				if (hand.Input.TouchpadPressed && touchpadAxes.y > 0.1f && m_hasLatchButton)
				{
					IsLatchHeldOpen = true;
					m_latchRot = touchpadAxes.y * MaxRotExtent;
				}
				else
				{
					m_latchRot = Mathf.MoveTowards(m_latchRot, 0f, Time.deltaTime * 100f);
				}
				if (hand.Input.TouchpadDown && UsesManuallyCockedHammers && touchpadAxes.y < 0.1f)
				{
					if (FireAllBarrels)
					{
						CockAllHammers();
					}
					else
					{
						CockHammer();
					}
				}
			}
			if (UsesManuallyCockedHammers && ((FVRInteractiveObject)this).IsHeld && (Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand != (Object)null)
			{
				Vector3 velLinearWorld = ((FVRInteractiveObject)this).m_hand.OtherHand.Input.VelLinearWorld;
				float num3 = Vector3.Distance(((FVRInteractiveObject)this).m_hand.OtherHand.PalmTransform.position, Barrels[0].Hammer.position);
				if (num3 < 0.15f && Vector3.Angle(velLinearWorld, -((Component)this).transform.forward) < 60f && ((Vector3)(ref velLinearWorld)).magnitude > 1f)
				{
					CockAllHammers();
				}
			}
			if (m_hasLatch)
			{
				((FVRPhysicalObject)this).SetAnimatedComponent(Latch, m_latchRot, (InterpStyle)1, LatchAxis);
			}
			for (int j = 0; j < Triggers.Length; j++)
			{
				int num4 = Mathf.Clamp(m_curBarrel, 0, Triggers.Length - 1);
				if (num4 == j)
				{
					((FVRPhysicalObject)this).SetAnimatedComponent(Triggers[j], Mathf.Lerp(TriggerUnpulled, TriggerPulled, m_triggerFloat), TriggerInterpStyle, TriggerAxis);
				}
				else
				{
					((FVRPhysicalObject)this).SetAnimatedComponent(Triggers[j], TriggerUnpulled, TriggerInterpStyle, TriggerAxis);
				}
			}
			if (m_triggerFloat >= 0.9f && HasTriggerReset && m_isLatched)
			{
				HasTriggerReset = false;
				DropHammer();
			}
		}

		public override void FVRFixedUpdate()
		{
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			((FVRFireArm)this).FVRFixedUpdate();
			for (int i = 0; i < Barrels.Length; i++)
			{
				base.GasOutEffects[Barrels[i].GasOutIndexBarrel].GasUpdate(true);
				if (Barrels[i].Chamber.IsFull || !Barrels[i].Chamber.IsAccessible)
				{
					base.GasOutEffects[Barrels[i].GasOutIndexBreach].GasUpdate(false);
				}
				else
				{
					base.GasOutEffects[Barrels[i].GasOutIndexBreach].GasUpdate(true);
				}
			}
			if (m_isLatched && (Mathf.Abs(m_latchRot) > 5f || m_isExternallyUnlatched))
			{
				m_isLatched = false;
				((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f);
				JointLimits limits = Hinge.limits;
				((JointLimits)(ref limits)).max = HingeLimit;
				Hinge.limits = limits;
				for (int j = 0; j < Barrels.Length; j++)
				{
					Barrels[j].Chamber.IsAccessible = true;
				}
			}
			for (int k = 0; k < Barrels.Length; k++)
			{
				TrepangBoltCounter += Time.deltaTime;
				if ((double)m_triggerFloat >= 0.9 && (Object)(object)Barrels[k].Chamber.GetRound() == (Object)(object)EvilRound && TrepangBoltCounter > TrepangBurstDelay)
				{
					HasTriggerReset = true;
				}
			}
			if (ShotCounter < MaxShotCounter && ShotCounter > 0)
			{
				m_isLatched = true;
			}
			if (!Barrels[0].Chamber.IsFull)
			{
				ShotCounter = MaxShotCounter;
			}
			if (m_isLatched)
			{
				return;
			}
			if (!IsLatchHeldOpen && ((Component)Hinge).transform.localEulerAngles.x <= 1f && Mathf.Abs(m_latchRot) < 5f && !m_isExternallyUnlatched)
			{
				m_isLatched = true;
				((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f);
				JointLimits limits2 = Hinge.limits;
				((JointLimits)(ref limits2)).max = 0f;
				Hinge.limits = limits2;
				for (int l = 0; l < Barrels.Length; l++)
				{
					Barrels[l].Chamber.IsAccessible = false;
				}
				((Component)Hinge).transform.localPosition = m_foreStartPos;
			}
			if (Mathf.Abs(((Component)Hinge).transform.localEulerAngles.x) >= HingeEjectLimit)
			{
				if (m_EjectsOnOpen)
				{
					PopOutEmpties();
				}
				if (!UsesManuallyCockedHammers)
				{
					CockAllHammers();
				}
			}
		}

		public override List<FireArmRoundClass> GetChamberRoundList()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			List<FireArmRoundClass> list = new List<FireArmRoundClass>();
			for (int i = 0; i < Barrels.Length; i++)
			{
				if (Barrels[i].Chamber.IsFull)
				{
					list.Add(Barrels[i].Chamber.GetRound().RoundClass);
					flag = true;
				}
			}
			if (flag)
			{
				return list;
			}
			return null;
		}

		public override void SetLoadedChambers(List<FireArmRoundClass> rounds)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (rounds.Count <= 0)
			{
				return;
			}
			for (int i = 0; i < Barrels.Length; i++)
			{
				if (i < rounds.Count)
				{
					Barrels[i].Chamber.Autochamber(rounds[i]);
				}
			}
		}

		public override void ConfigureFromFlagDic(Dictionary<string, string> f)
		{
			for (int i = 0; i < Barrels.Length; i++)
			{
				string key = "HammerState_" + i;
				if (f.ContainsKey(key))
				{
					string text = f[key];
					if (text == "Cocked")
					{
						Barrels[i].m_isHammerCocked = true;
						UpdateVisualHammers();
					}
				}
			}
			((FVRFireArm)this).ConfigureFromFlagDic(f);
		}

		public override Dictionary<string, string> GetFlagDic()
		{
			Dictionary<string, string> flagDic = ((FVRFireArm)this).GetFlagDic();
			for (int i = 0; i < Barrels.Length; i++)
			{
				string key = "HammerState_" + i;
				string value = "Uncocked";
				if (Barrels[i].m_isHammerCocked)
				{
					value = "Cocked";
				}
				flagDic.Add(key, value);
			}
			return flagDic;
		}
	}
	public class BreakActionManualEjectorMod : FVRInteractiveObject
	{
		public enum BoltHandlePos
		{
			Forward,
			Middle,
			Rear
		}

		[Header("ChargingHandle")]
		public BreakActionHCBBoltMod Weapon;

		public bool IsCartridgeEjector = true;

		public Transform Point_Fore;

		public Transform Point_Rear;

		public float ForwardSpeed = 1f;

		[NonSerialized]
		public float m_boltZ_forward;

		[NonSerialized]
		public float m_boltZ_rear;

		[NonSerialized]
		public float m_currentHandleZ;

		public BoltHandlePos CurPos;

		public BoltHandlePos LastPos;

		[Header("Rotating Bit")]
		public bool HasRotatingPart;

		public Transform RotatingPart;

		public Vector3 RotatingPartNeutralEulers;

		public Vector3 RotatingPartLeftEulers;

		public Vector3 RotatingPartRightEulers;

		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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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)
			((FVRInteractiveObject)this).Awake();
			m_boltZ_forward = Point_Fore.localPosition.z;
			m_boltZ_rear = Point_Rear.localPosition.z;
			m_currentHandleZ = ((Component)this).transform.localPosition.z;
			Weapon.SetHasLatchButton(b: false);
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_000f: 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_002a: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: 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)
			((FVRInteractiveObject)this).UpdateInteraction(hand);
			Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(Point_Fore.position, Point_Rear.position, ((HandInput)(ref base.m_hand.Input)).Pos);
			((Component)this).transform.position = closestValidPoint;
			m_currentHandleZ = ((Component)this).transform.localPosition.z;
			float num = Mathf.InverseLerp(m_boltZ_forward, m_boltZ_rear, m_currentHandleZ);
			if (HasRotatingPart)
			{
				Vector3 val = ((Component)this).transform.position - base.m_hand.PalmTransform.position;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				if (Vector3.Dot(normalized, ((Component)this).transform.right) > 0f)
				{
					RotatingPart.localEulerAngles = RotatingPartLeftEulers;
				}
				else
				{
					RotatingPart.localEulerAngles = RotatingPartRightEulers;
				}
			}
		}

		public override void EndInteraction(FVRViveHand hand)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (HasRotatingPart)
			{
				RotatingPart.localEulerAngles = RotatingPartNeutralEulers;
			}
			((FVRInteractiveObject)this).EndInteraction(hand);
		}

		public override void FVRUpdate()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).FVRUpdate();
			if (Weapon.IsLatched && !((FVRInteractiveObject)this).IsHeld && Mathf.Abs(m_currentHandleZ - m_boltZ_forward) > 0.001f)
			{
				m_currentHandleZ = Mathf.MoveTowards(m_currentHandleZ, m_boltZ_forward, Time.deltaTime * ForwardSpeed);
				((Component)this).transform.localPosition = new Vector3(((Component)this).transform.localPosition.x, ((Component)this).transform.localPosition.y, m_currentHandleZ);
			}
			if (Mathf.Abs(m_currentHandleZ - m_boltZ_forward) < 0.005f)
			{
				CurPos = BoltHandlePos.Forward;
			}
			else if (Mathf.Abs(m_currentHandleZ - m_boltZ_rear) < 0.005f)
			{
				CurPos = BoltHandlePos.Rear;
			}
			else
			{
				CurPos = BoltHandlePos.Middle;
			}
			if (CurPos == BoltHandlePos.Forward && LastPos != 0)
			{
				if (IsCartridgeEjector && (Object)(object)Weapon != (Object)null)
				{
					((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)11, 1f);
				}
				if (!IsCartridgeEjector && (Object)(object)Weapon != (Object)null)
				{
					((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)31, 1f);
				}
			}
			else if (CurPos == BoltHandlePos.Rear && LastPos != BoltHandlePos.Rear)
			{
				if (IsCartridgeEjector && (Object)(object)Weapon != (Object)null)
				{
					((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)10, 1f);
				}
				if (!IsCartridgeEjector && (Object)(object)Weapon != (Object)null)
				{
					((FVRFireArm)Weapon).PlayAudioEvent((FirearmAudioEventType)30, 1f);
				}
				if (IsCartridgeEjector && !Weapon.IsLatched)
				{
					Weapon.PopOutRound(Weapon.Barrels[0].Chamber);
				}
			}
			if (!IsCartridgeEjector)
			{
				if ((CurPos == BoltHandlePos.Forward) | !((FVRInteractiveObject)this).IsHeld)
				{
					Weapon.SetIsExternallyUnlatched(b: false);
				}
				else if (CurPos == BoltHandlePos.Rear && (Weapon.ShotCounter <= 0 || Weapon.ShotCounter >= Weapon.MaxShotCounter))
				{
					Weapon.SetIsExternallyUnlatched(b: true);
				}
			}
			LastPos = CurPos;
		}
	}
	public class FVRShotgunForegripMod : FVRAlternateGrip
	{
		public Transform ShotgunBase;

		public HingeJoint Hinge;

		[NonSerialized]
		public Vector3 localPosStart;

		[NonSerialized]
		public Rigidbody RB;

		[NonSerialized]
		public BreakActionHCBBoltMod Wep;

		[NonSerialized]
		public float m_initialDamp = 0.05f;

		[NonSerialized]
		public float m_initialSpring = 0.05f;

		public override void Awake()
		{
			//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_0054: 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)
			((FVRAlternateGrip)this).Awake();
			localPosStart = ((Component)Hinge).transform.localPosition;
			RB = ((Component)Hinge).gameObject.GetComponent<Rigidbody>();
			Wep = ((Component)((Joint)Hinge).connectedBody).gameObject.GetComponent<BreakActionHCBBoltMod>();
			JointSpring spring = Hinge.spring;
			m_initialSpring = spring.spring;
			m_initialDamp = spring.damper;
		}

		public override void FVRUpdate()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).FVRUpdate();
			if (Vector3.Distance(((Component)Hinge).transform.localPosition, localPosStart) > 0.01f)
			{
				((Component)Hinge).transform.localPosition = localPosStart;
			}
		}

		public override void FVRFixedUpdate()
		{
			((FVRInteractiveObject)this).FVRFixedUpdate();
			if (((FVRInteractiveObject)Wep).IsHeld && ((FVRPhysicalObject)Wep).IsAltHeld)
			{
				RB.mass = 0.001f;
			}
			else
			{
				RB.mass = 0.1f;
			}
		}

		public override bool IsInteractable()
		{
			return true;
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_000e: 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_0028: 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_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_003a: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: 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_008b: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			((FVRAlternateGrip)this).UpdateInteraction(hand);
			Vector3 val = ((HandInput)(ref hand.Input)).Pos - ((Component)Hinge).transform.position;
			Vector3 val2 = Vector3.ProjectOnPlane(val, ShotgunBase.right);
			if (Vector3.Angle(val2, -ShotgunBase.up) > 90f)
			{
				val2 = ShotgunBase.forward;
			}
			if (Vector3.Angle(val2, ShotgunBase.forward) > 90f)
			{
				val2 = -ShotgunBase.up;
			}
			float num = Vector3.Angle(val2, ShotgunBase.forward);
			JointSpring spring = Hinge.spring;
			spring.spring = 10f;
			spring.damper = 0f;
			JointLimits limits = Hinge.limits;
			spring.targetPosition = Mathf.Clamp(num, 0f, ((JointLimits)(ref limits)).max);
			Hinge.spring = spring;
			((Component)Hinge).transform.localPosition = localPosStart;
		}

		public override void EndInteraction(FVRViveHand hand)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			JointSpring spring = Hinge.spring;
			spring.spring = m_initialSpring;
			spring.damper = m_initialDamp;
			spring.targetPosition = 45f;
			Hinge.spring = spring;
			((FVRAlternateGrip)this).EndInteraction(hand);
		}
	}
}
[RequireComponent(typeof(ParticleSystem))]
public class CFX_AutoStopLoopedEffect : MonoBehaviour
{
	public float effectDuration = 2.5f;

	private float d;

	private void OnEnable()
	{
		d = effectDuration;
	}

	private void Update()
	{
		if (!(d > 0f))
		{
			return;
		}
		d -= Time.deltaTime;
		if (d <= 0f)
		{
			((Component)this).GetComponent<ParticleSystem>().Stop(true);
			CFX_Demo_Translate component = ((Component)this).gameObject.GetComponent<CFX_Demo_Translate>();
			if ((Object)(object)component != (Object)null)
			{
				((Behaviour)component).enabled = false;
			}
		}
	}
}
public class CFX_Demo_RandomDir : MonoBehaviour
{
	public Vector3 min = new Vector3(0f, 0f, 0f);

	public Vector3 max = new Vector3(0f, 360f, 0f);

	private void Awake()
	{
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.eulerAngles = new Vector3(Random.Range(min.x, max.x), Random.Range(min.y, max.y), Random.Range(min.z, max.z));
	}
}
public class CFX_Demo_RotateCamera : MonoBehaviour
{
	public static bool rotating = true;

	public float speed = 30f;

	public Transform rotationCenter;

	private void Update()
	{
		//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)
		if (rotating)
		{
			((Component)this).transform.RotateAround(rotationCenter.position, Vector3.up, speed * Time.deltaTime);
		}
	}
}
public class CFX_Demo_Translate : MonoBehaviour
{
	public float speed = 30f;

	public Vector3 rotation = Vector3.forward;

	public Vector3 axis = Vector3.forward;

	public bool gravity;

	private Vector3 dir;

	private void Start()
	{
		//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_0051: Unknown result type (might be due to invalid IL or missing references)
		dir = new Vector3(Random.Range(0f, 360f), Random.Range(0f, 360f), Random.Range(0f, 360f));
		((Vector3)(ref dir)).Scale(rotation);
		((Component)this).transform.localEulerAngles = dir;
	}

	private void Update()
	{
		//IL_0008: 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_001d: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.Translate(axis * speed * Time.deltaTime, (Space)1);
	}
}
public class WFX_Demo : MonoBehaviour
{
	public float cameraSpeed = 10f;

	public bool orderedSpawns = true;

	public float step = 1f;

	public float range = 5f;

	private float order = -5f;

	public GameObject walls;

	public GameObject bulletholes;

	public GameObject[] ParticleExamples;

	private int exampleIndex;

	private string randomSpawnsDelay = "0.5";

	private bool randomSpawns;

	private bool slowMo;

	private bool rotateCam = true;

	public Material wood;

	public Material concrete;

	public Material metal;

	public Material checker;

	public Material woodWall;

	public Material concreteWall;

	public Material metalWall;

	public Material checkerWall;

	private string groundTextureStr = "Checker";

	private List<string> groundTextures = new List<string>(new string[4] { "Concrete", "Wood", "Metal", "Checker" });

	public GameObject m4;

	public GameObject m4fps;

	private bool rotate_m4 = true;

	private void OnMouseDown()
	{
		//IL_0003: 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_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		RaycastHit val = default(RaycastHit);
		if (((Component)this).GetComponent<Collider>().Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), ref val, 9999f))
		{
			GameObject val2 = spawnParticle();
			if (!((Object)val2).name.StartsWith("WFX_MF"))
			{
				val2.transform.position = ((RaycastHit)(ref val)).point + val2.transform.position;
			}
		}
	}

	public GameObject spawnParticle()
	{
		//IL_0064: 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)
		GameObject val = Object.Instantiate<GameObject>(ParticleExamples[exampleIndex]);
		if (((Object)val).name.StartsWith("WFX_MF"))
		{
			val.transform.parent = ParticleExamples[exampleIndex].transform.parent;
			val.transform.localPosition = ParticleExamples[exampleIndex].transform.localPosition;
			val.transform.localRotation = ParticleExamples[exampleIndex].transform.localRotation;
		}
		else if (((Object)val).name.Contains("Hole"))
		{
			val.transform.parent = bulletholes.transform;
		}
		SetActiveCrossVersions(val, active: true);
		return val;
	}

	private void SetActiveCrossVersions(GameObject obj, bool active)
	{
		obj.SetActive(active);
		for (int i = 0; i < obj.transform.childCount; i++)
		{
			((Component)obj.transform.GetChild(i)).gameObject.SetActive(active);
		}
	}

	private void OnGUI()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: 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_02f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0321: Unknown result type (might be due to invalid IL or missing references)
		//IL_0326: Unknown result type (might be due to invalid IL or missing references)
		//IL_033a: Unknown result type (might be due to invalid IL or missing references)
		//IL_033f: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginArea(new Rect(5f, 20f, (float)(Screen.width - 10), 60f));
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.Label("Effect: " + ((Object)ParticleExamples[exampleIndex]).name, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) });
		if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }))
		{
			prevParticle();
		}
		if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }))
		{
			nextParticle();
		}
		GUILayout.FlexibleSpace();
		GUILayout.Label("Click on the ground to spawn the selected effect", (GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.FlexibleSpace();
		if (GUILayout.Button((!rotateCam) ? "Rotate Camera" : "Pause Camera", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) }))
		{
			rotateCam = !rotateCam;
		}
		if (GUILayout.Button((!((Component)this).GetComponent<Renderer>().enabled) ? "Show Ground" : "Hide Ground", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }))
		{
			((Component)this).GetComponent<Renderer>().enabled = !((Component)this).GetComponent<Renderer>().enabled;
		}
		if (GUILayout.Button((!slowMo) ? "Slow Motion" : "Normal Speed", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }))
		{
			slowMo = !slowMo;
			if (slowMo)
			{
				Time.timeScale = 0.33f;
			}
			else
			{
				Time.timeScale = 1f;
			}
		}
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.Label("Ground texture: " + groundTextureStr, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
		if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }))
		{
			prevTexture();
		}
		if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }))
		{
			nextTexture();
		}
		GUILayout.EndHorizontal();
		GUILayout.EndArea();
		if (!m4.GetComponent<Renderer>().enabled)
		{
			return;
		}
		GUILayout.BeginArea(new Rect(5f, (float)(Screen.height - 100), (float)(Screen.width - 10), 90f));
		rotate_m4 = GUILayout.Toggle(rotate_m4, "AutoRotate Weapon", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) });
		GUI.enabled = !rotate_m4;
		float x = m4.transform.localEulerAngles.x;
		x = ((!(x > 90f)) ? x : (x - 180f));
		float y = m4.transform.localEulerAngles.y;
		float z = m4.transform.localEulerAngles.z;
		x = GUILayout.HorizontalSlider(x, 0f, 179f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(256f) });
		y = GUILayout.HorizontalSlider(y, 0f, 359f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(256f) });
		z = GUILayout.HorizontalSlider(z, 0f, 359f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(256f) });
		if (GUI.changed)
		{
			if (x > 90f)
			{
				x += 180f;
			}
			m4.transform.localEulerAngles = new Vector3(x, y, z);
			Debug.Log((object)x);
		}
		GUILayout.EndArea();
	}

	private IEnumerator RandomSpawnsCoroutine()
	{
		while (true)
		{
			GameObject particles = spawnParticle();
			if (orderedSpawns)
			{
				particles.transform.position = ((Component)this).transform.position + new Vector3(order, particles.transform.position.y, 0f);
				order -= step;
				if (order < 0f - range)
				{
					order = range;
				}
			}
			else
			{
				particles.transform.position = ((Component)this).transform.position + new Vector3(Random.Range(0f - range, range), 0f, Random.Range(0f - range, range)) + new Vector3(0f, particles.transform.position.y, 0f);
			}
			yield return (object)new WaitForSeconds(float.Parse(randomSpawnsDelay));
		}
	}

	private void Update()
	{
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: 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 (Input.GetKeyDown((KeyCode)276))
		{
			prevParticle();
		}
		else if (Input.GetKeyDown((KeyCode)275))
		{
			nextParticle();
		}
		if (rotateCam)
		{
			((Component)Camera.main).transform.RotateAround(Vector3.zero, Vector3.up, cameraSpeed * Time.deltaTime);
		}
		if (rotate_m4)
		{
			m4.transform.Rotate(new Vector3(0f, 40f, 0f) * Time.deltaTime, (Space)0);
		}
	}

	private void prevTexture()
	{
		int num = groundTextures.IndexOf(groundTextureStr);
		num--;
		if (num < 0)
		{
			num = groundTextures.Count - 1;
		}
		groundTextureStr = groundTextures[num];
		selectMaterial();
	}

	private void nextTexture()
	{
		int num = groundTextures.IndexOf(groundTextureStr);
		num++;
		if (num >= groundTextures.Count)
		{
			num = 0;
		}
		groundTextureStr = groundTextures[num];
		selectMaterial();
	}

	private void selectMaterial()
	{
		switch (groundTextureStr)
		{
		case "Concrete":
			((Component)this).GetComponent<Renderer>().material = concrete;
			((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = concreteWall;
			((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = concreteWall;
			break;
		case "Wood":
			((Component)this).GetComponent<Renderer>().material = wood;
			((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = woodWall;
			((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = woodWall;
			break;
		case "Metal":
			((Component)this).GetComponent<Renderer>().material = metal;
			((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = metalWall;
			((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = metalWall;
			break;
		case "Checker":
			((Component)this).GetComponent<Renderer>().material = checker;
			((Component)walls.transform.GetChild(0)).GetComponent<Renderer>().material = checkerWall;
			((Component)walls.transform.GetChild(1)).GetComponent<Renderer>().material = checkerWall;
			break;
		}
	}

	private void prevParticle()
	{
		exampleIndex--;
		if (exampleIndex < 0)
		{
			exampleIndex = ParticleExamples.Length - 1;
		}
		showHideStuff();
	}

	private void nextParticle()
	{
		exampleIndex++;
		if (exampleIndex >= ParticleExamples.Length)
		{
			exampleIndex = 0;
		}
		showHideStuff();
	}

	private void showHideStuff()
	{
		if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_MF Spr"))
		{
			m4.GetComponent<Renderer>().enabled = true;
		}
		else
		{
			m4.GetComponent<Renderer>().enabled = false;
		}
		if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_MF FPS"))
		{
			m4fps.GetComponent<Renderer>().enabled = true;
		}
		else
		{
			m4fps.GetComponent<Renderer>().enabled = false;
		}
		if (((Object)ParticleExamples[exampleIndex]).name.StartsWith("WFX_BImpact"))
		{
			SetActiveCrossVersions(walls, active: true);
			Renderer[] componentsInChildren = bulletholes.GetComponentsInChildren<Renderer>();
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				val.enabled = true;
			}
		}
		else
		{
			SetActiveCrossVersions(walls, active: false);
			Renderer[] componentsInChildren2 = bulletholes.GetComponentsInChildren<Renderer>();
			Renderer[] array2 = componentsInChildren2;
			foreach (Renderer val2 in array2)
			{
				val2.enabled = false;
			}
		}
		if (((Object)ParticleExamples[exampleIndex]).name.Contains("Wood"))
		{
			groundTextureStr = "Wood";
			selectMaterial();
		}
		else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Concrete"))
		{
			groundTextureStr = "Concrete";
			selectMaterial();
		}
		else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Metal"))
		{
			groundTextureStr = "Metal";
			selectMaterial();
		}
		else if (((Object)ParticleExamples[exampleIndex]).name.Contains("Dirt") || ((Object)ParticleExamples[exampleIndex]).name.Contains("Sand") || ((Object)ParticleExamples[exampleIndex]).name.Contains("SoftBody"))
		{
			groundTextureStr = "Checker";
			selectMaterial();
		}
		else if (((Object)ParticleExamples[exampleIndex]).name == "WFX_Explosion")
		{
			groundTextureStr = "Checker";
			selectMaterial();
		}
	}
}
public class WFX_Demo_DeleteAfterDelay : MonoBehaviour
{
	public float delay = 1f;

	private void Update()
	{
		delay -= Time.deltaTime;
		if (delay < 0f)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
public class WFX_Demo_RandomDir : MonoBehaviour
{
	public Vector3 min = new Vector3(0f, 0f, 0f);

	public Vector3 max = new Vector3(0f, 360f, 0f);

	private void Awake()
	{
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.eulerAngles = new Vector3(Random.Range(min.x, max.x), Random.Range(min.y, max.y), Random.Range(min.z, max.z));
	}
}
[RequireComponent(typeof(ParticleSystem))]
public class CFX_AutoDestructShuriken : MonoBehaviour
{
	public bool OnlyDeactivate;

	private void OnEnable()
	{
		((MonoBehaviour)this).StartCoroutine("CheckIfAlive");
	}

	private IEnumerator CheckIfAlive()
	{
		do
		{
			yield return (object)new WaitForSeconds(0.5f);
		}
		while (((Component)this).GetComponent<ParticleSystem>().IsAlive(true));
		if (OnlyDeactivate)
		{
			((Component)this).gameObject.SetActive(false);
		}
		else
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
[RequireComponent(typeof(Light))]
public class CFX_LightIntensityFade : MonoBehaviour
{
	public float duration = 1f;

	public float delay = 0f;

	public float finalIntensity = 0f;

	private float baseIntensity;

	public bool autodestruct;

	private float p_lifetime = 0f;

	private float p_delay;

	private void Start()
	{
		baseIntensity = ((Component)this).GetComponent<Light>().intensity;
	}

	private void OnEnable()
	{
		p_lifetime = 0f;
		p_delay = delay;
		if (delay > 0f)
		{
			((Behaviour)((Component)this).GetComponent<Light>()).enabled = false;
		}
	}

	private void Update()
	{
		if (p_delay > 0f)
		{
			p_delay -= Time.deltaTime;
			if (p_delay <= 0f)
			{
				((Behaviour)((Component)this).GetComponent<Light>()).enabled = true;
			}
		}
		else if (p_lifetime / duration < 1f)
		{
			((Component)this).GetComponent<Light>().intensity = Mathf.Lerp(baseIntensity, finalIntensity, p_lifetime / duration);
			p_lifetime += Time.deltaTime;
		}
		else if (autodestruct)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
[RequireComponent(typeof(MeshFilter))]
public class WFX_BulletHoleDecal : MonoBehaviour
{
	private static Vector2[] quadUVs = (Vector2[])(object)new Vector2[4]
	{
		new Vector2(0f, 0f),
		new Vector2(0f, 1f),
		new Vector2(1f, 0f),
		new Vector2(1f, 1f)
	};

	public float lifetime = 10f;

	public float fadeoutpercent = 80f;

	public Vector2 frames;

	public bool randomRotation = false;

	public bool deactivate = false;

	private float life;

	private float fadeout;

	private Color color;

	private float orgAlpha;

	private void Awake()
	{
		//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)
		color = ((Component)this).GetComponent<Renderer>().material.GetColor("_TintColor");
		orgAlpha = color.a;
	}

	private void OnEnable()
	{
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		int num = Random.Range(0, (int)(frames.x * frames.y));
		int num2 = (int)((float)num % frames.x);
		int num3 = (int)((float)num / frames.y);
		Vector2[] array = (Vector2[])(object)new Vector2[4];
		for (int i = 0; i < 4; i++)
		{
			array[i].x = (quadUVs[i].x + (float)num2) * (1f / frames.x);
			array[i].y = (quadUVs[i].y + (float)num3) * (1f / frames.y);
		}
		((Component)this).GetComponent<MeshFilter>().mesh.uv = array;
		if (randomRotation)
		{
			((Component)this).transform.Rotate(0f, 0f, Random.Range(0f, 360f), (Space)1);
		}
		life = lifetime;
		fadeout = life * (fadeoutpercent / 100f);
		color.a = orgAlpha;
		((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color);
		((MonoBehaviour)this).StopAllCoroutines();
		((MonoBehaviour)this).StartCoroutine("holeUpdate");
	}

	private IEnumerator holeUpdate()
	{
		while (life > 0f)
		{
			life -= Time.deltaTime;
			if (life <= fadeout)
			{
				color.a = Mathf.Lerp(0f, orgAlpha, life / fadeout);
				((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color);
			}
			yield return null;
		}
	}
}
[RequireComponent(typeof(Light))]
public class WFX_LightFlicker : MonoBehaviour
{
	public float time = 0.05f;

	private float timer;

	private void Start()
	{
		timer = time;
		((MonoBehaviour)this).StartCoroutine("Flicker");
	}

	private IEnumerator Flicker()
	{
		while (true)
		{
			((Behaviour)((Component)this).GetComponent<Light>()).enabled = !((Behaviour)((Component)this).GetComponent<Light>()).enabled;
			do
			{
				timer -= Time.deltaTime;
				yield return null;
			}
			while (timer > 0f);
			timer = time;
		}
	}
}
namespace nootarc.Trepang2_Bolt_Launcher
{
	[BepInPlugin("nootarc.Trepang2_Bolt_Launcher", "Trepang2_Bolt_Launcher", "1.0.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class Trepang2_Bolt_LauncherPlugin : BaseUnityPlugin
	{
		private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		internal static ManualLogSource Logger;

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

		private void LoadAssets()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "nootarc.Trepang2_Bolt_Launcher");
			OtherLoader.RegisterDirectLoad(BasePath, "nootarc.Trepang2_Bolt_Launcher", "", "", "trepangboltlauncher", "");
		}
	}
}