Decompiled source of Universal Shotgun Speedloader v1.1.1

Universal_Shotgun_Speedloader.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.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using H3VRUtils;
using HarmonyLib;
using OpenScripts2;
using OtherLoader;
using Steamworks;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Serialization;
using UnityEngine.UI;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[ExecuteInEditMode]
public class HolographicSightCustom : MonoBehaviour
{
	public Transform VirtualQuad;

	public float Scale = 1f;

	public bool SizeCompensation = true;

	private MaterialPropertyBlock m_block;

	private void OnEnable()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		m_block = new MaterialPropertyBlock();
		((Component)this).GetComponent<Renderer>().SetPropertyBlock(m_block);
	}

	private void OnWillRenderObject()
	{
		//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)
		//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)
		Vector3 val = ((Component)this).transform.InverseTransformPoint(((Component)VirtualQuad).transform.position);
		m_block.SetVector("_Offset", Vector4.op_Implicit(val));
		m_block.SetFloat("_Scale", Scale);
		m_block.SetFloat("_SizeCompensation", (!SizeCompensation) ? 0f : 1f);
		((Component)this).GetComponent<Renderer>().SetPropertyBlock(m_block);
	}
}
public class AudioPlayer : StateMachineBehaviour
{
	public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
	{
		AudioSource component = ((Component)animator).GetComponent<AudioSource>();
		component.Play();
	}
}
namespace Niko666
{
	public class ChargeRifleBatteryLid : MonoBehaviour
	{
		[Header("References")]
		public FVRFireArm Weapon;

		[Tooltip("Pivot of the battery cover. Rotates from its authored pose to OpenLocalEuler.")]
		public Transform LidPivot;

		[Tooltip("The little release lever under the receiver. A hand squeezing here opens the bay.")]
		public Transform ReleaseLever;

		[Tooltip("Point a hand has to sweep through to slap the cover shut. Defaults to the lid pivot.")]
		public Transform SlapPoint;

		[Header("Motion")]
		[Tooltip("Cover rotation while open, in degrees around the pivot's local axes.")]
		public Vector3 OpenLocalEuler = new Vector3(0f, 0f, -115f);

		public float OpenTime = 0.2f;

		public float CloseTime = 0.09f;

		[Tooltip("Seconds after the lid starts opening before the cell is released.")]
		public float EjectDelay = 0.1f;

		[Tooltip("Push given to the ejected cell, in world space, so it pops clear of the bay.")]
		public Vector3 EjectVelocity = new Vector3(0f, 0.7f, 0.1f);

		public float EjectSpin = 90f;

		[Header("Interaction")]
		[Tooltip("How close a hand must be to the release lever to open the bay.")]
		public float ReleaseProximity = 0.09f;

		[Tooltip("How close a hand must come to the cover to slap it shut.")]
		public float SlapProximity = 0.14f;

		[Tooltip("Minimum hand speed toward the cover for a slap, in m/s.")]
		public float SlapMinSpeed = 1.1f;

		[Tooltip("A freshly opened bay ignores slaps for this long, so the opening motion cannot close it again.")]
		public float SlapCooldown = 0.35f;

		[Header("Audio")]
		public AudioClip OpenClip;

		public AudioClip EjectClip;

		public AudioClip CloseClip;

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

		[Header("State (read-only)")]
		public bool IsOpen;

		private float _lidT;

		private float _openTime = -1f;

		private bool _ejected;

		private float _lastCloseTime = -10f;

		private Vector3 _closedEuler;

		private bool _captured;

		public bool IsOpening => _lidT > 0f && _lidT < 1f && IsOpen;

		private void Awake()
		{
			if ((Object)(object)Weapon == (Object)null)
			{
				Weapon = ((Component)this).GetComponent<FVRFireArm>();
			}
			if ((Object)(object)SlapPoint == (Object)null)
			{
				SlapPoint = LidPivot;
			}
			Capture();
		}

		private void Update()
		{
			float deltaTime = Time.deltaTime;
			if (!IsOpen)
			{
				if (CanOpenNow())
				{
					Open();
				}
			}
			else
			{
				_lidT = Mathf.MoveTowards(_lidT, 1f, (!(OpenTime <= 0f)) ? (deltaTime / OpenTime) : 999f);
				if (!_ejected && _openTime >= 0f && Time.time - _openTime >= EjectDelay)
				{
					_ejected = true;
					EjectCell();
				}
				if (Time.time - _openTime > SlapCooldown && HandSlapped())
				{
					Close();
				}
			}
			if (!IsOpen && _lidT > 0f)
			{
				_lidT = Mathf.MoveTowards(_lidT, 0f, (!(CloseTime <= 0f)) ? (deltaTime / CloseTime) : 999f);
			}
			ApplyLidPose();
		}

		private void ApplyLidPose()
		{
			//IL_003f: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)LidPivot == (Object)null) && _captured)
			{
				float num = Mathf.SmoothStep(0f, 1f, _lidT);
				LidPivot.localEulerAngles = Vector3.Lerp(_closedEuler, OpenLocalEuler, num);
			}
		}

		private void Capture()
		{
			//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)
			if (!_captured && !((Object)(object)LidPivot == (Object)null))
			{
				_closedEuler = LidPivot.localEulerAngles;
				_captured = true;
			}
		}

		public void Open()
		{
			//IL_005e: 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)
			Capture();
			if (!IsOpen)
			{
				IsOpen = true;
				_openTime = Time.time;
				_ejected = false;
				PlayAt(OpenClip, (!((Object)(object)LidPivot != (Object)null)) ? ((Component)this).transform.position : LidPivot.position);
			}
		}

		public void Close()
		{
			//IL_0051: 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)
			if (IsOpen)
			{
				IsOpen = false;
				_lastCloseTime = Time.time;
				PlayAt(CloseClip, (!((Object)(object)SlapPoint != (Object)null)) ? ((Component)this).transform.position : SlapPoint.position);
				BuzzHands(0.5f);
			}
		}

		public void ForceClose()
		{
			IsOpen = false;
		}

