Decompiled source of Pulverizer v1.0.0

Pulverizer.dll

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

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace ShermanJumbo
{
	public class CannonballSecondaryRenderer : MonoBehaviour
	{
		public Renderer Rend;

		public CannonBall Cannonball;

		private void Update()
		{
			if (Cannonball.TurnsOffRends && !Cannonball.hasTurnedOffRends)
			{
				Rend.enabled = false;
			}
		}
	}
	public class ChamberDependentParticlesAndSounds : MonoBehaviour
	{
		public FVRFireArmChamber ChamberToRead;

		public ParticleSystem ParticlesToEnable;

		public AudioSource SoundsToEnable;

		private void Update()
		{
			if (ChamberToRead.IsFull)
			{
				if (!ParticlesToEnable.isPlaying)
				{
					ParticlesToEnable.Play();
				}
				if (!SoundsToEnable.isPlaying)
				{
					SoundsToEnable.Play();
				}
			}
			else
			{
				ParticlesToEnable.Stop();
				SoundsToEnable.Stop();
			}
		}
	}
	public class FirearmSpinnyBarrels : MonoBehaviour
	{
		public FVRFireArm Gun;

		public GameObject SpinningBarrels;

		public float SpinRate;

		public dirType DirectionOfSpin;

		public float DecelerationRate = 0.5f;

		public float TriggerDeadzone = 0.01f;

		private float currentSpinSpeed = 0f;

		private bool TriggerPulled = false;

		public AudioSource SpinnySounds;

		public float SpinnySoundsVolume = 0.4f;

		private void Awake()
		{
			SpinnySounds.volume = 0f;
		}

		private void Update()
		{
			//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_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Expected I4, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)SpinnySounds != (Object)null)
			{
				SpinnySounds.volume = currentSpinSpeed / SpinRate * SpinnySoundsVolume;
			}
			if ((Object)(object)Gun != (Object)null && (Object)(object)((FVRInteractiveObject)Gun).m_hand != (Object)null)
			{
				float triggerFloat = ((FVRInteractiveObject)Gun).m_hand.Input.TriggerFloat;
				if (triggerFloat >= TriggerDeadzone)
				{
					if (!TriggerPulled)
					{
						TriggerPulled = true;
					}
					currentSpinSpeed = SpinRate;
				}
				else if (TriggerPulled)
				{
					TriggerPulled = false;
				}
			}
			if (!TriggerPulled && currentSpinSpeed > 0f)
			{
				currentSpinSpeed -= DecelerationRate * Time.deltaTime;
				if (currentSpinSpeed < 0f)
				{
					currentSpinSpeed = 0f;
				}
			}
			if (currentSpinSpeed > 0f && (Object)(object)SpinningBarrels != (Object)null)
			{
				Vector3 zero = Vector3.zero;
				int num = (int)DirectionOfSpin;
				if (num >= 0 && num <= 2)
				{
					((Vector3)(ref zero))[num] = currentSpinSpeed * Time.deltaTime;
					SpinningBarrels.transform.Rotate(zero);
				}
				else
				{
					Debug.LogWarning((object)"Invalid DirectionOfSpin value!");
				}
			}
		}
	}
	public class LAPDLaserAsAttachment : MonoBehaviour
	{
		public LAPD2019Laser Laser;

		private void Awake()
		{
			Laser.m_isOn = true;
		}
	}
}
namespace ShermanJumbo.Pulverizer
{
	[BepInPlugin("ShermanJumbo.Pulverizer", "Pulverizer", "1.0.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class PulverizerPlugin : 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(), "ShermanJumbo.Pulverizer");
			OtherLoader.RegisterDirectLoad(BasePath, "ShermanJumbo.Pulverizer", "", "", "shermanjumbo_pulverizer", "");
		}
	}
}
namespace ShermanJumbo
{
	public class GR8RecoillessRifle : FVRFireArm
	{
		public FVRFireArmChamber Chamber;

		public GR8ShellInsertEject ShellInsertEject;

		public GR8TailLatch TailLatch;

		private float m_curZ;

		private float m_tarZ;

		public float ZThreshold = 0.01f;

		public Transform Trigger;

		public float TriggerFiringThreshold = 0.8f;

		public float TriggerResetThreshold = 0.4f;

		public float Trigger_ForwardValue;

		public float Trigger_RearwardValue;

		private float m_triggerFloat;

		private float m_lastTriggerFloat;

		private bool m_hasTriggerReset;

		public AudioEvent AudEvent_BackSound;

		public Transform COM;

		public override void Awake()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			((FVRFireArm)this).Awake();
			base.FChambers.Add(Chamber);
			((FVRPhysicalObject)this).RootRigidbody.centerOfMass = COM.localPosition;
		}

