Decompiled source of HuntSpringfield1866Compact v1.0.2

HuntSpringfield1866Compact.dll

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

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace BitWizrd.HuntSpringfield1866Compact
{
	[BepInPlugin("BitWizrd.HuntSpringfield1866Compact", "HuntSpringfield1866Compact", "1.0.2")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class HuntSpringfield1866CompactPlugin : 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(), "BitWizrd.HuntSpringfield1866Compact");
			OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntSpringfield1866Compact", "", "springfield1866compact", "", "");
		}
	}
}
public class BloodBondSR : MonoBehaviour
{
	private void Awake()
	{
		string name = "Ammo_69_CashMoney_D100(Clone)";
		((Object)((Component)this).gameObject).name = name;
		Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(true);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			((Object)((Component)componentsInChildren[i]).gameObject).name = name;
		}
	}
}
namespace BitWizrd.Breech
{
	public class BreechLoadingRifle : FVRFireArm
	{
		public enum BreechRifleState
		{
			HammerForward,
			HammerBackBreechClosed,
			HammerBackBreechOpen
		}

		[Header("Base Weapon Params")]
		public FVRFireArmChamber Chamber;

		public Transform Trigger;

		public Vector2 TriggerRots;

		public Transform Hammer;

		public Vector2 HammerRots;

		public Transform EjectPos;

		[Header("Hammer Settings")]
		public float hammerCockSpeed = 45f;

		public float hammerCockDamping = 1.5f;

		public float hammerReturnSpeed = 60f;

		public float hammerReturnDamping = 2.5f;

		public float hammerOvershoot = 4f;

		public float hammerSnapThreshold = 4f;

		public float hammerMaxVelocity = 1500f;

		[Header("Breech Components")]
		public Transform Breech;

		public Vector2 BreechRots;

		[Header("Breech Animation")]
		public float openDuration = 0.15f;

		public float closeDuration = 0.18f;

		public float bounceBaseDuration = 0.3f;

		public float bounceOvershootMin = 4f;

		public float bounceOvershootMax = 6f;

		public float bounceDamping = 3.5f;

		public float bounceFrequency = 2.8f;

		[Header("Interaction Settings")]
		public Transform BreechInteractionPoint;

		public float BreechInteractionDistance = 0.15f;

		public bool UseSwipeToInteract = false;

		public float SwipeInteractionDistance = 0.15f;

		public float SwipeVelocityThreshold = 1f;

		public float SwipeAngleThreshold = 60f;

		[Header("Ejection Settings")]
		public float forwardMultiplier = 1.2f;

		public float rightMultiplier = 0.7f;

		public float upMultiplier = 1.2f;

		public float ejectForceMultiplier = 2f;

		public float ejectUnfiredForceMultiplier = 2f;

		public Vector2 ejectSpinRange = new Vector2(180f, 360f);

		public bool bypassUnfiredEjection = false;

		private BreechRifleState m_state;

		private float m_curHammerRot;

		private float m_tarHammerRot;

		private float m_triggerVal;

		private bool m_isPressedDown;

		private float m_customCurBreechRot;

		private Coroutine m_breechAnimation;

		private float m_hammerVelocity;

		public override void Awake()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			((FVRFireArm)this).Awake();
			base.FChambers.Add(Chamber);
			base.IsBreachOpenForGasOut = false;
			m_state = BreechRifleState.HammerForward;
			m_customCurBreechRot = BreechRots.x;
			if ((Object)(object)Breech != (Object)null)
			{
				Breech.localEulerAngles = new Vector3(m_customCurBreechRot, 0f, 0f);
			}
			if ((Object)(object)Hammer != (Object)null)
			{
				Hammer.localEulerAngles = new Vector3(HammerRots.x, 0f, 0f);
			}
		}

		public override void FVRUpdate()
		{
			((FVRFireArm)this).FVRUpdate();
			UpdateHammerPhysics();
			UpdateBreechState();
			UpdateTriggerVisuals();
		}