		private bool CanOpenNow()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Weapon == (Object)null)
			{
				return false;
			}
			if ((Object)(object)((FVRInteractiveObject)Weapon).m_hand == (Object)null)
			{
				return false;
			}
			if ((Object)(object)ReleaseLever == (Object)null)
			{
				return false;
			}
			FVRViveHand[] hands = GM.CurrentMovementManager.Hands;
			foreach (FVRViveHand val in hands)
			{
				if (!((Object)(object)val == (Object)null) && !(Vector3.Distance(((Component)val).transform.position, ReleaseLever.position) > ReleaseProximity) && (val.Input.GripPressed || val.Input.TriggerPressed || val.Input.BYButtonPressed))
				{
					return true;
				}
			}
			return false;
		}

		private bool HandSlapped()
		{
			//IL_0047: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_0092: 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_00a5: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)SlapPoint == (Object)null)
			{
				return false;
			}
			FVRViveHand[] hands = GM.CurrentMovementManager.Hands;
			foreach (FVRViveHand val in hands)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Vector3 val2 = SlapPoint.position - ((Component)val).transform.position;
				float magnitude = ((Vector3)(ref val2)).magnitude;
				if (!(magnitude > SlapProximity))
				{
					Vector3 velLinearWorld = val.Input.VelLinearWorld;
					Vector3 val3 = ((!(magnitude > 0.0001f)) ? Vector3.forward : (val2 / magnitude));
					float num = Vector3.Dot(velLinearWorld, val3);
					if (num >= SlapMinSpeed)
					{
						return true;
					}
					if (magnitude < SlapProximity * 0.6f && ((Vector3)(ref velLinearWorld)).magnitude > SlapMinSpeed * 0.5f)
					{
						return true;
					}
				}
			}
			return false;
		}

		private void EjectCell()
		{
			//IL_0068: 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)
			//IL_009a: 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)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Weapon == (Object)null || (Object)(object)Weapon.Magazine == (Object)null)
			{
				return;
			}
			FVRFireArmMagazine magazine = Weapon.Magazine;
			Weapon.EjectMag(false);
			if (!((Object)(object)magazine == (Object)null))
			{
				PlayAt(EjectClip, ((Component)magazine).transform.position);
				if ((Object)(object)((FVRPhysicalObject)magazine).RootRigidbody != (Object)null)
				{
					Vector3 velocity = ((Component)Weapon).transform.TransformDirection(EjectVelocity);
					((FVRPhysicalObject)magazine).RootRigidbody.velocity = velocity;
					((FVRPhysicalObject)magazine).RootRigidbody.angularVelocity = Random.insideUnitSphere * EjectSpin;
				}
			}
		}

		private void BuzzHands(float strength)
		{
			if (!((Object)(object)Weapon == (Object)null) && !((Object)(object)((FVRInteractiveObject)Weapon).m_hand == (Object)null))
			{
				((FVRInteractiveObject)Weapon).m_hand.Buzz(((FVRInteractiveObject)Weapon).m_hand.Buzzer.Buzz_BeginInteraction);
			}
		}

		private void PlayAt(AudioClip clip, Vector3 pos)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//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_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_0051: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)clip == (Object)null))
			{
				AudioEvent val = new AudioEvent();
				val.Clips.Add(clip);
				val.VolumeRange = new Vector2(Volume, Volume);
				val.PitchRange = new Vector2(0.97f, 1.03f);
				SM.PlayGenericSound(val, pos);
			}
		}
	}
	public class ChargeRifleDisplay : MonoBehaviour
	{
		public MeshRenderer ScreenRenderer;

		[Tooltip("Number of cells in the gauge. The gauge fills one cell at a time.")]
		public int Segments = 5;

		public int TexWidth = 64;

		public int TexHeight = 20;

		public Color BgColor = new Color(0.02f, 0.05f, 0.06f, 1f);

		public Color OffCellColor = new Color(0.06f, 0.16f, 0.18f, 1f);

		public Color OnCellColor = new Color(0.25f, 0.95f, 1f, 1f);

		public Color FullCellColor = new Color(1f, 0.92f, 0.55f, 1f);

		public Color ReloadColor = new Color(1f, 0.28f, 0.2f, 1f);

		[Tooltip("Blink period of the RELOAD warning, in seconds. 0 = solid.")]
		public float ReloadBlinkPeriod = 0.6f;

		[Tooltip("Skip repainting when nothing changed. Set to 0 to force a repaint every frame.")]
		public float MinRepaintInterval = 0f;

		private Texture2D _tex;

		private Color32[] _pixels;

		private float _lastLevel = -1f;

		private bool _lastReload;

		private float _nextRepaint;

		private static readonly string[] GlyphR = new string[7] { "11110", "10001", "10001", "11110", "10100", "10010", "10001" };

		private static readonly string[] GlyphE = new string[7] { "11111", "10000", "10000", "11110", "10000", "10000", "11111" };

		private static readonly string[] GlyphL = new string[7] { "10000", "10000", "10000", "10000", "10000", "10000", "11111" };

		private static readonly string[] GlyphO = new string[7] { "01110", "10001", "10001", "10001", "10001", "10001", "01110" };

		private static readonly string[] GlyphA = new string[7] { "01110", "10001", "10001", "11111", "10001", "10001", "10001" };

		private static readonly string[] GlyphD = new string[7] { "11110", "10001", "10001", "10001", "10001", "10001", "11110" };

		private void Awake()
		{
			Build();
		}

		private void Build()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_tex == (Object)null)
			{
				_tex = new Texture2D(TexWidth, TexHeight, (TextureFormat)4, false);
				((Texture)_tex).filterMode = (FilterMode)0;
				((Texture)_tex).wrapMode = (TextureWrapMode)1;
				_pixels = (Color32[])(object)new Color32[TexWidth * TexHeight];
			}
			if ((Object)(object)ScreenRenderer != (Object)null)
			{
				Material material = ((Renderer)ScreenRenderer).material;
				if ((Object)(object)material != (Object)null)
				{
					if (material.HasProperty("_MainTex"))
					{
						material.mainTexture = (Texture)(object)_tex;
					}
					if (material.HasProperty("_Color"))
					{
						material.color = Color.white;
					}
				}
			}
			SetCharge(0f);
		}

		public void SetCharge(float level01)
		{
			level01 = Mathf.Clamp01(level01);
			if (!(Mathf.Abs(level01 - _lastLevel) < 0.0005f) || _lastReload)
			{
				_lastLevel = level01;
				_lastReload = false;
				Paint(level01, reloadWarning: false);
			}
		}

		public void ShowReload()
		{
			bool flag = true;
			if (ReloadBlinkPeriod > 0.01f)
			{
				flag = Mathf.Repeat(Time.time, ReloadBlinkPeriod) > ReloadBlinkPeriod * 0.5f;
			}
			if (!_lastReload || !(_lastLevel < 0f) || !flag)
			{
			}
			_lastLevel = -1f;
			_lastReload = true;
			Paint(0f, flag);
		}

		public void Clear()
		{
			_lastLevel = 0f;
			_lastReload = false;
			Paint(0f, reloadWarning: false);
		}

		private void Paint(float level01, bool reloadWarning)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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)
			if (_pixels == null)
			{
				Build();
			}
			for (int i = 0; i < _pixels.Length; i++)
			{
				ref Color32 reference = ref _pixels[i];
				reference = Color32.op_Implicit(BgColor);
			}
			if (Segments < 1)
			{
				Segments = 1;
			}
			int num = 2;
			int num2 = TexWidth - num * 2;
			int num3 = 1;
			int num4 = (num2 - num3 * (Segments - 1)) / Segments;
			if (num4 < 1)
			{
				num4 = 1;
			}
			int h = TexHeight - num * 2;
			int num5 = Mathf.CeilToInt(level01 * (float)Segments);
			if (level01 > 0f && num5 < 1)
			{
				num5 = 1;
			}
			for (int j = 0; j < Segments; j++)
			{
				int x = num + j * (num4 + num3);
				Color c = OffCellColor;
				if (j < num5)
				{
					c = ((!(level01 >= 0.999f)) ? OnCellColor : FullCellColor);
				}
				FillRect(x, num, num4, h, c);
			}
			if (reloadWarning)
			{
				DrawString("RELOAD", ReloadColor);
			}
			_tex.SetPixels32(_pixels);
			_tex.Apply(false);
			_nextRepaint = Time.time + MinRepaintInterval;
		}

		private void FillRect(int x0, int y0, int w, int h, Color c)
		{
			//IL_0056: 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)
			for (int i = y0; i < y0 + h; i++)
			{
				if (i < 0 || i >= TexHeight)
				{
					continue;
				}
				for (int j = x0; j < x0 + w; j++)
				{
					if (j >= 0 && j < TexWidth)
					{
						ref Color32 reference = ref _pixels[i * TexWidth + j];
						reference = Color32.op_Implicit(c);
					}
				}
			}
		}

		private void DrawString(string text, Color c)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			int num = 1;
			int num2 = 5 * num;
			int num3 = 7 * num;
			int num4 = 1;
			int num5 = text.Length * num2 + (text.Length - 1) * num4;
			int num6 = (TexWidth - num5) / 2;
			int y = (TexHeight - num3) / 2;
			FillRect(0, 0, TexWidth, TexHeight, BgColor);
			for (int i = 0; i < text.Length; i++)
			{
				string[] array = GlyphFor(text[i]);
				if (array != null)
				{
					DrawGlyph(array, num6, y, num, c);
				}
				num6 += num2 + num4;
			}
		}

		private void DrawGlyph(string[] g, int x0, int y0, int scale, Color c)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < 7; i++)
			{
				string text = g[i];
				for (int j = 0; j < text.Length; j++)
				{
					if (text[j] == '1')
					{
						FillRect(x0 + j * scale, y0 + (6 - i) * scale, scale, scale, c);
					}
				}
			}
		}

		private static string[] GlyphFor(char ch)
		{
			return ch switch
			{
				'R' => GlyphR, 
				'E' => GlyphE, 
				'L' => GlyphL, 
				'O' => GlyphO, 
				'A' => GlyphA, 
				'D' => GlyphD, 
				_ => null, 
			};
		}

		private void OnDestroy()
		{
			if ((Object)(object)_tex != (Object)null)
			{
				Object.Destroy((Object)(object)_tex);
			}
		}
	}
	public class ChargeRifleSystem : MonoBehaviour
	{
		[Header("References")]
		public FVRFireArm Weapon;

		[Tooltip("Where the beams start. Defaults to the weapon's MuzzlePos.")]
		public Transform Muzzle;

		[Tooltip("Barrel part that turns 90 degrees while the rifle charges (BarrelRotate).")]
		public Transform TiltPart;

		[Tooltip("Barrel part that spins fast while the rifle charges (Barrel).")]
		public Transform SpinPart;

		[Tooltip("Glow shells driven by the charge level (BarrelHeat / BatteryLeftHeat / BatteryRightHeat).")]
		public Renderer[] HeatRenderers;

		public ChargeRifleDisplay Display;

		public ChargeRifleBatteryLid BatteryLid;

		[Header("Charge")]
		[Tooltip("Seconds of holding the trigger until the burst is ready.")]
		public float ChargeTime = 0.85f;

		[Tooltip("Seconds for a full charge to drain back to zero after the trigger is released.")]
		public float ChargeDecayTime = 0.5f;

		[Tooltip("Trigger value (0..1) at which the charge starts.")]
		[Range(0f, 1f)]
		public float TriggerThreshold = 0.55f;

		[Tooltip("Trigger value the player has to fall back under before a burst can start a new charge.")]
		[Range(0f, 1f)]
		public float TriggerReleaseThreshold = 0.25f;

		[Tooltip("Fire the next burst automatically while the trigger stays held (Apex behaviour).")]
		public bool AutoRepeatWhileHeld = true;

		[Tooltip("How many tier sounds are played during a charge (ChargeLevel1..N).")]
		public int ChargeLevels = 3;

		[Header("Barrel motion")]
		[Tooltip("Rotation applied to the tilt part at full charge, degrees around its local Z.")]
		public float TiltAngle = 90f;

		[Tooltip("Seconds the tilt part needs to reach TiltAngle.")]
		public float TiltTime = 0.22f;

		[Tooltip("Spin speed of the spinning barrel part at full charge, degrees per second.")]
		public float SpinMaxDps = 1250f;

		public float SpinAccelDps2 = 2600f;

		[Tooltip("Seconds the barrel keeps spinning after the burst before it winds down.")]
		public float SpinContinueAfterShot = 1f;

		[Tooltip("Seconds the spinning part takes to settle back to its home angle.")]
		public float SpinReturnTime = 0.35f;

		[Header("Beam - thin (charging)")]
		public float ThinBeamRange = 150f;

		public float ThinBeamWidthMin = 0.004f;

		public float ThinBeamWidthMax = 0.016f;

		[Tooltip("Seconds between thin beam damage applications.")]
		public float ThinBeamTickInterval = 0.1f;

		[Tooltip("Kinetic damage per thin beam tick. Grows a little as the charge builds.")]
		public float ThinBeamDamageKinetic = 22f;

		[Header("Beam - burst")]
		public float BurstBeamRange = 300f;

		public float BurstBeamWidth = 0.055f;

		[Tooltip("Seconds the burst beam stays visible while it fades.")]
		public float BurstBeamDuration = 0.15f;

		public float BurstDamageKinetic = 900f;

		public float BurstDamageThermal = 220f;

		[Header("Ammo")]
		[Tooltip("Rounds taken out of the battery cell per burst.")]
		public int RoundsPerBurst = 1;

		[Header("Audio")]
		public AudioClip ChargeClickClip;

		public AudioClip ChargeLoopClip;

		public AudioClip[] ChargeLevelClips;

		public AudioClip ChargeDownClip;

		public AudioClip SpinLoopClip;

		public AudioClip SpinDownClip;

		public AudioClip BeamIgniteClip;

		public AudioClip BeamBuzzLoopClip;

		public AudioClip[] ThinBeamFireClips;

		public AudioClip[] BurstClips;

		public AudioClip BurstBodyClip;

		public AudioClip FireSizzleClip;

		public AudioClip[] TriggerClips;

		public AudioClip DrawClip;

		[Range(0f, 1f)]
		public float ChargeLoopMaxVolume = 0.7f;

		[Range(0f, 1f)]
		public float SpinLoopVolume = 0.45f;

		[Range(0f, 1f)]
		public float BeamBuzzVolume = 0.5f;

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

		[Tooltip("Pitch of the charge hum at zero charge and at full charge.")]
		public float ChargeLoopPitchMin = 0.9f;

		public float ChargeLoopPitchMax = 1.18f;

		[Header("Visuals")]
		public Material BeamMaterial;

		public Color ThinBeamColor = new Color(0.45f, 0.95f, 1f, 0.85f);

		public Color BurstBeamColor = new Color(1f, 0.95f, 0.8f, 1f);

		[Tooltip("Layer mask for the hitscans. Trigger colliders are ignored.")]
		public LayerMask RayMask = LayerMask.op_Implicit(-1);

		[Tooltip("Spawn bullet hole decals where the beams land.")]
		public bool SpawnDecals = true;

		[Header("State (read-only)")]
		[Range(0f, 1f)]
		public float Charge;

		private float _charge;

		private float _tiltLerp;

		private float _spinSpeed;

		private float _spinAngle;

		private float _spinHomeZ;

		private float _tiltHomeZ;

		private float _spinCoastUntil = -1f;

		private float _nextThinTick;

		private float _nextLevelIndex;

		private int _lastLevelIndex;

		private bool _waitRelease;

		private bool _wasHeld;

		private bool _wasHeldGun;

		private float _burstFade;

		private float _glow;

		private LineRenderer _thinBeam;

		private LineRenderer _burstBeam;

		private AudioSource _chargeLoop;

		private AudioSource _spinLoop;

		private AudioSource _buzzLoop;

		private MaterialPropertyBlock _pb;

		private RaycastHit[] _hits = (RaycastHit[])(object)new RaycastHit[32];

		private float _beamOnTime = -1f;

		private AudioEvent _ev;

		public bool IsCharging { get; private set; }

		private void Awake()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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)
			if ((Object)(object)Weapon == (Object)null)
			{
				Weapon = ((Component)this).GetComponent<FVRFireArm>();
			}
			if ((Object)(object)Muzzle == (Object)null && (Object)(object)Weapon != (Object)null)
			{
				Muzzle = Weapon.MuzzlePos;
			}
			if ((Object)(object)TiltPart != (Object)null)
			{
				_tiltHomeZ = TiltPart.localEulerAngles.z;
			}
			if ((Object)(object)SpinPart != (Object)null)
			{
				_spinHomeZ = SpinPart.localEulerAngles.z;
			}
			_pb = new MaterialPropertyBlock();
			_ev = new AudioEvent();
			_ev.VolumeRange = new Vector2(OneShotVolume, OneShotVolume);
			BuildBeams();
			BuildLoops();
		}

		private void BuildBeams()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_thinBeam == (Object)null)
			{
				GameObject val = new GameObject("ChargeRifleThinBeam");
				val.transform.SetParent(((Component)this).transform, false);
				_thinBeam = val.AddComponent<LineRenderer>();
				SetupLine(_thinBeam, ThinBeamWidthMax, ThinBeamColor);
				((Renderer)_thinBeam).enabled = false;
			}
			if ((Object)(object)_burstBeam == (Object)null)
			{
				GameObject val2 = new GameObject("ChargeRifleBurstBeam");
				val2.transform.SetParent(((Component)this).transform, false);
				_burstBeam = val2.AddComponent<LineRenderer>();
				SetupLine(_burstBeam, BurstBeamWidth, BurstBeamColor);
				((Renderer)_burstBeam).enabled = false;
			}
		}

		private void SetupLine(LineRenderer lr, float width, Color color)
		{
			//IL_0058: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			Material val = BeamMaterial;
			if ((Object)(object)val == (Object)null)
			{
				Shader val2 = Shader.Find("Sprites/Default");
				if ((Object)(object)val2 != (Object)null)
				{
					val = new Material(val2);
				}
			}
			((Renderer)lr).material = val;
			lr.useWorldSpace = true;
			lr.positionCount = 2;
			lr.startWidth = width;
			lr.endWidth = width;
			lr.startColor = color;
			lr.endColor = color;
			((Renderer)lr).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)lr).receiveShadows = false;
		}

		private void BuildLoops()
		{
			_chargeLoop = MakeLoopSource("ChargeHum", ChargeLoopClip);
			_spinLoop = MakeLoopSource("BarrelSpin", SpinLoopClip);
			_buzzLoop = MakeLoopSource("BeamBuzz", BeamBuzzLoopClip);
		}

		private AudioSource MakeLoopSource(string name, AudioClip clip)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.transform.SetParent(((Component)this).transform, false);
			AudioSource val2 = val.AddComponent<AudioSource>();
			val2.clip = clip;
			val2.loop = true;
			val2.playOnAwake = false;
			val2.volume = 0f;
			val2.spatialBlend = 1f;
			val2.dopplerLevel = 0f;
			val2.rolloffMode = (AudioRolloffMode)1;
			val2.minDistance = 1.5f;
			val2.maxDistance = 35f;
			return val2;
		}

		private void Update()
		{
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Weapon == (Object)null)
			{
				return;
			}
			float deltaTime = Time.deltaTime;
			bool flag = ((FVRInteractiveObject)Weapon).IsHeld && (Object)(object)((FVRInteractiveObject)Weapon).m_hand != (Object)null;
			FVRViveHand val = ((!flag) ? null : ((FVRInteractiveObject)Weapon).m_hand);
			bool flag2 = flag && val.Input.TriggerFloat >= TriggerThreshold;
			if (!flag)
			{
				CancelCharge(playSound: false);
				_waitRelease = false;
			}
			else if (!_wasHeldGun)
			{
				PlayDrawSound();
			}
			_wasHeldGun = flag;
			bool flag3 = (Object)(object)BatteryLid != (Object)null && BatteryLid.IsOpen;
			bool flag4 = HasAmmo();
			if (flag2 && !_wasHeld && !_waitRelease)
			{
				if (flag4 && !flag3)
				{
					PlayOneShot(TriggerClips, MuzzlePos(), 0.85f);
				}
				else
				{
					PlayOneShot(TriggerClips, MuzzlePos(), 1f);
				}
			}
			_wasHeld = flag2;
			if (flag && val.Input.TriggerFloat < TriggerReleaseThreshold)
			{
				_waitRelease = false;
			}
			bool flag5 = flag2 && flag4 && !flag3 && !_waitRelease;
			if (flag5)
			{
				if (!IsCharging)
				{
					BeginCharge();
				}
				_charge += deltaTime / Mathf.Max(0.01f, ChargeTime);
				if (_charge >= 1f)
				{
					_charge = 1f;
					FireBurst(val);
					_charge = 0f;
					_lastLevelIndex = 0;
					if (!AutoRepeatWhileHeld)
					{
						_waitRelease = true;
					}
				}
			}
			else
			{
				if (IsCharging)
				{
					EndCharge(flag4 && !flag3);
				}
				_charge = Mathf.MoveTowards(_charge, 0f, deltaTime / Mathf.Max(0.01f, ChargeDecayTime));
				if (_charge <= 0f)
				{
					_lastLevelIndex = 0;
				}
			}
			Charge = _charge;
			UpdateTicks();
			UpdateThinBeam(deltaTime, flag2, flag5);
			UpdateBarrelMotion(deltaTime, flag5);
			UpdateGlow(deltaTime);
			UpdateAudio(deltaTime);
			UpdateDisplay();
			UpdateBurstFade(deltaTime);
		}

		private void BeginCharge()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			IsCharging = true;
			_lastLevelIndex = 0;
			PlayOneShot(ChargeClickClip, MuzzlePos(), 1f);
			if ((Object)(object)_chargeLoop != (Object)null && (Object)(object)ChargeLoopClip != (Object)null && !_chargeLoop.isPlaying)
			{
				_chargeLoop.Play();
			}
		}

		private void EndCharge(bool playSound)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			IsCharging = false;
			if (playSound && _charge > 0.08f)
			{
				PlayOneShot(ChargeDownClip, MuzzlePos(), 1f);
			}
		}

		private void CancelCharge(bool playSound)
		{
			if (IsCharging)
			{
				EndCharge(playSound);
			}
			_charge = Mathf.MoveTowards(_charge, 0f, Time.deltaTime / Mathf.Max(0.01f, ChargeDecayTime));
		}

		private void UpdateTicks()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			if (ChargeLevels > 0)
			{
				int num = Mathf.FloorToInt(_charge * (float)ChargeLevels);
				if (num > _lastLevelIndex && ChargeLevelClips != null && ChargeLevelClips.Length > 0)
				{
					int num2 = Mathf.Clamp(_lastLevelIndex, 0, ChargeLevelClips.Length - 1);
					PlayOneShot(ChargeLevelClips[num2], MuzzlePos(), 1f);
					_lastLevelIndex = num;
				}
			}
		}

		private bool HasAmmo()
		{
			FVRFireArmMagazine magazine = Weapon.Magazine;
			if ((Object)(object)magazine == (Object)null)
			{
				return false;
			}
			if (magazine.IsInfinite)
			{
				return true;
			}
			return magazine.HasARound();
		}

		private void ConsumeRound(int count)
		{
			FVRFireArmMagazine magazine = Weapon.Magazine;
			if ((Object)(object)magazine == (Object)null || magazine.IsInfinite)
			{
				return;
			}
			for (int i = 0; i < count; i++)
			{
				if (!magazine.HasARound())
				{
					break;
				}
				magazine.RemoveRound();
			}
		}

		private void FireBurst(FVRViveHand hand)
		{
			//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_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0039: 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_002e: 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_009b: 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_0058: 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_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = MuzzlePos();
			Vector3 val2 = MuzzleDir();
			RaycastHit best;
			float dist;
			bool flag = TraceBeam(val, val2, BurstBeamRange, out best, out dist);
			FireBurstVisual(val, (!flag) ? (val + val2 * BurstBeamRange) : ((RaycastHit)(ref best)).point);
			if (flag)
			{
				ApplyDamage(best, val2, BurstDamageKinetic, BurstDamageThermal, 0.02f, strong: true);
			}
			ConsumeRound(Mathf.Max(1, RoundsPerBurst));
			PlayOneShot(BurstClips, val, 1f);
			PlayOneShot(BurstBodyClip, val, 1f);
			if (flag)
			{
				PlayOneShot(FireSizzleClip, ((RaycastHit)(ref best)).point, 0.8f);
			}
			Weapon.Recoil(Weapon.IsTwoHandStabilized(), Weapon.IsForegripStabilized(), Weapon.IsShoulderStabilized(), (FVRFireArmRecoilProfile)null, 1f);
			if ((Object)(object)hand != (Object)null)
			{
				hand.Buzz(hand.Buzzer.Buzz_GunShot);
			}
			if ((Object)(object)GM.CurrentSceneSettings != (Object)null)
			{
				GM.CurrentSceneSettings.OnShotFired(Weapon);
			}
			if ((Object)(object)GM.CurrentPlayerBody != (Object)null)
			{
				GM.CurrentPlayerBody.VisibleEvent(2f);
			}
			if (!((FVRInteractiveObject)Weapon).IsHeld && (Object)(object)((FVRPhysicalObject)Weapon).RootRigidbody != (Object)null)
			{
				((FVRPhysicalObject)Weapon).RootRigidbody.AddForceAtPosition(-val2 * 0.6f, val, (ForceMode)2);
			}
			_spinCoastUntil = Time.time + SpinContinueAfterShot;
			_burstFade = 1f;
		}

		private void FireBurstVisual(Vector3 from, Vector3 to)
		{
			//IL_002a: 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_006c: 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)
			if (!((Object)(object)_burstBeam == (Object)null))
			{
				((Renderer)_burstBeam).enabled = true;
				_burstBeam.SetPosition(0, from);
				_burstBeam.SetPosition(1, to);
				_burstBeam.startWidth = BurstBeamWidth;
				_burstBeam.endWidth = BurstBeamWidth * 0.35f;
				_burstBeam.startColor = BurstBeamColor;
				_burstBeam.endColor = BurstBeamColor;
			}
		}

		private void UpdateBurstFade(float dt)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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)
			if (_burstFade <= 0f)
			{
				return;
			}
			_burstFade = Mathf.MoveTowards(_burstFade, 0f, dt / Mathf.Max(0.01f, BurstBeamDuration));
			Color burstBeamColor = BurstBeamColor;
			burstBeamColor.a *= _burstFade;
			if ((Object)(object)_burstBeam != (Object)null)
			{
				_burstBeam.startColor = burstBeamColor;
				_burstBeam.endColor = burstBeamColor;
				_burstBeam.startWidth = BurstBeamWidth * _burstFade;
				_burstBeam.endWidth = BurstBeamWidth * 0.35f * _burstFade;
				if (_burstFade <= 0f)
				{
					((Renderer)_burstBeam).enabled = false;
				}
			}
		}

		private void UpdateThinBeam(float dt, bool triggerDown, bool canCharge)
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00a3: 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_00a6: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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_0104: 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_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: 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_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			if (!triggerDown || !canCharge || !(_charge > 0.02f))
			{
				if ((Object)(object)_thinBeam != (Object)null && ((Renderer)_thinBeam).enabled)
				{
					((Renderer)_thinBeam).enabled = false;
				}
				_beamOnTime = -1f;
				return;
			}
			if (_beamOnTime < 0f)
			{
				_beamOnTime = Time.time;
				PlayOneShot(BeamIgniteClip, MuzzlePos(), 1f);
			}
			Vector3 val = MuzzlePos();
			Vector3 val2 = MuzzleDir();
			RaycastHit best;
			float dist;
			bool flag = TraceBeam(val, val2, ThinBeamRange, out best, out dist);
			Vector3 val3 = ((!flag) ? (val + val2 * ThinBeamRange) : ((RaycastHit)(ref best)).point);
			if ((Object)(object)_thinBeam != (Object)null)
			{
				((Renderer)_thinBeam).enabled = true;
				_thinBeam.SetPosition(0, val);
				_thinBeam.SetPosition(1, val3);
				float num = Mathf.Lerp(ThinBeamWidthMin, ThinBeamWidthMax, _charge);
				_thinBeam.startWidth = num;
				_thinBeam.endWidth = num;
				Color thinBeamColor = ThinBeamColor;
				thinBeamColor.a = Mathf.Lerp(0.35f, 1f, _charge) * ThinBeamColor.a;
				_thinBeam.startColor = thinBeamColor;
				_thinBeam.endColor = thinBeamColor;
			}
			if (Time.time >= _nextThinTick)
			{
				_nextThinTick = Time.time + ThinBeamTickInterval;
				if (flag)
				{
					float num2 = ThinBeamDamageKinetic * Mathf.Lerp(0.45f, 1f, _charge);
					ApplyDamage(best, val2, num2, num2 * 0.5f, 0.006f, strong: false);
				}
				if (ThinBeamFireClips != null && ThinBeamFireClips.Length > 0 && Random.value < 0.5f)
				{
					PlayOneShot(ThinBeamFireClips, val, 0.55f);
				}
			}
		}

		private Vector3 MuzzlePos()
		{
			//IL_0028: 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_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_0018: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			return (!((Object)(object)Muzzle != (Object)null)) ? (((Component)this).transform.position + ((Component)this).transform.forward * 0.5f) : Muzzle.position;
		}

		private Vector3 MuzzleDir()
		{
			//IL_0028: 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_002d: 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)
			return (!((Object)(object)Muzzle != (Object)null)) ? ((Component)this).transform.forward : Muzzle.forward;
		}

		private bool TraceBeam(Vector3 origin, Vector3 dir, float range, out RaycastHit best, out float dist)
		{
			//IL_0003: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			best = default(RaycastHit);
			dist = range;
			int num = Physics.RaycastNonAlloc(origin, dir, _hits, range, LayerMask.op_Implicit(RayMask), (QueryTriggerInteraction)1);
			if (num <= 0)
			{
				return false;
			}
			float num2 = float.MaxValue;
			bool flag = false;
			Transform root = ((Component)this).transform.root;
			Transform val = ((!((Object)(object)GM.CurrentPlayerBody != (Object)null)) ? null : ((Component)GM.CurrentPlayerBody).transform);
			for (int i = 0; i < num; i++)
			{
				RaycastHit val2 = _hits[i];
				if (!((Object)(object)((RaycastHit)(ref val2)).collider == (Object)null))
				{
					Transform transform = ((Component)((RaycastHit)(ref val2)).collider).transform;
					if (!((Object)(object)transform.root == (Object)(object)root) && (!((Object)(object)val != (Object)null) || (!((Object)(object)transform == (Object)(object)val) && !transform.IsChildOf(val))) && ((RaycastHit)(ref val2)).distance < num2)
					{
						num2 = ((RaycastHit)(ref val2)).distance;
						best = val2;
						flag = true;
					}
				}
			}
			if (!flag)
			{
				return false;
			}
			dist = num2;
			return true;
		}

		private void ApplyDamage(RaycastHit hit, Vector3 dir, float kinetic, float thermal, float size, bool strong)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0058: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			IFVRDamageable component = ((Component)((RaycastHit)(ref hit)).collider).gameObject.GetComponent<IFVRDamageable>();
			if (component == null && (Object)(object)((RaycastHit)(ref hit)).collider.attachedRigidbody != (Object)null)
			{
				component = ((Component)((RaycastHit)(ref hit)).collider.attachedRigidbody).gameObject.GetComponent<IFVRDamageable>();
			}
			if (component != null)
			{
				Damage val = new Damage();
				val.Class = (DamageClass)1;
				val.Dam_TotalKinetic = kinetic;
				val.Dam_Blunt = kinetic * 0.1f;
				val.Dam_Piercing = kinetic * 0.9f;
				val.Dam_Thermal = thermal;
				val.Dam_TotalEnergetic = thermal;
				val.point = ((RaycastHit)(ref hit)).point;
				val.hitNormal = ((RaycastHit)(ref hit)).normal;
				val.strikeDir = dir;
				val.damageSize = size;
				if ((Object)(object)GM.CurrentPlayerBody != (Object)null)
				{
					val.Source_IFF = GM.CurrentPlayerBody.GetPlayerIFF();
				}
				component.Damage(val);
			}
			if (SpawnDecals && (Object)(object)((RaycastHit)(ref hit)).collider.attachedRigidbody == (Object)null)
			{
				SpawnDecal(hit, size, strong);
			}
		}

		private void SpawnDecal(RaycastHit hit, float size, bool strong)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			//IL_007c: 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_0082: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			if (GM.Options == null || (int)GM.Options.SimulationOptions.HitDecalMode2 != 1)
			{
				return;
			}
			PMat component = ((Component)((RaycastHit)(ref hit)).collider).gameObject.GetComponent<PMat>();
			MatDef val = ((!((Object)(object)component != (Object)null) || !((Object)(object)component.MatDef != (Object)null)) ? PM.DefaultMatDef : component.MatDef);
			if (!((Object)(object)val == (Object)null))
			{
				BulletHoleDecalType bulletHoleType = val.BulletHoleType;
				if ((int)bulletHoleType != 0)
				{
					float num = Mathf.Clamp(size * ((!strong) ? 3f : 6f), 0.0001f, 0.02f);
					FXM.SpawnBulletDecal(bulletHoleType, ((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal, num);
				}
			}
		}

		private void UpdateBarrelMotion(float dt, bool canCharge)
		{
			//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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp01(_charge);
			_tiltLerp = Mathf.MoveTowards(_tiltLerp, num, dt / Mathf.Max(0.01f, TiltTime));
			if ((Object)(object)TiltPart != (Object)null)
			{
				Vector3 localEulerAngles = TiltPart.localEulerAngles;
				TiltPart.localEulerAngles = new Vector3(localEulerAngles.x, localEulerAngles.y, _tiltHomeZ + TiltAngle * _tiltLerp);
			}
			bool flag = canCharge || _charge > 0.02f || Time.time < _spinCoastUntil;
			float num2 = ((!flag) ? 0f : (SpinMaxDps * Mathf.Clamp01(0.35f + 0.65f * _charge)));
			if (num2 <= 0.01f && _spinSpeed <= 0.01f && !flag)
			{
				_spinAngle = Mathf.MoveTowardsAngle(_spinAngle, 0f, dt * (360f / Mathf.Max(0.05f, SpinReturnTime)));
			}
			_spinSpeed = Mathf.MoveTowards(_spinSpeed, num2, SpinAccelDps2 * dt);
			_spinAngle -= _spinSpeed * dt;
			if (_spinAngle < -360f)
			{
				_spinAngle += 360f;
			}
			if ((Object)(object)SpinPart != (Object)null)
			{
				Vector3 localEulerAngles2 = SpinPart.localEulerAngles;
				SpinPart.localEulerAngles = new Vector3(localEulerAngles2.x, localEulerAngles2.y, _spinHomeZ + _spinAngle);
			}
		}

		private void UpdateGlow(float dt)
		{
			float num = (IsCharging ? Mathf.Lerp(0.12f, 1f, _charge) : ((!(_burstFade > 0f)) ? 0f : _burstFade));
			_glow = Mathf.MoveTowards(_glow, num, dt * 6f);
			if (HeatRenderers == null || HeatRenderers.Length == 0)
			{
				return;
			}
			_pb.SetFloat("_EmissionWeight", _glow);
			_pb.SetFloat("_Emission", (!(_glow > 0.01f)) ? 0f : 1f);
			for (int i = 0; i < HeatRenderers.Length; i++)
			{
				if ((Object)(object)HeatRenderers[i] != (Object)null)
				{
					HeatRenderers[i].SetPropertyBlock(_pb);
				}
			}
		}

		private void UpdateAudio(float dt)
		{
			if ((Object)(object)_chargeLoop != (Object)null)
			{
				bool flag = (Object)(object)ChargeLoopClip != (Object)null && (IsCharging || _charge > 0.02f);
				float num = ((!flag) ? 0f : (ChargeLoopMaxVolume * Mathf.Clamp01(_charge)));
				_chargeLoop.volume = Mathf.MoveTowards(_chargeLoop.volume, num, dt * 3f);
				if (_chargeLoop.volume <= 0.001f && _chargeLoop.isPlaying)
				{
					_chargeLoop.Stop();
				}
				else if (flag && !_chargeLoop.isPlaying)
				{
					_chargeLoop.Play();
				}
				_chargeLoop.pitch = Mathf.Lerp(ChargeLoopPitchMin, ChargeLoopPitchMax, _charge);
			}
			if ((Object)(object)_spinLoop != (Object)null)
			{
				bool flag2 = _spinSpeed > 20f;
				float num2 = ((!flag2) ? 0f : (SpinLoopVolume * Mathf.Clamp01(_spinSpeed / Mathf.Max(1f, SpinMaxDps))));
				_spinLoop.volume = Mathf.MoveTowards(_spinLoop.volume, num2, dt * 4f);
				if (_spinLoop.volume <= 0.001f && _spinLoop.isPlaying)
				{
					_spinLoop.Stop();
				}
				else if (flag2 && !_spinLoop.isPlaying)
				{
					_spinLoop.Play();
				}
				_spinLoop.pitch = Mathf.Lerp(0.85f, 1.15f, Mathf.Clamp01(_spinSpeed / Mathf.Max(1f, SpinMaxDps)));
			}
			if ((Object)(object)_buzzLoop != (Object)null)
			{
				bool flag3 = (Object)(object)_thinBeam != (Object)null && ((Renderer)_thinBeam).enabled;
				float num3 = ((!flag3) ? 0f : BeamBuzzVolume);
				_buzzLoop.volume = Mathf.MoveTowards(_buzzLoop.volume, num3, dt * 8f);
				if (_buzzLoop.volume <= 0.001f && _buzzLoop.isPlaying)
				{
					_buzzLoop.Stop();
				}
				else if (flag3 && !_buzzLoop.isPlaying)
				{
					_buzzLoop.Play();
				}
			}
		}

		private void PlayOneShot(AudioClip clip, Vector3 pos, float volumeScale)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//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_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_0055: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)clip == (Object)null))
			{
				AudioEvent val = new AudioEvent();
				val.Clips.Add(clip);
				val.VolumeRange = new Vector2(OneShotVolume * volumeScale, OneShotVolume * volumeScale);
				val.PitchRange = new Vector2(0.97f, 1.03f);
				SM.PlayGenericSound(val, pos);
			}
		}

		private void PlayOneShot(AudioClip[] clips, Vector3 pos, float volumeScale)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (clips != null && clips.Length != 0)
			{
				int num = Random.Range(0, clips.Length);
				PlayOneShot(clips[num], pos, volumeScale);
			}
		}

		private void UpdateDisplay()
		{
			if (!((Object)(object)Display == (Object)null))
			{
				if (!HasAmmo())
				{
					Display.ShowReload();
				}
				else
				{
					Display.SetCharge(_charge);
				}
			}
		}

		public void PlayDrawSound()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			PlayOneShot(DrawClip, MuzzlePos(), 1f);
		}

		private void OnDisable()
		{
			if ((Object)(object)_chargeLoop != (Object)null)
			{
				_chargeLoop.Stop();
			}
			if ((Object)(object)_spinLoop != (Object)null)
			{
				_spinLoop.Stop();
			}
			if ((Object)(object)_buzzLoop != (Object)null)
			{
				_buzzLoop.Stop();
			}
			if ((Object)(object)_thinBeam != (Object)null)
			{
				((Renderer)_thinBeam).enabled = false;
			}
			if ((Object)(object)_burstBeam != (Object)null)
			{
				((Renderer)_burstBeam).enabled = false;
			}
		}
	}
}
namespace Niko666.Universal_Shotgun_Speedloader
{
	[BepInPlugin("Niko666.Universal_Shotgun_Speedloader", "Universal_Shotgun_Speedloader", "1.1.1")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class Universal_Shotgun_SpeedloaderPlugin : 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(), "Niko666.Universal_Shotgun_Speedloader");
			OtherLoader.RegisterDirectLoad(BasePath, "Niko666.Universal_Shotgun_Speedloader", "", "", "unisgspeedloader", "");
		}
	}
}
public class DynamicBoneDemo1 : MonoBehaviour
{
	public GameObject m_Player;