		public void FixCOM()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			((FVRPhysicalObject)this).RootRigidbody.centerOfMass = COM.localPosition;
		}

		public override void FVRUpdate()
		{
			((FVRFireArm)this).FVRUpdate();
			if (TailLatch.LState == GR8TailLatch.CGLatchState.Open)
			{
				Chamber.IsAccessible = true;
			}
			else
			{
				Chamber.IsAccessible = false;
			}
			if (Mathf.Abs(m_triggerFloat - m_lastTriggerFloat) > 0.0001f)
			{
				m_lastTriggerFloat = m_triggerFloat;
				((FVRPhysicalObject)this).SetAnimatedComponent(Trigger, Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat), (InterpStyle)1, (Axis)0);
			}
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			((FVRPhysicalObject)this).UpdateInteraction(hand);
			if (((FVRPhysicalObject)this).IsAltHeld)
			{
				m_triggerFloat = 0f;
				return;
			}
			if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin)
			{
				m_triggerFloat = hand.Input.TriggerFloat;
			}
			else
			{
				m_triggerFloat = 0f;
			}
			if (!m_hasTriggerReset && m_triggerFloat <= TriggerResetThreshold)
			{
				m_hasTriggerReset = true;
				((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)16, 1f);
			}
			if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && m_triggerFloat >= TriggerFiringThreshold && TailLatch.LState == GR8TailLatch.CGLatchState.Closed && m_hasTriggerReset)
			{
				m_hasTriggerReset = false;
				TryToFire();
			}
		}

		private void TryToFire()
		{
			//IL_0034: 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)
			((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
			if (Chamber.Fire())
			{
				((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
				((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f);
				((FVRFireArm)this).FireMuzzleSmoke();
				SM.PlayCoreSound((FVRPooledAudioType)5, AudEvent_BackSound, ((Component)TailLatch).transform.position);
				bool flag = ((FVRFireArm)this).IsTwoHandStabilized();
				bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null;
				bool flag3 = ((FVRFireArm)this).IsShoulderStabilized();
				((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f);
			}
		}
	}
	public class GR8ShellInsertEject : FVRInteractiveObject
	{
		public enum ChamberSlideState
		{
			In,
			Middle,
			Out
		}

		public GR8RecoillessRifle CG;

		public AudioEvent AudEvent_ShellInStart;

		public AudioEvent AudEvent_ShellIn;

		public AudioEvent AudEvent_ShellOutStart;

		public AudioEvent AudEvent_ShellOut;

		public Transform ChamberPoint_Back;

		public Transform ChamberPoint_Forward;

		public Collider Col;

		public ChamberSlideState CSState = ChamberSlideState.Out;

		private float m_curZ;

		private float m_tarZ;

		public float ZThreshold = 0.02f;

		private float m_timeHeld;

		public override void Awake()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).Awake();
			m_curZ = ChamberPoint_Back.localPosition.z;
			m_tarZ = m_curZ;
		}

		public override bool IsInteractable()
		{
			return CG.Chamber.IsFull && CG.TailLatch.LState == GR8TailLatch.CGLatchState.Open;
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).UpdateInteraction(hand);
			float tarZ = Mathf.Clamp(((Component)CG).transform.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos).z, ChamberPoint_Back.localPosition.z, ChamberPoint_Forward.localPosition.z);
			m_tarZ = tarZ;
		}

		public override void EndInteraction(FVRViveHand hand)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			((FVRInteractiveObject)this).EndInteraction(hand);
			float num = Mathf.Abs(m_curZ - ChamberPoint_Back.localPosition.z);
			float num2 = Mathf.Abs(m_curZ - ChamberPoint_Forward.localPosition.z);
			if (num < ZThreshold * 2f)
			{
				m_tarZ = ChamberPoint_Back.localPosition.z;
			}
			else if (num2 < ZThreshold * 2f)
			{
				m_tarZ = ChamberPoint_Forward.localPosition.z;
			}
		}

		public override void BeginInteraction(FVRViveHand hand)
		{
			((FVRInteractiveObject)this).BeginInteraction(hand);
			m_timeHeld = 0f;
		}

		public override void FVRUpdate()
		{
			//IL_0078: 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_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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: 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_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).FVRUpdate();
			m_timeHeld += Time.deltaTime;
			if (!(Mathf.Abs(m_curZ - m_tarZ) > 0.001f))
			{
				return;
			}
			m_curZ = Mathf.MoveTowards(m_curZ, m_tarZ, Time.deltaTime * 1f);
			((Component)CG.Chamber).transform.localPosition = new Vector3(((Component)CG.Chamber).transform.localPosition.x, ((Component)CG.Chamber).transform.localPosition.y, m_curZ);
			float num = Mathf.Abs(m_curZ - ChamberPoint_Back.localPosition.z);
			float num2 = Mathf.Abs(m_curZ - ChamberPoint_Forward.localPosition.z);
			ChamberSlideState cSState = CSState;
			if (num < ZThreshold)
			{
				CSState = ChamberSlideState.Out;
			}
			else if (num2 < ZThreshold)
			{
				CSState = ChamberSlideState.In;
			}
			else
			{
				CSState = ChamberSlideState.Middle;
			}
			if (CSState == ChamberSlideState.Out && cSState != ChamberSlideState.Out)
			{
				((FVRFireArm)CG).PlayAudioAsHandling(AudEvent_ShellOut, ((Component)this).transform.position);
				if (m_timeHeld > 0.2f)
				{
					FVRFireArmRound val = CG.Chamber.EjectRound(((Component)ChamberPoint_Back).transform.position, ChamberPoint_Back.forward * 0.1f, Vector3.zero, false);
					if (((FVRInteractiveObject)this).IsHeld)
					{
						FVRViveHand hand = base.m_hand;
						hand.ForceSetInteractable((FVRInteractiveObject)(object)val);
						((FVRInteractiveObject)val).BeginInteraction(hand);
					}
					CG.FixCOM();
				}
			}
			else if (CSState == ChamberSlideState.In && cSState != 0)
			{
				((FVRFireArm)CG).PlayAudioAsHandling(AudEvent_ShellIn, ((Component)this).transform.position);
				((FVRInteractiveObject)this).ForceBreakInteraction();
				CG.FixCOM();
			}
			else if (CSState == ChamberSlideState.Middle && cSState == ChamberSlideState.In)
			{
				((FVRFireArm)CG).PlayAudioAsHandling(AudEvent_ShellOutStart, ((Component)this).transform.position);
			}
			else if (CSState == ChamberSlideState.Middle && cSState == ChamberSlideState.Out)
			{
				((FVRFireArm)CG).PlayAudioAsHandling(AudEvent_ShellInStart, ((Component)this).transform.position);
			}
		}
	}
	public class GR8TailLatch : FVRInteractiveObject
	{
		public enum CGLatchType
		{
			Main,
			Lock
		}

		public enum CGLatchState
		{
			Closed,
			Middle,
			Open
		}

		public GR8RecoillessRifle CG;

		public CGLatchType LType;

		public CGLatchState LState;

		public float RotMin;

		public float RotMax;

		public bool IsMinOpen;

		public AudioEvent AudEvent_Open;

		public AudioEvent AudEvent_Close;

		public Transform BaseZeroDir;

		private float m_curRot;

		private float m_tarRot;

		public bool DisablesUseWhenNotInGivenState = true;

		public GR8TailLatch RestrictingLatch;

		public CGLatchState RequiredState = CGLatchState.Open;

		public bool DoesPartialChamberingBlock;

		public bool IsOpen()
		{
			return LState == CGLatchState.Open;
		}

		public override bool IsInteractable()
		{
			return (!DoesPartialChamberingBlock || !CG.Chamber.IsFull || CG.ShellInsertEject.CSState == GR8ShellInsertEject.ChamberSlideState.In) && (!DisablesUseWhenNotInGivenState || RestrictingLatch.LState == RequiredState) && ((FVRInteractiveObject)this).IsInteractable();
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).UpdateInteraction(hand);
			Vector3 val = ((HandInput)(ref hand.Input)).Pos - ((Component)this).transform.position;
			val = Vector3.ProjectOnPlane(val, BaseZeroDir.up);
			float signedAngle = GetSignedAngle(val, BaseZeroDir.forward, BaseZeroDir.up);
			signedAngle = Mathf.Clamp(signedAngle, RotMin, RotMax);
			m_tarRot = signedAngle;
		}

		public override void EndInteraction(FVRViveHand hand)
		{
			((FVRInteractiveObject)this).EndInteraction(hand);
			float num = Mathf.Abs(m_curRot - RotMin);
			float num2 = Mathf.Abs(m_curRot - RotMax);
			if (num < num2)
			{
				m_tarRot = RotMin;
			}
			else
			{
				m_tarRot = RotMax;
			}
		}

		public override void FVRUpdate()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			((FVRInteractiveObject)this).FVRUpdate();
			if (!(Mathf.Abs(m_curRot - m_tarRot) > 0.001f))
			{
				return;
			}
			m_curRot = Mathf.MoveTowards(m_curRot, m_tarRot, Time.deltaTime * 900f);
			((Component)this).transform.localEulerAngles = new Vector3(0f, m_curRot, 0f);
			float num = Mathf.Abs(m_curRot - RotMin);
			float num2 = Mathf.Abs(m_curRot - RotMax);
			CGLatchState lState = LState;
			if (num < 1f)
			{
				if (IsMinOpen)
				{
					LState = CGLatchState.Open;
				}
				else
				{
					LState = CGLatchState.Closed;
				}
			}
			else if (num2 < 1f)
			{
				if (IsMinOpen)
				{
					LState = CGLatchState.Closed;
				}
				else
				{
					LState = CGLatchState.Open;
				}
			}
			else
			{
				LState = CGLatchState.Middle;
			}
			if (LState == CGLatchState.Closed && lState != 0)
			{
				((FVRFireArm)CG).PlayAudioAsHandling(AudEvent_Close, ((Component)this).transform.position);
			}
			else if (LState == CGLatchState.Open && lState != CGLatchState.Open)
			{
				((FVRFireArm)CG).PlayAudioAsHandling(AudEvent_Open, ((Component)this).transform.position);
			}
		}

		public float GetSignedAngle(Vector3 from, Vector3 to, 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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_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)
			Vector3 val = Vector3.ProjectOnPlane(from, axis);
			from = ((Vector3)(ref val)).normalized;
			Vector3 val2 = Vector3.Cross(axis, to);
			float num = Mathf.Sign(Vector3.Dot(from, val2));
			float num2 = Vector3.Angle(from, to);
			return num2 * num;
		}
	}
	public class Pulverizer : FVRFireArm
	{
		public enum ShotgunMode
		{
			PumpMode,
			Automatic
		}

		[Header("Shotgun Params")]
		public PulverizerBolt Bolt;

		public PulverizerHandle Handle;

		public FVRFireArmChamber Chamber;

		public bool HasHandle;

		[Header("Component Connections")]
		public Transform Safety;

		public GameObject ReloadTriggerWell;

		[Header("Carrier System")]
		public bool UsesAnimatedCarrier;

		public Transform Carrier;

		public Vector2 CarrierRots;

		public Transform CarrierComparePoint1;

		public Transform CarrierComparePoint2;

		public float CarrierDetectDistance;

		private float m_curCarrierRot;

		private float m_tarCarrierRot;

		[Header("Round Positions")]
		public Transform RoundPos_LowerPath_Forward;

		public Transform RoundPos_LowerPath_Rearward;

		public Transform RoundPos_UpperPath_Forward;

		public Transform RoundPos_UpperPath_Rearward;

		public Transform RoundPos_Ejecting;

		public Transform RoundPos_Ejection;

		public Vector3 RoundEjectionSpeed;

		public Vector3 RoundEjectionSpin;

		private FVRFirearmMovingProxyRound m_proxy;

		private bool m_isExtractedRoundOnLowerPath = true;

		[Header("Safety Params")]
		public bool HasSafety;

		public InterpStyle Safety_Interp;

		public Axis SafetyAxis;

		public float SafetyOff;

		public float SafetyOn;

		private bool m_isSafetyEngaged = true;

		private bool m_isHammerCocked;

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

		[HideInInspector]
		public bool IsSlideReleaseButtonHeld;

		[Header("Pulverizer Params")]
		public Collider HammerCol;

		public float ColThresh = 1f;

		[Header("Mode Params")]
		public bool CanModeSwitch;

		public ShotgunMode Mode;

		private bool m_isChamberRoundOnExtractor;

		public bool IsSafetyEngaged => m_isSafetyEngaged;

		public bool IsHammerCocked => m_isHammerCocked;

		public bool HasExtractedRound()
		{
			return m_proxy.IsFull;
		}

		public override void Awake()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			((FVRFireArm)this).Awake();
			base.FChambers.Add(Chamber);
			if (Mode == ShotgunMode.Automatic)
			{
				if (HasHandle)
				{
					Handle.LockHandle();
				}
			}
			else if (HasHandle)
			{
				Handle.UnlockHandle();
			}
			if (!HasSafety)
			{
				m_isSafetyEngaged = false;
			}
			GameObject val = new GameObject("m_proxyRound");
			m_proxy = val.AddComponent<FVRFirearmMovingProxyRound>();
			m_proxy.Init(((Component)this).transform);
		}

		public override int GetTutorialState()
		{
			if (m_isSafetyEngaged)
			{
				return 2;
			}
			if (Chamber.IsFull && !Chamber.IsSpent)
			{
				return 3;
			}
			if ((Object)(object)base.Magazine == (Object)null || !base.Magazine.HasARound())
			{
				return 0;
			}
			return 1;
		}

		public void BoltReleasePressed()
		{
			if (Mode == ShotgunMode.Automatic)
			{
				Bolt.ReleaseBolt();
			}
		}

		public bool CanCycleMagState()
		{
			return Handle.CurPos == PulverizerHandle.BoltPos.Forward && !HasExtractedRound();
		}

		public void ToggleSafety()
		{
			if (HasSafety)
			{
				m_isSafetyEngaged = !m_isSafetyEngaged;
				((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)14, 1f);
				UpdateSafetyGeo();
			}
		}

		private void UpdateSafetyGeo()
		{
			//IL_002c: 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)
			float num = ((!m_isSafetyEngaged) ? SafetyOff : SafetyOn);
			((FVRPhysicalObject)this).SetAnimatedComponent(Safety, num, Safety_Interp, SafetyAxis);
		}

		public void EjectExtractedRound()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_007c: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00c7: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			if (m_isChamberRoundOnExtractor)
			{
				m_isChamberRoundOnExtractor = false;
				if (Chamber.IsFull)
				{
					Chamber.EjectRound(RoundPos_Ejection.position, ((Component)this).transform.right * RoundEjectionSpeed.x + ((Component)this).transform.up * RoundEjectionSpeed.y + ((Component)this).transform.forward * RoundEjectionSpeed.z, ((Component)this).transform.right * RoundEjectionSpin.x + ((Component)this).transform.up * RoundEjectionSpin.y + ((Component)this).transform.forward * RoundEjectionSpin.z, RoundPos_Ejection.position, RoundPos_Ejection.rotation, false);
				}
			}
		}

		public void ExtractRound()
		{
			if (!((Object)(object)base.Magazine == (Object)null) && !m_proxy.IsFull && !m_proxy.IsFull && base.Magazine.HasARound())
			{
				GameObject fromPrefabReference = base.Magazine.RemoveRound(false);
				m_proxy.SetFromPrefabReference(fromPrefabReference);
				m_isExtractedRoundOnLowerPath = true;
			}
		}

		public bool ChamberRound()
		{
			if (Chamber.IsFull)
			{
				m_isChamberRoundOnExtractor = true;
			}
			if (m_proxy.IsFull && !Chamber.IsFull && !m_isExtractedRoundOnLowerPath)
			{
				m_isChamberRoundOnExtractor = true;
				Chamber.SetRound(m_proxy.Round, false);
				m_proxy.ClearProxy();
				return true;
			}
			return false;
		}

		public bool ReturnCarrierRoundToMagazineIfRelevant()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if (m_proxy.IsFull && m_isExtractedRoundOnLowerPath)
			{
				base.Magazine.AddRound(m_proxy.Round.RoundClass, false, true);
				m_proxy.ClearProxy();
				return true;
			}
			return false;
		}

		public void TransferShellToUpperTrack()
		{
			if (m_proxy.IsFull && m_isExtractedRoundOnLowerPath && !Chamber.IsFull)
			{
				m_isExtractedRoundOnLowerPath = false;
			}
		}

		public void ToggleMode()
		{
			if (Bolt.CurPos != 0)
			{
				Debug.Log((object)"not forward");
				return;
			}
			if (HasHandle && Handle.CurPos != 0)
			{
				Debug.Log((object)"not forward");
				return;
			}
			if (m_isHammerCocked)
			{
				Debug.Log((object)"hammer cocked");
				return;
			}
			((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f);
			if (Mode == ShotgunMode.PumpMode)
			{
				Mode = ShotgunMode.Automatic;
				if (HasHandle)
				{
					Handle.LockHandle();
				}
			}
			else
			{
				Mode = ShotgunMode.PumpMode;
				if (HasHandle)
				{
					Handle.UnlockHandle();
				}
			}
		}

		public void CockHammer()
		{
			if (!m_isHammerCocked)
			{
				m_isHammerCocked = true;
				((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
			}
		}

		public void ReleaseHammer()
		{
			if (m_isHammerCocked && Bolt.CurPos == PulverizerBolt.BoltPos.Forward)
			{
				((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
				Fire();
				m_isHammerCocked = false;
				if (HasHandle && Mode == ShotgunMode.PumpMode)
				{
					Handle.UnlockHandle();
				}
			}
		}

		public bool Fire()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			if (!Chamber.Fire())
			{
				return false;
			}
			((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f);
			((FVRFireArm)this).FireMuzzleSmoke();
			bool flag = ((FVRFireArm)this).IsTwoHandStabilized();
			bool flag2 = ((FVRFireArm)this).IsForegripStabilized();
			bool flag3 = ((FVRFireArm)this).IsShoulderStabilized();
			((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f);
			((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
			if (Mode == ShotgunMode.Automatic && Chamber.GetRound().IsHighPressure && !Bolt.UsesLateralLocking)
			{
				Bolt.ImpartFiringImpulse();
			}
			return true;
		}

		public override void FVRUpdate()
		{
			((FVRFireArm)this).FVRUpdate();
			UpdateCarrier();
			if (HasHandle)
			{
				Handle.UpdateHandle();
				bool state = false;
				if ((((FVRInteractiveObject)Handle).IsHeld || ((FVRPhysicalObject)this).IsAltHeld) && Mode == ShotgunMode.PumpMode)
				{
					state = true;
				}
				Bolt.UpdateHandleHeldState(state, 1f - Handle.GetBoltLerpBetweenRearAndFore());
			}
			Bolt.UpdateBolt();
			UpdateDisplayRoundPositions();
			if (HasExtractedRound() && m_isExtractedRoundOnLowerPath)
			{
				if ((Object)(object)base.Magazine != (Object)null)
				{
					base.Magazine.IsDropInLoadable = false;
				}
			}
			else if ((Object)(object)base.Magazine != (Object)null)
			{
				base.Magazine.IsDropInLoadable = true;
			}
		}

		private void UpdateCarrier()
		{
			//IL_0065: 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_007c: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			if (!UsesAnimatedCarrier)
			{
				return;
			}
			if (((FVRInteractiveObject)this).IsHeld)
			{
				if ((Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable != (Object)null)
				{
					if (((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable is FVRFireArmRound)
					{
						float num = Vector3.Distance(((Component)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).transform.position, ((FVRInteractiveObject)this).GetClosestValidPoint(CarrierComparePoint1.position, CarrierComparePoint2.position, ((Component)((FVRInteractiveObject)this).m_hand.OtherHand.CurrentInteractable).transform.position));
						if (num < CarrierDetectDistance)
						{
							m_tarCarrierRot = CarrierRots.y;
						}
						else
						{
							m_tarCarrierRot = CarrierRots.x;
						}
					}
					else
					{
						m_tarCarrierRot = CarrierRots.x;
					}
				}
				else
				{
					m_tarCarrierRot = CarrierRots.x;
				}
			}
			else
			{
				m_tarCarrierRot = CarrierRots.x;
			}
			if (HasExtractedRound() && !m_isExtractedRoundOnLowerPath)
			{
				m_tarCarrierRot = CarrierRots.y;
			}
			if (Mathf.Abs(m_curCarrierRot - m_tarCarrierRot) > 0.001f)
			{
				m_curCarrierRot = Mathf.MoveTowards(m_curCarrierRot, m_tarCarrierRot, 270f * Time.deltaTime);
				Carrier.localEulerAngles = new Vector3(m_curCarrierRot, 0f, 0f);
			}
		}

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

		private void UpdateInputAndAnimate(FVRViveHand hand)
		{
			IsSlideReleaseButtonHeld = false;
			if (!((FVRPhysicalObject)this).IsAltHeld)
			{
			}
		}

		private void UpdateDisplayRoundPositions()
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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)
			//IL_006c: 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_0082: 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_011e: 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_013f: 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_0150: 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_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: 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_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			float boltLerpBetweenLockAndFore = Bolt.GetBoltLerpBetweenLockAndFore();
			if (Chamber.IsFull)
			{
				if (m_isChamberRoundOnExtractor)
				{
					Chamber.ProxyRound.position = Vector3.Lerp(RoundPos_Ejecting.position, ((Component)Chamber).transform.position, boltLerpBetweenLockAndFore);
					Chamber.ProxyRound.rotation = Quaternion.Slerp(RoundPos_Ejecting.rotation, ((Component)Chamber).transform.rotation, boltLerpBetweenLockAndFore);
				}
				else
				{
					Chamber.ProxyRound.position = ((Component)Chamber).transform.position;
					Chamber.ProxyRound.rotation = ((Component)Chamber).transform.rotation;
				}
			}
			if (m_proxy.IsFull)
			{
				if (m_isExtractedRoundOnLowerPath || Chamber.IsFull)
				{
					m_proxy.ProxyRound.position = Vector3.Lerp(RoundPos_LowerPath_Rearward.position, RoundPos_LowerPath_Forward.position, boltLerpBetweenLockAndFore);
					m_proxy.ProxyRound.rotation = Quaternion.Slerp(RoundPos_LowerPath_Rearward.rotation, RoundPos_LowerPath_Forward.rotation, boltLerpBetweenLockAndFore);
				}
				else
				{
					m_proxy.ProxyRound.position = Vector3.Lerp(RoundPos_UpperPath_Rearward.position, RoundPos_UpperPath_Forward.position, boltLerpBetweenLockAndFore);
					m_proxy.ProxyRound.rotation = Quaternion.Slerp(RoundPos_UpperPath_Rearward.rotation, RoundPos_UpperPath_Forward.rotation, boltLerpBetweenLockAndFore);
				}
			}
		}

		public override List<FireArmRoundClass> GetChamberRoundList()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (Chamber.IsFull && !Chamber.IsSpent)
			{
				List<FireArmRoundClass> list = new List<FireArmRoundClass>();
				list.Add(Chamber.GetRound().RoundClass);
				return list;
			}
			return null;
		}

		public override void SetLoadedChambers(List<FireArmRoundClass> rounds)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (rounds.Count > 0)
			{
				Chamber.Autochamber(rounds[0]);
			}
		}

		public override void ConfigureFromFlagDic(Dictionary<string, string> f)
		{
			string empty = string.Empty;
			string empty2 = string.Empty;
			empty = "HammerState";
			if (f.ContainsKey(empty))
			{
				empty2 = f[empty];
				if (empty2 == "Cocked")
				{
					m_isHammerCocked = true;
				}
			}
			if (HasSafety)
			{
				empty = "SafetyState";
				if (f.ContainsKey(empty))
				{
					empty2 = f[empty];
					if (empty2 == "On")
					{
						m_isSafetyEngaged = true;
					}
					UpdateSafetyGeo();
				}
			}
			((FVRFireArm)this).ConfigureFromFlagDic(f);
		}

		public override Dictionary<string, string> GetFlagDic()
		{
			Dictionary<string, string> flagDic = ((FVRFireArm)this).GetFlagDic();
			string key = "HammerState";
			string value = "Uncocked";
			if (m_isHammerCocked)
			{
				value = "Cocked";
			}
			flagDic.Add(key, value);
			if (HasSafety)
			{
				key = "SafetyState";
				value = "Off";
				if (m_isSafetyEngaged)
				{
					value = "On";
				}
				flagDic.Add(key, value);
			}
			return flagDic;
		}

		public override void OnCollisionEnter(Collision col)
		{
			//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)
			((FVRPhysicalObject)this).OnCollisionEnter(col);
			Vector3 relativeVelocity = col.relativeVelocity;
			if (((Vector3)(ref relativeVelocity)).magnitude > ColThresh && (Object)(object)((ContactPoint)(ref col.contacts[0])).thisCollider == (Object)(object)HammerCol)
			{
				ReleaseHammer();
			}
		}
	}
	public class PulverizerBolt : FVRInteractiveObject
	{
		public enum BoltPos
		{
			Forward,
			ForwardToMid,
			Locked,
			LockedToRear,
			Rear
		}

		[Header("Shotgun Bolt")]
		public ShermanJumbo.Pulverizer Pulverizer;

		public float Speed_Forward;

		public float Speed_Rearward;

		public float Speed_Held;

		public float SpringStiffness = 5f;

		public BoltPos CurPos;

		public BoltPos LastPos;

		public Transform Point_Bolt_Forward;

		public Transform Point_Bolt_LockPoint;

		public Transform Point_Bolt_Rear;

		public bool HasLastRoundBoltHoldOpen = true;

		private float m_curBoltSpeed;

		private float m_boltZ_current;

		private float m_boltZ_heldTarget;

		private float m_boltZ_forward;

		private float m_boltZ_lock;

		private float m_boltZ_rear;

		private bool m_isBoltLocked;

		private bool m_isHandleHeld;

		private float m_HandleLerp;

		[Header("Reciprocating Barrel")]
		public bool HasReciprocatingBarrel;

		public Transform Barrel;

		public Vector3 BarrelForward;

		public Vector3 BarrelRearward;

		private bool m_isBarrelReciprocating;

		[Header("Elevator")]
		public bool HasElevator;

		public Transform Elevator;

		public Vector3 ElevatorForward;

		public Vector3 ElevatorRearward;

		[Header("Hammer")]
		public bool HasHammer;

		public Transform Hammer;

		public Vector3 HammerForward;

		public Vector3 HammerRearward;

		[Header("LateralLocking")]
		public bool UsesLateralLocking;

		public Transform LateralLock;

		public Vector3 Point_LateralLock_In;

		public Vector3 Point_LateralLock_Out;

		public Transform LaterlockGoal_In;

		public Transform LaterlockGoal_Out;

		private bool m_isLateralLockIn = true;

		public bool GetIsLateralLocked()
		{
			return m_isLateralLockIn;
		}

		public override void Awake()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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)
			((FVRInteractiveObject)this).Awake();
			m_boltZ_current = ((Component)this).transform.localPosition.z;
			m_boltZ_forward = Point_Bolt_Forward.localPosition.z;
			m_boltZ_lock = Point_Bolt_LockPoint.localPosition.z;
			m_boltZ_rear = Point_Bolt_Rear.localPosition.z;
		}

		public override bool IsInteractable()
		{
			return Pulverizer.Mode == ShermanJumbo.Pulverizer.ShotgunMode.Automatic && ((FVRInteractiveObject)this).IsInteractable();
		}

		public float GetBoltLerpBetweenLockAndFore()
		{
			return Mathf.InverseLerp(m_boltZ_lock, m_boltZ_forward, m_boltZ_current);
		}

		public float GetBoltLerpBetweenRearAndFore()
		{
			return Mathf.InverseLerp(m_boltZ_rear, m_boltZ_forward, m_boltZ_current);
		}

		public void LockBolt()
		{
			if (!m_isBoltLocked)
			{
				m_isBoltLocked = true;
			}
		}

		public void ReleaseBolt()
		{
			if (m_isBoltLocked)
			{
				((FVRFireArm)Pulverizer).PlayAudioEvent((FirearmAudioEventType)8, 1f);
				m_isBoltLocked = false;
			}
		}

		public void UpdateHandleHeldState(bool state, float lerp)
		{
			m_isHandleHeld = state;
			m_HandleLerp = lerp;
		}

		public void ImpartFiringImpulse()
		{
			m_curBoltSpeed = Speed_Rearward;
			if (CurPos == BoltPos.Forward)
			{
				m_isBarrelReciprocating = true;
			}
		}

		public void UpdateBolt()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_00a2: 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_00c3: 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_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			if (((FVRInteractiveObject)this).IsHeld || m_isHandleHeld)
			{
				flag = true;
			}
			if (((FVRInteractiveObject)this).IsHeld)
			{
				Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(Point_Bolt_Forward.position, Point_Bolt_Rear.position, ((HandInput)(ref base.m_hand.Input)).Pos);
				m_boltZ_heldTarget = ((Component)Pulverizer).transform.InverseTransformPoint(closestValidPoint).z;
				if (UsesLateralLocking && CurPos == BoltPos.Forward)
				{
					float num = Vector3.Distance(LaterlockGoal_In.position, ((HandInput)(ref base.m_hand.Input)).Pos);
					float num2 = Vector3.Distance(LaterlockGoal_Out.position, ((HandInput)(ref base.m_hand.Input)).Pos);
					if (num < num2 && !m_isLateralLockIn)
					{
						m_isLateralLockIn = true;
						((FVRFireArm)Pulverizer).PlayAudioEvent((FirearmAudioEventType)12, 1f);
						LateralLock.localPosition = Point_LateralLock_In;
					}
					else if (num > num2 && m_isLateralLockIn)
					{
						m_isLateralLockIn = false;
						((FVRFireArm)Pulverizer).PlayAudioEvent((FirearmAudioEventType)13, 1f);
						LateralLock.localPosition = Point_LateralLock_Out;
					}
				}
			}
			else if (m_isHandleHeld)
			{
				m_boltZ_heldTarget = Mathf.Lerp(m_boltZ_forward, m_boltZ_rear, m_HandleLerp);
			}
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(m_boltZ_rear, m_boltZ_forward);
			if (m_boltZ_current <= m_boltZ_lock && m_isBoltLocked)
			{
				((Vector2)(ref val))..ctor(m_boltZ_rear, m_boltZ_lock);
			}
			if (UsesLateralLocking && m_isLateralLockIn)
			{
				((Vector2)(ref val))..ctor(m_boltZ_forward, m_boltZ_forward);
			}
			if (flag)
			{
				m_curBoltSpeed = 0f;
			}
			else if (Pulverizer.Mode == ShermanJumbo.Pulverizer.ShotgunMode.Automatic && ((CurPos < BoltPos.LockedToRear && m_curBoltSpeed >= 0f) || LastPos >= BoltPos.Rear))
			{
				m_curBoltSpeed = Mathf.MoveTowards(m_curBoltSpeed, Speed_Forward, Time.deltaTime * SpringStiffness);
			}
			float num3 = m_boltZ_current;
			float boltZ_current = m_boltZ_current;
			if (flag)
			{
				boltZ_current = m_boltZ_heldTarget;
				num3 = Mathf.MoveTowards(m_boltZ_current, boltZ_current, Speed_Held * Time.deltaTime);
			}
			else if (Pulverizer.Mode == ShermanJumbo.Pulverizer.ShotgunMode.Automatic)
			{
				num3 = m_boltZ_current + m_curBoltSpeed * Time.deltaTime;
			}
			num3 = Mathf.Clamp(num3, val.x, val.y);
			if (Mathf.Abs(num3 - m_boltZ_current) > Mathf.Epsilon)
			{
				m_boltZ_current = num3;
				((Component)this).transform.localPosition = new Vector3(((Component)this).transform.localPosition.x, ((Component)this).transform.localPosition.y, m_boltZ_current);
				if (HasElevator)
				{
					float boltLerpBetweenLockAndFore = GetBoltLerpBetweenLockAndFore();
					Elevator.localEulerAngles = Vector3.Lerp(ElevatorRearward, ElevatorForward, boltLerpBetweenLockAndFore);
				}
			}
			else
			{
				m_curBoltSpeed = 0f;
			}
			if (HasHammer)
			{
				if (Pulverizer.IsHammerCocked)
				{
					Hammer.localEulerAngles = HammerRearward;
				}
				else
				{
					float boltLerpBetweenLockAndFore2 = GetBoltLerpBetweenLockAndFore();
					Hammer.localEulerAngles = Vector3.Lerp(HammerRearward, HammerForward, boltLerpBetweenLockAndFore2);
				}
			}
			if (HasReciprocatingBarrel && m_isBarrelReciprocating)
			{
				float num4 = 0f;
				if (!m_isBoltLocked && !((FVRInteractiveObject)this).IsHeld)
				{
					num4 = 1f - GetBoltLerpBetweenLockAndFore();
				}
				Barrel.localPosition = Vector3.Lerp(BarrelForward, BarrelRearward, num4);
			}
			BoltPos curPos = CurPos;
			curPos = ((!(Mathf.Abs(m_boltZ_current - m_boltZ_forward) < 0.0015f)) ? ((Mathf.Abs(m_boltZ_current - m_boltZ_lock) < 0.0015f) ? BoltPos.Locked : ((Mathf.Abs(m_boltZ_current - m_boltZ_rear) < 0.0015f) ? BoltPos.Rear : ((m_boltZ_current > m_boltZ_lock) ? BoltPos.ForwardToMid : BoltPos.LockedToRear))) : BoltPos.Forward);
			int curPos2 = (int)CurPos;
			CurPos = (BoltPos)Mathf.Clamp((int)curPos, curPos2 - 1, curPos2 + 1);
			if (CurPos >= BoltPos.Locked)
			{
				Pulverizer.Chamber.IsAccessible = true;
			}
			else
			{
				Pulverizer.Chamber.IsAccessible = false;
			}
			if (CurPos >= BoltPos.ForwardToMid)
			{
				((FVRFireArm)Pulverizer).IsBreachOpenForGasOut = true;
			}
			else
			{
				((FVRFireArm)Pulverizer).IsBreachOpenForGasOut = false;
			}
			if (CurPos == BoltPos.Forward && LastPos != 0)
			{
				BoltEvent_ArriveAtFore();
			}
			else if (CurPos == BoltPos.ForwardToMid && LastPos == BoltPos.Forward)
			{
				BoltEvent_ExtractRoundFromMag();
			}
			else if (CurPos == BoltPos.Locked && LastPos == BoltPos.ForwardToMid)
			{
				BoltEvent_EjectRound();
			}
			else if (CurPos != BoltPos.ForwardToMid || LastPos != BoltPos.Locked)
			{
				if (CurPos == BoltPos.Locked && LastPos == BoltPos.LockedToRear)
				{
					BoltEvent_BoltCaught();
				}
				else if (CurPos == BoltPos.Rear && LastPos != BoltPos.Rear)
				{
					BoltEvent_SmackRear();
				}
			}
			if (CurPos >= BoltPos.Locked && Pulverizer.Mode == ShermanJumbo.Pulverizer.ShotgunMode.Automatic && HasLastRoundBoltHoldOpen && (Object)(object)((FVRFireArm)Pulverizer).Magazine != (Object)null && !Pulverizer.HasExtractedRound() && !((FVRFireArm)Pulverizer).Magazine.HasARound() && !Pulverizer.Chamber.IsFull && !Pulverizer.IsSlideReleaseButtonHeld)
			{
				LockBolt();
			}
			LastPos = CurPos;
		}

		private void BoltEvent_ArriveAtFore()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			Pulverizer.ChamberRound();
			Pulverizer.ReturnCarrierRoundToMagazineIfRelevant();
			if (HasReciprocatingBarrel && m_isBarrelReciprocating)
			{
				m_isBarrelReciprocating = false;
				Barrel.localPosition = BarrelForward;
			}
			if (((FVRInteractiveObject)this).IsHeld)
			{
				((FVRFireArm)Pulverizer).PlayAudioEvent((FirearmAudioEventType)2, 1f);
			}
			else
			{
				((FVRFireArm)Pulverizer).PlayAudioEvent((FirearmAudioEventType)0, 1f);
			}
		}

		private void BoltEvent_EjectRound()
		{
			Pulverizer.EjectExtractedRound();
			Pulverizer.TransferShellToUpperTrack();
			Pulverizer.CockHammer();
		}

		private void BoltEvent_ExtractRoundFromMag()
		{
			Pulverizer.ExtractRound();
		}

		private void BoltEvent_SmackRear()
		{
			if (((FVRInteractiveObject)this).IsHeld || m_isHandleHeld)
			{
				ReleaseBolt();
			}
			if (((FVRInteractiveObject)this).IsHeld)
			{
				((FVRFireArm)Pulverizer).PlayAudioEvent((FirearmAudioEventType)3, 1f);
			}
			else
			{
				((FVRFireArm)Pulverizer).PlayAudioEvent((FirearmAudioEventType)1, 1f);
			}
		}

		private void BoltEvent_BoltCaught()
		{
			if (m_isBoltLocked)
			{
				if (HasReciprocatingBarrel && m_isBarrelReciprocating)
				{
					m_isBarrelReciprocating = false;
				}
				((FVRFireArm)Pulverizer).PlayAudioEvent((FirearmAudioEventType)4, 1f);
			}
		}
	}
	public class PulverizerFireOnDamage : MonoBehaviour, IFVRDamageable
	{
		public ShermanJumbo.Pulverizer Pulverizer;

		public void Damage(Damage d)
		{
			Pulverizer.ReleaseHammer();
		}
	}
	public class PulverizerHandle : FVRAlternateGrip
	{
		public enum BoltPos
		{
			Forward,
			ForwardToMid,
			Locked,
			LockedToRear,
			Rear
		}

		[Header("Shotgun Handle")]
		public ShermanJumbo.Pulverizer Pulverizer;

		public float Speed_Held;

		public BoltPos CurPos;

		public BoltPos LastPos;

		public Transform Point_Bolt_Forward;

		public Transform Point_Bolt_LockPoint;

		public Transform Point_Bolt_Rear;

		private float m_handZOffset;

		private float m_boltZ_current;

		private float m_boltZ_heldTarget;

		private float m_boltZ_forward;

		private float m_boltZ_lock;

		private float m_boltZ_rear;

		private bool m_isHandleLocked;

		public override void Awake()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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)
			((FVRAlternateGrip)this).Awake();
			m_boltZ_current = ((Component)this).transform.localPosition.z;
			m_boltZ_forward = Point_Bolt_Forward.localPosition.z;
			m_boltZ_lock = Point_Bolt_LockPoint.localPosition.z;
			m_boltZ_rear = Point_Bolt_Rear.localPosition.z;
		}

		public override void BeginInteraction(FVRViveHand hand)
		{
			//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_0018: Unknown result type (might be due to invalid IL or missing references)
			m_handZOffset = ((Component)this).transform.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos).z;
			((FVRAlternateGrip)this).BeginInteraction(hand);
		}

		public float GetBoltLerpBetweenLockAndFore()
		{
			return Mathf.InverseLerp(m_boltZ_lock, m_boltZ_forward, m_boltZ_current);
		}

		public float GetBoltLerpBetweenRearAndFore()
		{
			return Mathf.InverseLerp(m_boltZ_rear, m_boltZ_forward, m_boltZ_current);
		}

		public void LockHandle()
		{
			m_isHandleLocked = true;
		}

		public void UnlockHandle()
		{
			m_isHandleLocked = false;
		}

		public void UpdateHandle()
		{
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_009a: 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_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00f8: 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_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: 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_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			if (((FVRInteractiveObject)this).IsHeld || ((FVRPhysicalObject)Pulverizer).IsAltHeld)
			{
				flag = true;
			}
			if (flag && !m_isHandleLocked)
			{
				Vector3 closestValidPoint;
				if (((FVRInteractiveObject)this).IsHeld)
				{
					closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(Point_Bolt_Forward.position, Point_Bolt_Rear.position, ((HandInput)(ref ((FVRInteractiveObject)this).m_hand.Input)).Pos + -((Component)this).transform.forward * m_handZOffset * ((Component)Pulverizer).transform.localScale.x);
				}
				else
				{
					if (((FVRInteractiveObject)Pulverizer).m_hand.Input.TriggerPressed)
					{
						Vector3 velLinearWorld = ((FVRInteractiveObject)Pulverizer).m_hand.Input.VelLinearWorld;
						velLinearWorld = Vector3.Project(velLinearWorld, ((Component)Pulverizer).transform.forward);
						velLinearWorld = ((Component)Pulverizer).transform.InverseTransformDirection(velLinearWorld);
						if (Mathf.Abs(velLinearWorld.z) > 1f)
						{
							float z = ((FVRInteractiveObject)Pulverizer).GrabPointTransform.localPosition.z;
							float num = (0f - velLinearWorld.z) * Time.deltaTime;
							z += num;
							z = Mathf.Clamp(z, Point_Bolt_Rear.localPosition.z - 0.1f, Point_Bolt_Forward.localPosition.z + 0.1f);
							((FVRInteractiveObject)Pulverizer).GrabPointTransform.localPosition = new Vector3(((FVRInteractiveObject)Pulverizer).GrabPointTransform.localPosition.x, ((FVRInteractiveObject)Pulverizer).GrabPointTransform.localPosition.y, z);
						}
					}
					closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(Point_Bolt_Forward.position, Point_Bolt_Rear.position, ((HandInput)(ref ((FVRInteractiveObject)Pulverizer).m_hand.Input)).Pos);
				}
				m_boltZ_heldTarget = ((Component)Pulverizer).transform.InverseTransformPoint(closestValidPoint).z;
			}
			float num2 = m_boltZ_current;
			float boltZ_current = m_boltZ_current;
			if (flag && !m_isHandleLocked)
			{
				boltZ_current = m_boltZ_heldTarget;
				num2 = Mathf.MoveTowards(m_boltZ_current, boltZ_current, Speed_Held * Time.deltaTime);
			}
			if (Mathf.Abs(num2 - m_boltZ_current) > Mathf.Epsilon)
			{
				m_boltZ_current = num2;
				((Component)this).transform.localPosition = new Vector3(((Component)this).transform.localPosition.x, ((Component)this).transform.localPosition.y, m_boltZ_current);
			}
			BoltPos curPos = CurPos;
			curPos = ((!(Mathf.Abs(m_boltZ_current - m_boltZ_forward) < 0.001f)) ? ((Mathf.Abs(m_boltZ_current - m_boltZ_lock) < 0.001f) ? BoltPos.Locked : ((Mathf.Abs(m_boltZ_current - m_boltZ_rear) < 0.001f) ? BoltPos.Rear : ((m_boltZ_current > m_boltZ_lock) ? BoltPos.ForwardToMid : BoltPos.LockedToRear))) : BoltPos.Forward);
			int curPos2 = (int)CurPos;
			CurPos = (BoltPos)Mathf.Clamp((int)curPos, curPos2 - 1, curPos2 + 1);
			if (CurPos == BoltPos.Forward && LastPos != 0)
			{
				BoltEvent_ArriveAtFore();
			}
			else if (CurPos == BoltPos.Rear && LastPos != BoltPos.Rear)
			{
				BoltEvent_SmackRear();
			}
			LastPos = CurPos;
		}

		private void BoltEvent_ArriveAtFore()
		{
			if (Pulverizer.Mode == ShermanJumbo.Pulverizer.ShotgunMode.PumpMode)
			{
				if (Pulverizer.IsHammerCocked)
				{
					LockHandle();
				}
				if (Pulverizer.Chamber.IsFull || Pulverizer.HasExtractedRound())
				{
					((FVRFireArm)Pulverizer).PlayAudioEvent((FirearmAudioEventType)11, 1f);
				}
				else
				{
					((FVRFireArm)Pulverizer).PlayAudioEvent((FirearmAudioEventType)40, 1f);
				}
			}
		}

		private void BoltEvent_SmackRear()
		{
			if (Pulverizer.Mode == ShermanJumbo.Pulverizer.ShotgunMode.PumpMode)
			{
				if (Pulverizer.Chamber.IsFull || Pulverizer.HasExtractedRound())
				{
					((FVRFireArm)Pulverizer).PlayAudioEvent((FirearmAudioEventType)10, 1f);
				}
				else
				{
					((FVRFireArm)Pulverizer).PlayAudioEvent((FirearmAudioEventType)41, 1f);
				}
			}
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			Vector2 touchpadAxes = hand.Input.TouchpadAxes;
			bool flag = false;
			if (hand.IsInStreamlinedMode && hand.Input.BYButtonDown)
			{
				flag = true;
			}
			else if (hand.Input.TouchpadDown)
			{
				flag = true;
			}
			if (flag && CurPos == BoltPos.Forward && Pulverizer.CanModeSwitch)
			{
				Pulverizer.ToggleMode();
			}
			((FVRAlternateGrip)this).UpdateInteraction(hand);
		}
	}
}
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 != 0)
			{
				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)).mag