		private void UpdateHammerPhysics()
		{
			//IL_0063: 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)
			if ((Object)(object)Hammer == (Object)null)
			{
				return;
			}
			float tarHammerRot = m_tarHammerRot;
			float curHammerRot = m_curHammerRot;
			float num = tarHammerRot - curHammerRot;
			if (Mathf.Abs(num) < hammerSnapThreshold)
			{
				m_curHammerRot = tarHammerRot;
				m_hammerVelocity = 0f;
				Hammer.localEulerAngles = new Vector3(m_curHammerRot, 0f, 0f);
				return;
			}
			float num2 = 0f;
			float num3 = 1f;
			if (m_state == BreechRifleState.HammerBackBreechClosed || m_state == BreechRifleState.HammerBackBreechOpen)
			{
				num2 = num * hammerCockSpeed * 3f;
				num3 = 1f - hammerCockDamping * Time.deltaTime;
			}
			else
			{
				num2 = num * hammerReturnSpeed * 4f;
				num3 = 1f - hammerReturnDamping * Time.deltaTime;
			}
			m_hammerVelocity += num2 * Time.deltaTime;
			m_hammerVelocity = Mathf.Clamp(m_hammerVelocity, 0f - hammerMaxVelocity, hammerMaxVelocity);
			m_hammerVelocity *= Mathf.Clamp01(num3);
			m_curHammerRot += m_hammerVelocity * Time.deltaTime * 2f;
			if ((m_state == BreechRifleState.HammerBackBreechClosed || m_state == BreechRifleState.HammerBackBreechOpen) && m_curHammerRot >= HammerRots.y + hammerOvershoot)
			{
				m_tarHammerRot = HammerRots.y;
			}
			Hammer.localEulerAngles = new Vector3(m_curHammerRot, 0f, 0f);
		}