	private float m_weight = 1f;

	private void Update()
	{
		//IL_002c: 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_0056: 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_006a: Unknown result type (might be due to invalid IL or missing references)
		m_Player.transform.Rotate(new Vector3(0f, Input.GetAxis("Horizontal") * Time.deltaTime * 200f, 0f));
		m_Player.transform.Translate(((Component)this).transform.forward * Input.GetAxis("Vertical") * Time.deltaTime * 4f);
	}

	private void OnGUI()
	{
		//IL_0015: 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_007f: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		GUI.Label(new Rect(50f, 50f, 200f, 24f), "Press arrow key to move");
		Animation componentInChildren = m_Player.GetComponentInChildren<Animation>();
		((Behaviour)componentInChildren).enabled = GUI.Toggle(new Rect(50f, 70f, 200f, 24f), ((Behaviour)componentInChildren).enabled, "Play Animation");
		DynamicBone[] components = m_Player.GetComponents<DynamicBone>();
		GUI.Label(new Rect(50f, 100f, 200f, 24f), "Choose dynamic bone:");
		DynamicBone obj = components[0];
		bool enabled = GUI.Toggle(new Rect(50f, 120f, 100f, 24f), ((Behaviour)components[0]).enabled, "Breasts");
		((Behaviour)components[1]).enabled = enabled;
		((Behaviour)obj).enabled = enabled;
		((Behaviour)components[2]).enabled = GUI.Toggle(new Rect(50f, 140f, 100f, 24f), ((Behaviour)components[2]).enabled, "Tail");
		GUI.Label(new Rect(50f, 160f, 200f, 24f), "Weight");
		m_weight = GUI.HorizontalSlider(new Rect(100f, 160f, 100f, 24f), m_weight, 0f, 1f);
		DynamicBone[] array = components;
		foreach (DynamicBone dynamicBone in array)
		{
			dynamicBone.SetWeight(m_weight);
		}
	}
}
[AddComponentMenu("Dynamic Bone/Dynamic Bone")]
public class DynamicBone : MonoBehaviour
{
	public enum UpdateMode
	{
		Normal,
		AnimatePhysics,
		UnscaledTime
	}

	public enum FreezeAxis
	{
		None,
		X,
		Y,
		Z
	}

	private class Particle
	{
		public Transform m_Transform = null;

		public int m_ParentIndex = -1;

		public float m_Damping = 0f;

		public float m_Elasticity = 0f;

		public float m_Stiffness = 0f;

		public float m_Inert = 0f;

		public float m_Friction = 0f;

		public float m_Radius = 0f;

		public float m_BoneLength = 0f;

		public bool m_isCollide = false;

		public Vector3 m_Position = Vector3.zero;

		public Vector3 m_PrevPosition = Vector3.zero;

		public Vector3 m_EndOffset = Vector3.zero;

		public Vector3 m_InitLocalPosition = Vector3.zero;

		public Quaternion m_InitLocalRotation = Quaternion.identity;
	}

	[Tooltip("The root of the transform hierarchy to apply physics.")]
	public Transform m_Root = null;

	[Tooltip("Internal physics simulation rate.")]
	public float m_UpdateRate = 60f;

	public UpdateMode m_UpdateMode = UpdateMode.Normal;

	[Tooltip("How much the bones slowed down.")]
	[Range(0f, 1f)]
	public float m_Damping = 0.1f;

	public AnimationCurve m_DampingDistrib = null;

	[Tooltip("How much the force applied to return each bone to original orientation.")]
	[Range(0f, 1f)]
	public float m_Elasticity = 0.1f;