		private void UpdateBreechState()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Breech != (Object)null)
			{
				Breech.localEulerAngles = new Vector3(m_customCurBreechRot, 0f, 0f);
			}
		}

		private void UpdateTriggerVisuals()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Trigger != (Object)null)
			{
				float num = Mathf.Lerp(TriggerRots.x, TriggerRots.y, m_triggerVal);
				Trigger.localEulerAngles = new Vector3(num, 0f, 0f);
			}
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			m_triggerVal = hand.Input.TriggerFloat;
			HandleInputControls(hand);
			HandleHammerRelease(hand);
			HandleSwipeInteractions(hand);
		}

		private void HandleInputControls(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;
			if (hand.IsInStreamlinedMode)
			{
				if (hand.Input.BYButtonDown)
				{
					ClickUpward();
				}
				if (hand.Input.AXButtonDown)
				{
					ClickDownward();
				}
			}
			else if (hand.Input.TouchpadDown)
			{
				if (touchpadAxes.y > 0f)
				{
					ClickUpward();
				}
				else
				{
					ClickDownward();
				}
			}
		}

		private void HandleHammerRelease(FVRViveHand hand)
		{
			if (m_state == BreechRifleState.HammerBackBreechClosed && hand.Input.TriggerDown)
			{
				m_isPressedDown = false;
				DropHammer();
				m_state = BreechRifleState.HammerForward;
			}
		}

		private void HandleSwipeInteractions(FVRViveHand hand)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00be: Unknown result type (might be due to invalid IL or missing references)
			if (!UseSwipeToInteract || (Object)(object)hand.OtherHand == (Object)null || !((FVRInteractiveObject)this).IsHeld || (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null || ((FVRFireArm)this).IsTwoHandStabilized())
			{
				return;
			}
			FVRViveHand otherHand = hand.OtherHand;
			Vector3 velLinearWorld = otherHand.Input.VelLinearWorld;
			float num = Vector3.Distance(BreechInteractionPoint.position, otherHand.PalmTransform.position);
			if (num > SwipeInteractionDistance || ((Vector3)(ref velLinearWorld)).magnitude <= SwipeVelocityThreshold)
			{
				return;
			}
			float num2 = Vector3.Angle(velLinearWorld, -((Component)this).transform.forward);
			float num3 = Vector3.Angle(velLinearWorld, ((Component)this).transform.forward);
			if (num2 < SwipeAngleThreshold)
			{
				if (m_state == BreechRifleState.HammerForward)
				{
					CockHammerAction();
				}
				else if (m_state == BreechRifleState.HammerBackBreechOpen)
				{
					CloseBreechAction();
				}
			}
			else if (num3 < SwipeAngleThreshold && m_state == BreechRifleState.HammerBackBreechClosed)
			{
				OpenBreechAction();
			}
		}

		private void CockHammerAction()
		{
			CockHammer();
			m_state = BreechRifleState.HammerBackBreechClosed;
		}

		private void CloseBreechAction()
		{
			CloseCustomBreech();
			m_state = BreechRifleState.HammerBackBreechClosed;
		}

		private void OpenBreechAction()
		{
			OpenCustomBreech();
			m_state = BreechRifleState.HammerBackBreechOpen;
		}

		private void ClickUpward()
		{
			switch (m_state)
			{
			case BreechRifleState.HammerBackBreechClosed:
				m_state = BreechRifleState.HammerForward;
				DecockHammer();
				break;
			case BreechRifleState.HammerBackBreechOpen:
				m_state = BreechRifleState.HammerBackBreechClosed;
				CloseCustomBreech();
				break;
			}
		}

		private void ClickDownward()
		{
			switch (m_state)
			{
			case BreechRifleState.HammerForward:
				CockHammer();
				m_state = BreechRifleState.HammerBackBreechClosed;
				break;
			case BreechRifleState.HammerBackBreechClosed:
				OpenCustomBreech();
				m_state = BreechRifleState.HammerBackBreechOpen;
				break;
			}
		}

		private void CockHammer()
		{
			m_tarHammerRot = HammerRots.y + hammerOvershoot;
			m_hammerVelocity = 0f;
			((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
		}

		private void DecockHammer()
		{
			m_tarHammerRot = HammerRots.x;
			m_hammerVelocity = 0f;
			((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
		}

		private void DropHammer()
		{
			m_tarHammerRot = HammerRots.x;
			m_hammerVelocity = 0f;
			((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
			if ((Object)(object)Chamber != (Object)null && Chamber.IsFull)
			{
				Fire();
			}
		}

		private void OpenCustomBreech()
		{
			if (m_breechAnimation != null)
			{
				((MonoBehaviour)this).StopCoroutine(m_breechAnimation);
			}
			m_breechAnimation = ((MonoBehaviour)this).StartCoroutine(AnimateBreechOpen());
			((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f);
			if ((Object)(object)Chamber != (Object)null && Chamber.IsFull)
			{
				EjectRound();
			}
			base.IsBreachOpenForGasOut = true;
			Chamber.IsAccessible = true;
		}

		private void CloseCustomBreech()
		{
			if (m_breechAnimation != null)
			{
				((MonoBehaviour)this).StopCoroutine(m_breechAnimation);
			}
			m_breechAnimation = ((MonoBehaviour)this).StartCoroutine(AnimateBreechClose());
			((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f);
			base.IsBreachOpenForGasOut = false;
			Chamber.IsAccessible = false;
		}

		private IEnumerator AnimateBreechOpen()
		{
			float elapsed = 0f;
			float startAngle = m_customCurBreechRot;
			float openAngle = BreechRots.y;
			while (elapsed < openDuration)
			{
				elapsed += Time.deltaTime;
				m_customCurBreechRot = Mathf.Lerp(startAngle, openAngle, elapsed / openDuration);
				yield return null;
			}
			m_customCurBreechRot = openAngle;
			float bounceTimer = 0f;
			float amplitude = Random.Range(bounceOvershootMin, bounceOvershootMax);
			float naturalFreq = bounceFrequency * (float)Math.PI * 2f;
			float damping = bounceDamping * 0.5f;
			float velocity = amplitude * naturalFreq;
			float position = 0f;
			while (bounceTimer < bounceBaseDuration)
			{
				bounceTimer += Time.deltaTime;
				float acceleration = (0f - naturalFreq) * naturalFreq * position - damping * velocity;
				velocity += acceleration * Time.deltaTime;
				position += velocity * Time.deltaTime;
				m_customCurBreechRot = openAngle + position * Mathf.Exp((0f - bounceDamping) * bounceTimer);
				if (Mathf.Abs(position) < 0.5f && velocity < 5f && bounceTimer > bounceBaseDuration * 0.3f)
				{
					break;
				}
				yield return null;
			}
			m_customCurBreechRot = openAngle;
			m_breechAnimation = null;
		}

		private IEnumerator AnimateBreechClose()
		{
			float elapsed = 0f;
			float startAngle = m_customCurBreechRot;
			float closeAngle = BreechRots.x;
			while (elapsed < closeDuration)
			{
				elapsed += Time.deltaTime;
				m_customCurBreechRot = Mathf.Lerp(startAngle, closeAngle, elapsed / closeDuration);
				yield return null;
			}
			m_customCurBreechRot = closeAngle;
			m_breechAnimation = null;
		}

		private void Fire()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			if (Chamber.Fire())
			{
				((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f);
				((FVRFireArm)this).FireMuzzleSmoke();
				((FVRFireArm)this).Recoil(((FVRFireArm)this).IsTwoHandStabilized(), (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null, ((FVRFireArm)this).IsShoulderStabilized(), (FVRFireArmRecoilProfile)null, 1f);
				((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
			}
		}

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

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

		private void EjectRound()
		{
			//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_0063: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Chamber == (Object)null) && Chamber.IsFull && (Chamber.IsSpent || !bypassUnfiredEjection))
			{
				Vector3 val = ((Component)this).transform.forward * forwardMultiplier + ((Component)this).transform.right * rightMultiplier + ((Component)this).transform.up * upMultiplier;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				float num = ((!Chamber.IsSpent) ? ejectUnfiredForceMultiplier : ejectForceMultiplier);
				Chamber.EjectRound(((Component)this).transform.position, normalized * num, new Vector3(0f, 0f, Random.Range(ejectSpinRange.x, ejectSpinRange.y)), false);
				((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f);
			}
		}
	}
}
public class CooldownSound : MonoBehaviour
{
	public ClosedBoltWeapon weapon;

	public AudioClip[] audioClips;

	public float volume = 1f;

	public int minShots = 5;

	public int maxShots = 10;

	public float minDelay = 0.5f;

	public float maxDelay = 2f;

	public float resetTime = 1.5f;

	private AudioSource audioSource;

	private int shotCounter = 0;

	private float lastShotTime;

	private bool lastRoundSpent;

	private int nextShotThreshold;

	private bool isPlayingSound = false;

	private void Start()
	{
		if ((Object)(object)weapon == (Object)null)
		{
			weapon = ((Component)this).GetComponent<ClosedBoltWeapon>();
		}
		if ((Object)(object)weapon == (Object)null)
		{
			Debug.LogError((object)"CooldownSound: Weapon reference is missing. Attach this script to a ClosedBoltWeapon.");
			return;
		}
		audioSource = ((Component)weapon).gameObject.GetComponent<AudioSource>();
		if ((Object)(object)audioSource == (Object)null)
		{
			audioSource = ((Component)weapon).gameObject.AddComponent<AudioSource>();
		}
		audioSource.spatialBlend = 1f;
		audioSource.playOnAwake = false;
		audioSource.rolloffMode = (AudioRolloffMode)0;
		lastRoundSpent = weapon.Chamber.IsSpent;
		SetNewShotThreshold();
	}

	private void Update()
	{
		DetectFiring();
	}

	private void DetectFiring()
	{
		if (weapon.Chamber.IsFull && weapon.Chamber.IsSpent && !lastRoundSpent)
		{
			OnWeaponFired();
		}
		lastRoundSpent = weapon.Chamber.IsSpent;
	}

	private void OnWeaponFired()
	{
		float num = Time.time - lastShotTime;
		if (num > resetTime)
		{
			shotCounter = 0;
			SetNewShotThreshold();
		}
		shotCounter++;
		lastShotTime = Time.time;
		if (shotCounter >= nextShotThreshold)
		{
			((MonoBehaviour)this).StartCoroutine(PlaySoundWithDelay());
			shotCounter = 0;
			SetNewShotThreshold();
		}
	}

	private IEnumerator PlaySoundWithDelay()
	{
		if (!isPlayingSound)
		{
			isPlayingSound = true;
			float delay = Random.Range(minDelay, maxDelay);
			yield return (object)new WaitForSeconds(delay);
			if (audioClips.Length > 0)
			{
				int index = Random.Range(0, audioClips.Length);
				audioSource.clip = audioClips[index];
				audioSource.PlayOneShot(audioSource.clip, volume);
				yield return (object)new WaitForSeconds(audioSource.clip.length);
			}
			isPlayingSound = false;
		}
	}

	private void SetNewShotThreshold()
	{
		nextShotThreshold = Random.Range(minShots, maxShots + 1);
	}
}
public class CustomWaggleJoint : MonoBehaviour
{
	[Tooltip("The distance the particle is clamped to; scale this up to make it less sensitive to changes.")]
	public float distanceLimit = 0.25f;

	[Tooltip("Allowed rotation in the positive direction (from the rest edge).")]
	public float angleLimitLeft = 45f;

	[Tooltip("Allowed rotation in the negative direction (from the rest edge).")]
	public float angleLimitRight = 45f;

	[Tooltip("Multiplier for the physics gravity affecting the particle. Good for dealing with stiff joints or low gravity values.")]
	public float gravityScale = 1f;

	[Tooltip("Pulls the particle back to the hinge (rest) direction.")]
	public bool useSpring;

	[Tooltip("Rate at which the particle approaches the hinge direction (e.g., 0.95 means 95% closer each second).")]
	public float springApproachRate = 0.95f;

	[Tooltip("Rate at which the particle loses velocity (e.g., 0.5 means 50% slower each second).")]
	public float damping;

	[Tooltip("This transform will be updated to reflect the simulated hinge. It is rotated to face the particle position.")]
	public Transform hingeGraphic;

	[Tooltip("Optional rotation offset for the hinge graphic to correct alignment issues (e.g., (0, -90, 0)).")]
	public Vector3 hingeGraphicRotationOffset;

	[Tooltip("If checked, the local waggle axis is inverted. (Note: This also swaps the allowed angle limits.)")]
	public bool invertWaggleAxis;

	public bool ManualExecution;

	[Tooltip("Puts a cooldown on how often the OnHitLimit event can be fired.")]
	public float onHitLimitCooldown = 0.05f;

	[Tooltip("Axis along which the waggle extends. For example, use Vector3.up for the upward (resting) edge of the ring.")]
	public Vector3 waggleAxis = Vector3.up;

	[Tooltip("Axis around which the waggle rotates. For a ring pivoting on one edge, use Vector3.up.")]
	public Vector3 rotationAxis = Vector3.up;

	[Header("Gizmo Options")]
	[Tooltip("Show markers at the extreme rotation positions.")]
	public bool showRotationExtremes = false;

	[Tooltip("Show arrows indicating the rotation direction from the rest position to the extremes.")]
	public bool showRotationDirectionArrows = false;

	private Vector3 particlePos;

	private Vector3 particleVel;

	private bool leftCatchState;

	private bool rightCatchState;

	private float lastTouchTime = float.MinValue;

	private Vector3 EffectiveWaggleDir()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_003b: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = ((!invertWaggleAxis) ? waggleAxis : (-waggleAxis));
		return ((Component)this).transform.TransformDirection(((Vector3)(ref val)).normalized);
	}

	private void GetEffectiveAngleLimits(out float effectiveAngleMin, out float effectiveAngleMax)
	{
		if (invertWaggleAxis)
		{
			effectiveAngleMin = 0f - angleLimitLeft;
			effectiveAngleMax = angleLimitRight;
		}
		else
		{
			effectiveAngleMin = 0f - angleLimitRight;
			effectiveAngleMax = angleLimitLeft;
		}
	}

	private static float Approach(float rate, float time)
	{
		return 1f - Mathf.Pow(1f - rate, time);
	}

	private static Vector3 Approach(Vector3 point, Vector3 target, float rate, float time)
	{
		//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_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		return Vector3.Lerp(point, target, Approach(rate, time));
	}

	private static float SignedAngle(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)
		float num = Vector3.Angle(from, to);
		float num2 = from.y * to.z - from.z * to.y;
		float num3 = from.z * to.x - from.x * to.z;
		float num4 = from.x * to.y - from.y * to.x;
		float num5 = Mathf.Sign(axis.x * num2 + axis.y * num3 + axis.z * num4);
		return num * num5;
	}

	private static float ToHingeAngle(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection)
	{
		//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_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//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_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		Vector3 val = point - hingePivot;
		Vector3 val2 = Vector3.ProjectOnPlane(val, hingeAxis);
		Vector3 normalized = ((Vector3)(ref val2)).normalized;
		return SignedAngle(hingeDirection, normalized, hingeAxis);
	}

	private static Vector3 ProjectOnHinge(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection, float distanceLimit, float angleMin, float angleMax)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: 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_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_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		float num = ToHingeAngle(point, hingePivot, hingeAxis, hingeDirection);
		num = Mathf.Clamp(num, angleMin, angleMax);
		Vector3 val = Quaternion.AngleAxis(num, hingeAxis) * hingeDirection;
		return val * distanceLimit + hingePivot;
	}

	private static bool DetectOnHitLimit(float angle, float minAngle, float maxAngle, ref bool minCatchState, ref bool maxCatchState, float catchThreshold = 0.5f, float releaseThreshold = 5f)
	{
		float num = Mathf.Abs(maxAngle - minAngle);
		float num2 = Mathf.Min(releaseThreshold, num - catchThreshold);
		float num3 = angle - minAngle;
		float num4 = 0f - (angle - maxAngle);
		bool flag = minCatchState;
		bool flag2 = maxCatchState;
		minCatchState = num3 <= (minCatchState ? num2 : catchThreshold);
		maxCatchState = num4 <= (maxCatchState ? num2 : catchThreshold);
		return (!flag && minCatchState) || (!flag2 && maxCatchState);
	}

	public void ResetParticlePos()
	{
		//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_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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)
		Vector3 val = EffectiveWaggleDir();
		particlePos = ((Component)this).transform.position + val * distanceLimit;
		particleVel = Vector3.zero;
	}

	private void OnHitLimit(float angularVelocity)
	{
	}

	public void Execute()
	{
		//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_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_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_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_003f: 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_0043: 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_004f: 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_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: 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_00fa: 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_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: 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_0122: 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_0126: 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_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: 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)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		float deltaTime = Time.deltaTime;
		Transform transform = ((Component)this).transform;
		Vector3 val = Physics.gravity * gravityScale;
		Vector3 val2 = particlePos;
		Vector3 val3 = Approach(particleVel, Vector3.zero, damping, deltaTime);
		Vector3 val4 = val3 + val * deltaTime;
		Vector3 val5 = val2 + val4 * deltaTime;
		Vector3 val6 = val5;
		Vector3 val7 = transform.TransformDirection(((Vector3)(ref rotationAxis)).normalized);
		Vector3 val8 = EffectiveWaggleDir();
		Vector3 position = transform.position;
		if (useSpring)
		{
			val5 = Approach(val5, position + val8 * distanceLimit, springApproachRate, deltaTime);
		}
		GetEffectiveAngleLimits(out var effectiveAngleMin, out var effectiveAngleMax);
		particlePos = ProjectOnHinge(val5, position, val7, val8, distanceLimit, effectiveAngleMin, effectiveAngleMax);
		particleVel = (particlePos - val2) / deltaTime;
		float angularVelocity = SignedAngle(val6 - position, val2 - position, val7) / Mathf.Max(Mathf.Epsilon, deltaTime);
		bool flag = DetectOnHitLimit(ToHingeAngle(particlePos, position, val7, val8), effectiveAngleMin, effectiveAngleMax, ref rightCatchState, ref leftCatchState);
		bool flag2 = Time.timeSinceLevelLoad < lastTouchTime + onHitLimitCooldown;
		if (flag && !flag2)
		{
			OnHitLimit(angularVelocity);
			lastTouchTime = Time.timeSinceLevelLoad;
		}
		if ((Object)(object)hingeGraphic != (Object)null)
		{
			hingeGraphic.rotation = Quaternion.LookRotation(particlePos - transform.position, val7) * Quaternion.Euler(hingeGraphicRotationOffset);
		}
	}

	private void Start()
	{
		ResetParticlePos();
	}

	private void Update()
	{
		if (!ManualExecution)
		{
			Execute();
		}
	}

	private void OnDrawGizmosSelected()
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//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_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: 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_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: 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_00e5: 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_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_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_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: 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_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: 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)
		//IL_012e: 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_0131: 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_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: 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_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: 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_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_01a5: 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)
		//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: 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_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: 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_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_0236: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0242: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_0257: Unknown result type (might be due to invalid IL or missing references)
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_026e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: Unknown result type (might be due to invalid IL or missing references)
		//IL_028a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0291: Unknown result type (might be due to invalid IL or missing references)
		//IL_0296: Unknown result type (might be due to invalid IL or missing references)
		//IL_029c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b8: 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_02de: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0302: Unknown result type (might be due to invalid IL or missing references)
		//IL_0303: Unknown result type (might be due to invalid IL or missing references)
		//IL_0308: Unknown result type (might be due to invalid IL or missing references)
		//IL_0309: 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_031e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0320: 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_032c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0336: Unknown result type (might be due to invalid IL or missing references)
		//IL_0338: Unknown result type (might be due to invalid IL or missing references)
		//IL_0342: Unknown result type (might be due to invalid IL or missing references)
		//IL_034c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0358: Unknown result type (might be due to invalid IL or missing references)
		//IL_0371: Unknown result type (might be due to invalid IL or missing references)
		//IL_037b: Unknown result type (might be due to invalid IL or missing references)
		//IL_037e: Unknown result type (might be due to invalid IL or missing references)
		//IL_037f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0384: Unknown result type (might be due to invalid IL or missing references)
		//IL_0385: Unknown result type (might be due to invalid IL or missing references)
		//IL_0390: Unknown result type (might be due to invalid IL or missing references)
		//IL_0395: Unknown result type (might be due to invalid IL or missing references)
		//IL_039a: Unknown result type (might be due to invalid IL or missing references)
		//IL_039c: Unknown result type (might be due to invalid IL or missing references)
		//IL_039f: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d3: 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_03ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
		Transform transform = ((Component)this).transform;
		Vector3 position = transform.position;
		Vector3 val = EffectiveWaggleDir();
		Vector3 val2 = transform.TransformDirection(((Vector3)(ref rotationAxis)).normalized);
		Vector3 val3 = position + val * distanceLimit;
		Gizmos.color = Color.white;
		float num = 0.03f;
		Gizmos.DrawLine(position + Vector3.left * num, position + Vector3.right * num);
		Gizmos.DrawLine(position + Vector3.up * num, position + Vector3.down * num);
		Gizmos.DrawLine(position + Vector3.forward * num, position + Vector3.back * num);
		Handles.Label(position, "Pivot");
		Gizmos.color = Color.green;
		Gizmos.DrawLine(position, val3);
		Handles.Label(val3, "Resting Edge");
		GetEffectiveAngleLimits(out var effectiveAngleMin, out var effectiveAngleMax);
		Vector3 val4 = Quaternion.AngleAxis(effectiveAngleMax, val2) * val;
		Vector3 val5 = Quaternion.AngleAxis(effectiveAngleMin, val2) * val;
		Vector3 val6 = position + val4 * distanceLimit;
		Vector3 val7 = position + val5 * distanceLimit;
		Gizmos.color = Color.cyan;
		Gizmos.DrawLine(position, val6);
		Gizmos.DrawLine(position, val7);
		Handles.color = Color.yellow;
		float num2 = effectiveAngleMax - effectiveAngleMin;
		Handles.DrawWireArc(position, val2, val5, num2, distanceLimit);
		Gizmos.color = Color.magenta;
		Vector3 val8 = position + val2 * (distanceLimit * 1.2f);
		Gizmos.DrawLine(position, val8);
		Handles.Label(val8, "Rotation Axis");
		Gizmos.color = Color.blue;
		Vector3 gravity = Physics.gravity;
		Vector3 normalized = ((Vector3)(ref gravity)).normalized;
		Vector3 val9 = position + normalized * (distanceLimit * 0.5f);
		Gizmos.DrawLine(position, val9);
		Handles.Label(val9, "Gravity");
		if (Application.isPlaying)
		{
			Gizmos.color = Color.red;
			float num3 = 0.02f;
			Gizmos.DrawLine(particlePos + Vector3.left * num3, particlePos + Vector3.right * num3);
			Gizmos.DrawLine(particlePos + Vector3.up * num3, particlePos + Vector3.down * num3);
			Gizmos.DrawLine(particlePos + Vector3.forward * num3, particlePos + Vector3.back * num3);
			Handles.Label(particlePos, "Particle Position");
		}
		if (showRotationExtremes)
		{
			Gizmos.color = Color.magenta;
			Vector3 val10 = position + Quaternion.AngleAxis(effectiveAngleMax, val2) * val * distanceLimit;
			Vector3 val11 = position + Quaternion.AngleAxis(effectiveAngleMin, val2) * val * distanceLimit;
			Gizmos.DrawCube(val10, Vector3.one * 0.02f);
			Gizmos.DrawCube(val11, Vector3.one * 0.02f);
			Handles.Label(val10, "Left Extreme");
			Handles.Label(val11, "Right Extreme");
		}
		if (showRotationDirectionArrows)
		{
			Gizmos.color = Color.red;
			Vector3 val12 = position + Quaternion.AngleAxis(effectiveAngleMax, val2) * val * distanceLimit;
			Vector3 val13 = position + Quaternion.AngleAxis(effectiveAngleMin, val2) * val * distanceLimit;
			Gizmos.DrawLine(val3, val12);
			Gizmos.DrawLine(val3, val13);
			Handles.Label((val3 + val12) * 0.5f, "Rotation Left");
			Handles.Label((val3 + val13) * 0.5f, "Rotation Right");
		}
	}
}
public class HuntDollarSR : MonoBehaviour
{
	private IEnumerator Start()
	{
		yield return (object)new WaitForSeconds(3f);
		string str = "CharcoalBriquette(Clone)";
		((Object)((Component)this).gameObject).name = str;
		Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(true);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			Component val = (Component)(object)componentsInChildren[i];
			((Object)val.gameObject).name = str;
		}
	}
}
public class PlayRandomSoundOnSpawn : MonoBehaviour
{
	public AudioClip[] spawnSounds;

	public float volume = 1f;

	[Header("Pitch Settings")]
	public float minPitch = 0.9f;

	public float maxPitch = 1.1f;

	private AudioSource audioSource;

	private void Start()
	{
		if (spawnSounds.Length > 0)
		{
			audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
			audioSource.playOnAwake = false;
			audioSource.spatialBlend = 1f;
			audioSource.volume = volume;
			AudioClip val = spawnSounds[Random.Range(0, spawnSounds.Length)];
			audioSource.pitch = Random.Range(minPitch, maxPitch);
			audioSource.PlayOneShot(val);
		}
	}
}
public class RandomSpinOnSpawn : MonoBehaviour
{
	public float spinForce = 0.5f;

	public Vector3 torqueAxis = new Vector3(1f, 0f, 0f);

	private Rigidbody rb;

	private void Start()
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		rb = ((Component)this).GetComponent<Rigidbody>();
		if ((Object)(object)rb != (Object)null)
		{
			((Component)this).transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
			rb.AddTorque(((Vector3)(ref torqueAxis)).normalized * spinForce, (ForceMode)1);
		}
	}
}