	public AnimationCurve m_ElasticityDistrib = null;

	[Tooltip("How much bone's original orientation are preserved.")]
	[Range(0f, 1f)]
	public float m_Stiffness = 0.1f;

	public AnimationCurve m_StiffnessDistrib = null;

	[Tooltip("How much character's position change is ignored in physics simulation.")]
	[Range(0f, 1f)]
	public float m_Inert = 0f;

	public AnimationCurve m_InertDistrib = null;

	[Tooltip("How much the bones slowed down when collide.")]
	public float m_Friction = 0f;

	public AnimationCurve m_FrictionDistrib = null;

	[Tooltip("Each bone can be a sphere to collide with colliders. Radius describe sphere's size.")]
	public float m_Radius = 0f;

	public AnimationCurve m_RadiusDistrib = null;

	[Tooltip("If End Length is not zero, an extra bone is generated at the end of transform hierarchy.")]
	public float m_EndLength = 0f;

	[Tooltip("If End Offset is not zero, an extra bone is generated at the end of transform hierarchy.")]
	public Vector3 m_EndOffset = Vector3.zero;

	[Tooltip("The force apply to bones. Partial force apply to character's initial pose is cancelled out.")]
	public Vector3 m_Gravity = Vector3.zero;

	[Tooltip("The force apply to bones.")]
	public Vector3 m_Force = Vector3.zero;

	[Tooltip("Collider objects interact with the bones.")]
	public List<DynamicBoneColliderBase> m_Colliders = null;

	[Tooltip("Bones exclude from physics simulation.")]
	public List<Transform> m_Exclusions = null;

	[Tooltip("Constrain bones to move on specified plane.")]
	public FreezeAxis m_FreezeAxis = FreezeAxis.None;

	[Tooltip("Disable physics simulation automatically if character is far from camera or player.")]
	public bool m_DistantDisable = false;

	public Transform m_ReferenceObject = null;

	public float m_DistanceToObject = 20f;

	private Vector3 m_LocalGravity = Vector3.zero;

	private Vector3 m_ObjectMove = Vector3.zero;

	private Vector3 m_ObjectPrevPosition = Vector3.zero;

	private float m_BoneTotalLength = 0f;

	private float m_ObjectScale = 1f;

	private float m_Time = 0f;

	private float m_Weight = 1f;

	private bool m_DistantDisabled = false;

	private List<Particle> m_Particles = new List<Particle>();

	private void Start()
	{
		SetupParticles();
	}

	private void FixedUpdate()
	{
		if (m_UpdateMode == UpdateMode.AnimatePhysics)
		{
			PreUpdate();
		}
	}

	private void Update()
	{
		if (m_UpdateMode != UpdateMode.AnimatePhysics)
		{
			PreUpdate();
		}
	}

	private void LateUpdate()
	{
		if (m_DistantDisable)
		{
			CheckDistance();
		}
		if (m_Weight > 0f && (!m_DistantDisable || !m_DistantDisabled))
		{
			float t = ((m_UpdateMode != UpdateMode.UnscaledTime) ? Time.deltaTime : Time.unscaledDeltaTime);
			UpdateDynamicBones(t);
		}
	}

	private void PreUpdate()
	{
		if (m_Weight > 0f && (!m_DistantDisable || !m_DistantDisabled))
		{
			InitTransforms();
		}
	}

	private void CheckDistance()
	{
		//IL_003d: 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_0052: Unknown result type (might be due to invalid IL or missing references)
		Transform val = m_ReferenceObject;
		if ((Object)(object)val == (Object)null && (Object)(object)Camera.main != (Object)null)
		{
			val = ((Component)Camera.main).transform;
		}
		if (!((Object)(object)val != (Object)null))
		{
			return;
		}
		Vector3 val2 = val.position - ((Component)this).transform.position;
		float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
		bool flag = sqrMagnitude > m_DistanceToObject * m_DistanceToObject;
		if (flag != m_DistantDisabled)
		{
			if (!flag)
			{
				ResetParticlesPosition();
			}
			m_DistantDisabled = flag;
		}
	}

	private void OnEnable()
	{
		ResetParticlesPosition();
	}

	private void OnDisable()
	{
		InitTransforms();
	}

	private void OnValidate()
	{
		m_UpdateRate = Mathf.Max(m_UpdateRate, 0f);
		m_Damping = Mathf.Clamp01(m_Damping);
		m_Elasticity = Mathf.Clamp01(m_Elasticity);
		m_Stiffness = Mathf.Clamp01(m_Stiffness);
		m_Inert = Mathf.Clamp01(m_Inert);
		m_Friction = Mathf.Clamp01(m_Friction);
		m_Radius = Mathf.Max(m_Radius, 0f);
		if (Application.isEditor && Application.isPlaying)
		{
			InitTransforms();
			SetupParticles();
		}
	}

	private void OnDrawGizmosSelected()
	{
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		if (!((Behaviour)this).enabled || (Object)(object)m_Root == (Object)null)
		{
			return;
		}
		if (Application.isEditor && !Application.isPlaying && ((Component)this).transform.hasChanged)
		{
			InitTransforms();
			SetupParticles();
		}
		Gizmos.color = Color.white;
		for (int i = 0; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			if (particle.m_ParentIndex >= 0)
			{
				Particle particle2 = m_Particles[particle.m_ParentIndex];
				Gizmos.DrawLine(particle.m_Position, particle2.m_Position);
			}
			if (particle.m_Radius > 0f)
			{
				Gizmos.DrawWireSphere(particle.m_Position, particle.m_Radius * m_ObjectScale);
			}
		}
	}

	public void SetWeight(float w)
	{
		if (m_Weight != w)
		{
			if (w == 0f)
			{
				InitTransforms();
			}
			else if (m_Weight == 0f)
			{
				ResetParticlesPosition();
			}
			m_Weight = w;
		}
	}

	public float GetWeight()
	{
		return m_Weight;
	}

	private void UpdateDynamicBones(float t)
	{
		//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_003c: 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_004c: 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_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)
		if ((Object)(object)m_Root == (Object)null)
		{
			return;
		}
		m_ObjectScale = Mathf.Abs(((Component)this).transform.lossyScale.x);
		m_ObjectMove = ((Component)this).transform.position - m_ObjectPrevPosition;
		m_ObjectPrevPosition = ((Component)this).transform.position;
		int num = 1;
		if (m_UpdateRate > 0f)
		{
			float num2 = 1f / m_UpdateRate;
			m_Time += t;
			num = 0;
			while (m_Time >= num2)
			{
				m_Time -= num2;
				if (++num >= 3)
				{
					m_Time = 0f;
					break;
				}
			}
		}
		if (num > 0)
		{
			for (int i = 0; i < num; i++)
			{
				UpdateParticles1();
				UpdateParticles2();
				m_ObjectMove = Vector3.zero;
			}
		}
		else
		{
			SkipUpdateParticles();
		}
		ApplyParticlesToTransforms();
	}

	private void SetupParticles()
	{
		//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_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_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		m_Particles.Clear();
		if (!((Object)(object)m_Root == (Object)null))
		{
			m_LocalGravity = m_Root.InverseTransformDirection(m_Gravity);
			m_ObjectScale = Mathf.Abs(((Component)this).transform.lossyScale.x);
			m_ObjectPrevPosition = ((Component)this).transform.position;
			m_ObjectMove = Vector3.zero;
			m_BoneTotalLength = 0f;
			AppendParticles(m_Root, -1, 0f);
			UpdateParameters();
		}
	}

	private void AppendParticles(Transform b, int parentIndex, float boneLength)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: 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_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: 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_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: 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_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: 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_0282: 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_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		Particle particle = new Particle();
		particle.m_Transform = b;
		particle.m_ParentIndex = parentIndex;
		Vector3 val;
		if ((Object)(object)b != (Object)null)
		{
			val = (particle.m_Position = (particle.m_PrevPosition = b.position));
			particle.m_InitLocalPosition = b.localPosition;
			particle.m_InitLocalRotation = b.localRotation;
		}
		else
		{
			Transform transform = m_Particles[parentIndex].m_Transform;
			if (m_EndLength > 0f)
			{
				Transform parent = transform.parent;
				if ((Object)(object)parent != (Object)null)
				{
					particle.m_EndOffset = transform.InverseTransformPoint(transform.position * 2f - parent.position) * m_EndLength;
				}
				else
				{
					particle.m_EndOffset = new Vector3(m_EndLength, 0f, 0f);
				}
			}
			else
			{
				particle.m_EndOffset = transform.InverseTransformPoint(((Component)this).transform.TransformDirection(m_EndOffset) + transform.position);
			}
			val = (particle.m_Position = (particle.m_PrevPosition = transform.TransformPoint(particle.m_EndOffset)));
		}
		if (parentIndex >= 0)
		{
			float num = boneLength;
			val = m_Particles[parentIndex].m_Transform.position - particle.m_Position;
			boneLength = num + ((Vector3)(ref val)).magnitude;
			particle.m_BoneLength = boneLength;
			m_BoneTotalLength = Mathf.Max(m_BoneTotalLength, boneLength);
		}
		int count = m_Particles.Count;
		m_Particles.Add(particle);
		if (!((Object)(object)b != (Object)null))
		{
			return;
		}
		for (int i = 0; i < b.childCount; i++)
		{
			bool flag = false;
			if (m_Exclusions != null)
			{
				for (int j = 0; j < m_Exclusions.Count; j++)
				{
					Transform val2 = m_Exclusions[j];
					if ((Object)(object)val2 == (Object)(object)b.GetChild(i))
					{
						flag = true;
						break;
					}
				}
			}
			if (!flag)
			{
				AppendParticles(b.GetChild(i), count, boneLength);
			}
			else if (m_EndLength > 0f || m_EndOffset != Vector3.zero)
			{
				AppendParticles(null, count, boneLength);
			}
		}
		if (b.childCount == 0 && (m_EndLength > 0f || m_EndOffset != Vector3.zero))
		{
			AppendParticles(null, count, boneLength);
		}
	}

	public void UpdateParameters()
	{
		//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)
		if ((Object)(object)m_Root == (Object)null)
		{
			return;
		}
		m_LocalGravity = m_Root.InverseTransformDirection(m_Gravity);
		for (int i = 0; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			particle.m_Damping = m_Damping;
			particle.m_Elasticity = m_Elasticity;
			particle.m_Stiffness = m_Stiffness;
			particle.m_Inert = m_Inert;
			particle.m_Friction = m_Friction;
			particle.m_Radius = m_Radius;
			if (m_BoneTotalLength > 0f)
			{
				float num = particle.m_BoneLength / m_BoneTotalLength;
				if (m_DampingDistrib != null && m_DampingDistrib.keys.Length > 0)
				{
					particle.m_Damping *= m_DampingDistrib.Evaluate(num);
				}
				if (m_ElasticityDistrib != null && m_ElasticityDistrib.keys.Length > 0)
				{
					particle.m_Elasticity *= m_ElasticityDistrib.Evaluate(num);
				}
				if (m_StiffnessDistrib != null && m_StiffnessDistrib.keys.Length > 0)
				{
					particle.m_Stiffness *= m_StiffnessDistrib.Evaluate(num);
				}
				if (m_InertDistrib != null && m_InertDistrib.keys.Length > 0)
				{
					particle.m_Inert *= m_InertDistrib.Evaluate(num);
				}
				if (m_FrictionDistrib != null && m_FrictionDistrib.keys.Length > 0)
				{
					particle.m_Friction *= m_FrictionDistrib.Evaluate(num);
				}
				if (m_RadiusDistrib != null && m_RadiusDistrib.keys.Length > 0)
				{
					particle.m_Radius *= m_RadiusDistrib.Evaluate(num);
				}
			}
			particle.m_Damping = Mathf.Clamp01(particle.m_Damping);
			particle.m_Elasticity = Mathf.Clamp01(particle.m_Elasticity);
			particle.m_Stiffness = Mathf.Clamp01(particle.m_Stiffness);
			particle.m_Inert = Mathf.Clamp01(particle.m_Inert);
			particle.m_Friction = Mathf.Clamp01(particle.m_Friction);
			particle.m_Radius = Mathf.Max(particle.m_Radius, 0f);
		}
	}

	private void InitTransforms()
	{
		//IL_002f: 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)
		for (int i = 0; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			if ((Object)(object)particle.m_Transform != (Object)null)
			{
				particle.m_Transform.localPosition = particle.m_InitLocalPosition;
				particle.m_Transform.localRotation = particle.m_InitLocalRotation;
			}
		}
	}

	private void ResetParticlesPosition()
	{
		//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_0064: 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_006e: 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_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: 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_0036: 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_003d: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			if ((Object)(object)particle.m_Transform != (Object)null)
			{
				particle.m_Position = (particle.m_PrevPosition = particle.m_Transform.position);
			}
			else
			{
				Transform transform = m_Particles[particle.m_ParentIndex].m_Transform;
				particle.m_Position = (particle.m_PrevPosition = transform.TransformPoint(particle.m_EndOffset));
			}
			particle.m_isCollide = false;
		}
		m_ObjectPrevPosition = ((Component)this).transform.position;
	}

	private void UpdateParticles1()
	{
		//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_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_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: 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_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_003e: 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_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_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_0139: 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_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: 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_0092: 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_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: 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_00b8: 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_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: 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_011d: 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_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		Vector3 gravity = m_Gravity;
		Vector3 normalized = ((Vector3)(ref m_Gravity)).normalized;
		Vector3 val = m_Root.TransformDirection(m_LocalGravity);
		Vector3 val2 = normalized * Mathf.Max(Vector3.Dot(val, normalized), 0f);
		gravity -= val2;
		gravity = (gravity + m_Force) * m_ObjectScale;
		for (int i = 0; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			if (particle.m_ParentIndex >= 0)
			{
				Vector3 val3 = particle.m_Position - particle.m_PrevPosition;
				Vector3 val4 = m_ObjectMove * particle.m_Inert;
				particle.m_PrevPosition = particle.m_Position + val4;
				float num = particle.m_Damping;
				if (particle.m_isCollide)
				{
					num += particle.m_Friction;
					if (num > 1f)
					{
						num = 1f;
					}
					particle.m_isCollide = false;
				}
				particle.m_Position += val3 * (1f - num) + gravity + val4;
			}
			else
			{
				particle.m_PrevPosition = particle.m_Position;
				particle.m_Position = particle.m_Transform.position;
			}
		}
	}

	private void UpdateParticles2()
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: 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_0047: 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_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: 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_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: 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)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_030e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0313: Unknown result type (might be due to invalid IL or missing references)
		//IL_031d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0322: Unknown result type (might be due to invalid IL or missing references)
		//IL_0327: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: 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_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02de: 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_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
		Plane val = default(Plane);
		for (int i = 1; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			Particle particle2 = m_Particles[particle.m_ParentIndex];
			float magnitude;
			if ((Object)(object)particle.m_Transform != (Object)null)
			{
				Vector3 val2 = particle2.m_Transform.position - particle.m_Transform.position;
				magnitude = ((Vector3)(ref val2)).magnitude;
			}
			else
			{
				Matrix4x4 localToWorldMatrix = particle2.m_Transform.localToWorldMatrix;
				Vector3 val3 = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyVector(particle.m_EndOffset);
				magnitude = ((Vector3)(ref val3)).magnitude;
			}
			float num = Mathf.Lerp(1f, particle.m_Stiffness, m_Weight);
			if (num > 0f || particle.m_Elasticity > 0f)
			{
				Matrix4x4 localToWorldMatrix2 = particle2.m_Transform.localToWorldMatrix;
				((Matrix4x4)(ref localToWorldMatrix2)).SetColumn(3, Vector4.op_Implicit(particle2.m_Position));
				Vector3 val4 = ((!((Object)(object)particle.m_Transform != (Object)null)) ? ((Matrix4x4)(ref localToWorldMatrix2)).MultiplyPoint3x4(particle.m_EndOffset) : ((Matrix4x4)(ref localToWorldMatrix2)).MultiplyPoint3x4(particle.m_Transform.localPosition));
				Vector3 val5 = val4 - particle.m_Position;
				particle.m_Position += val5 * particle.m_Elasticity;
				if (num > 0f)
				{
					val5 = val4 - particle.m_Position;
					float magnitude2 = ((Vector3)(ref val5)).magnitude;
					float num2 = magnitude * (1f - num) * 2f;
					if (magnitude2 > num2)
					{
						particle.m_Position += val5 * ((magnitude2 - num2) / magnitude2);
					}
				}
			}
			if (m_Colliders != null)
			{
				float particleRadius = particle.m_Radius * m_ObjectScale;
				for (int j = 0; j < m_Colliders.Count; j++)
				{
					DynamicBoneColliderBase dynamicBoneColliderBase = m_Colliders[j];
					if ((Object)(object)dynamicBoneColliderBase != (Object)null && ((Behaviour)dynamicBoneColliderBase).enabled)
					{
						particle.m_isCollide |= dynamicBoneColliderBase.Collide(ref particle.m_Position, particleRadius);
					}
				}
			}
			if (m_FreezeAxis != FreezeAxis.None)
			{
				switch (m_FreezeAxis)
				{
				case FreezeAxis.X:
					((Plane)(ref val)).SetNormalAndPosition(particle2.m_Transform.right, particle2.m_Position);
					break;
				case FreezeAxis.Y:
					((Plane)(ref val)).SetNormalAndPosition(particle2.m_Transform.up, particle2.m_Position);
					break;
				case FreezeAxis.Z:
					((Plane)(ref val)).SetNormalAndPosition(particle2.m_Transform.forward, particle2.m_Position);
					break;
				}
				particle.m_Position -= ((Plane)(ref val)).normal * ((Plane)(ref val)).GetDistanceToPoint(particle.m_Position);
			}
			Vector3 val6 = particle2.m_Position - particle.m_Position;
			float magnitude3 = ((Vector3)(ref val6)).magnitude;
			if (magnitude3 > 0f)
			{
				particle.m_Position += val6 * ((magnitude3 - magnitude) / magnitude3);
			}
		}
	}

	private void SkipUpdateParticles()
	{
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_003c: 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_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: 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_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//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_00f8: 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_01be: 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_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: 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_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: 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_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			if (particle.m_ParentIndex >= 0)
			{
				particle.m_PrevPosition += m_ObjectMove;
				particle.m_Position += m_ObjectMove;
				Particle particle2 = m_Particles[particle.m_ParentIndex];
				float magnitude;
				if ((Object)(object)particle.m_Transform != (Object)null)
				{
					Vector3 val = particle2.m_Transform.position - particle.m_Transform.position;
					magnitude = ((Vector3)(ref val)).magnitude;
				}
				else
				{
					Matrix4x4 localToWorldMatrix = particle2.m_Transform.localToWorldMatrix;
					Vector3 val2 = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyVector(particle.m_EndOffset);
					magnitude = ((Vector3)(ref val2)).magnitude;
				}
				float num = Mathf.Lerp(1f, particle.m_Stiffness, m_Weight);
				if (num > 0f)
				{
					Matrix4x4 localToWorldMatrix2 = particle2.m_Transform.localToWorldMatrix;
					((Matrix4x4)(ref localToWorldMatrix2)).SetColumn(3, Vector4.op_Implicit(particle2.m_Position));
					Vector3 val3 = ((!((Object)(object)particle.m_Transform != (Object)null)) ? ((Matrix4x4)(ref localToWorldMatrix2)).MultiplyPoint3x4(particle.m_EndOffset) : ((Matrix4x4)(ref localToWorldMatrix2)).MultiplyPoint3x4(particle.m_Transform.localPosition));
					Vector3 val4 = val3 - particle.m_Position;
					float magnitude2 = ((Vector3)(ref val4)).magnitude;
					float num2 = magnitude * (1f - num) * 2f;
					if (magnitude2 > num2)
					{
						particle.m_Position += val4 * ((magnitude2 - num2) / magnitude2);
					}
				}
				Vector3 val5 = particle2.m_Position - particle.m_Position;
				float magnitude3 = ((Vector3)(ref val5)).magnitude;
				if (magnitude3 > 0f)
				{
					particle.m_Position += val5 * ((magnitude3 - magnitude) / magnitude3);
				}
			}
			else
			{
				particle.m_PrevPosition = particle.m_Position;
				particle.m_Position = particle.m_Transform.position;
			}
		}
	}

	private static Vector3 MirrorVector(Vector3 v, Vector3 axis)
	{
		//IL_0001: 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_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: 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_0020: Unknown result type (might be due to invalid IL or missing references)
		return v - axis * (Vector3.Dot(v, axis) * 2f);
	}

	private void ApplyParticlesToTransforms()
	{
		//IL_00c1: 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_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_0064: 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_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_0091: 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)
		for (int i = 1; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			Particle particle2 = m_Particles[particle.m_ParentIndex];
			if (particle2.m_Transform.childCount <= 1)
			{
				Vector3 val = ((!((Object)(object)particle.m_Transform != (Object)null)) ? particle.m_EndOffset : particle.m_Transform.localPosition);
				Vector3 val2 = particle.m_Position - particle2.m_Position;
				Quaternion val3 = Quaternion.FromToRotation(particle2.m_Transform.TransformDirection(val), val2);
				particle2.m_Transform.rotation = val3 * particle2.m_Transform.rotation;
			}
			if ((Object)(object)particle.m_Transform != (Object)null)
			{
				particle.m_Transform.position = particle.m_Position;
			}
		}
	}
}
[AddComponentMenu("Dynamic Bone/Dynamic Bone Collider")]
public class DynamicBoneCollider : DynamicBoneColliderBase
{
	[Tooltip("The radius of the sphere or capsule.")]
	public float m_Radius = 0.5f;

	[Tooltip("The height of the capsule.")]
	public float m_Height = 0f;

	private void OnValidate()
	{
		m_Radius = Mathf.Max(m_Radius, 0f);
		m_Height = Mathf.Max(m_Height, 0f);
	}

	public override bool Collide(ref Vector3 particlePosition, float particleRadius)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: 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_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_0074: 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_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_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: 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_0172: 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_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		float num = m_Radius * Mathf.Abs(((Component)this).transform.lossyScale.x);
		float num2 = m_Height * 0.5f - m_Radius;
		if (num2 <= 0f)
		{
			if (m_Bound == Bound.Outside)
			{
				return OutsideSphere(ref particlePosition, particleRadius, ((Component)this).transform.TransformPoint(m_Center), num);
			}
			return InsideSphere(ref particlePosition, particleRadius, ((Component)this).transform.TransformPoint(m_Center), num);
		}
		Vector3 center = m_Center;
		Vector3 center2 = m_Center;
		switch (m_Direction)
		{
		case Direction.X:
			center.x -= num2;
			center2.x += num2;
			break;
		case Direction.Y:
			center.y -= num2;
			center2.y += num2;
			break;
		case Direction.Z:
			center.z -= num2;
			center2.z += num2;
			break;
		}
		if (m_Bound == Bound.Outside)
		{
			return OutsideCapsule(ref particlePosition, particleRadius, ((Component)this).transform.TransformPoint(center), ((Component)this).transform.TransformPoint(center2), num);
		}
		return InsideCapsule(ref particlePosition, particleRadius, ((Component)this).transform.TransformPoint(center), ((Component)this).transform.TransformPoint(center2), num);
	}

	private static bool OutsideSphere(ref Vector3 particlePosition, float particleRadius, Vector3 sphereCenter, float sphereRadius)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: U