Decompiled source of HuntLastEstate v1.0.8

HuntLastEstate.dll

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

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace BitWizrd.HuntLastEstate
{
	[BepInPlugin("BitWizrd.HuntLastEstate", "HuntLastEstate", "1.0.8")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class HuntLastEstatePlugin : 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.HuntLastEstate");
			OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntLastEstate", "", "lastestate", "", "");
		}
	}
}
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;
		}
	}
}
public class ComponentActivateRandomRuntime : MonoBehaviour
{
	public float Probability;

	public int Group;

	public float SelectionStart;

	private static readonly Dictionary<Transform, Dictionary<int, float>> groupRolls = new Dictionary<Transform, Dictionary<int, float>>();

	private void Awake()
	{
		if (Probability >= 1f)
		{
			return;
		}
		bool flag;
		if (Group != 0)
		{
			Transform root = ((Component)this).transform.root;
			if (!groupRolls.TryGetValue(root, out var value))
			{
				value = new Dictionary<int, float>();
				groupRolls[root] = value;
			}
			if (!value.TryGetValue(Group, out var value2))
			{
				value2 = Random.value;
				value[Group] = value2;
			}
			flag = value2 >= SelectionStart && value2 <= SelectionStart + Probability;
		}
		else
		{
			flag = Random.value <= Probability;
		}
		if (!flag)
		{
			((Component)this).gameObject.SetActive(false);
		}
	}
}
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
{
	public float distanceLimit = 0.25f;

	public float angleLimitLeft = 45f;

	public float angleLimitRight = 45f;

	public float gravityScale = 1f;

	public bool useSpring;

	public float springApproachRate = 0.95f;

	public float damping;

	public Transform hingeGraphic;

	public Vector3 hingeGraphicRotationOffset;

	public bool invertWaggleAxis;

	public bool ManualExecution;

	public float onHitLimitCooldown = 0.05f;

	public Vector3 waggleAxis = Vector3.up;

	public Vector3 rotationAxis = Vector3.up;

	[Header("Gizmo Options")]
	public bool debugGizmos = false;

	public bool showRotationExtremes = false;

	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_0023: 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_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		return ((Component)this).transform.TransformDirection((!invertWaggleAxis) ? waggleAxis : (-waggleAxis));
	}

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

	public void ResetParticlePos()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		particlePos = ((Component)this).transform.position + EffectiveWaggleDir() * 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_003e: 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_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_004f: 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_0052: 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_0068: 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_0075: 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_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: 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_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_011f: 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_012f: 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_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: 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 = particleVel * Mathf.Pow(1f - damping, deltaTime) + val * deltaTime;
		Vector3 val4 = val2 + val3 * deltaTime;
		Vector3 val5 = transform.TransformDirection(((Vector3)(ref rotationAxis)).normalized);
		Vector3 val6 = EffectiveWaggleDir();
		Vector3 position = transform.position;
		if (useSpring)
		{
			val4 = Vector3.Lerp(val4, position + val6 * distanceLimit, 1f - Mathf.Pow(1f - springApproachRate, deltaTime));
		}
		GetEffectiveAngleLimits(out var effectiveAngleMin, out var effectiveAngleMax);
		particlePos = ProjectOnHinge(val4, position, val5, val6, distanceLimit, effectiveAngleMin, effectiveAngleMax);
		particleVel = (particlePos - val2) / deltaTime;
		if ((Object)(object)hingeGraphic != (Object)null)
		{
			hingeGraphic.rotation = Quaternion.LookRotation(particlePos - transform.position, val5) * Quaternion.Euler(hingeGraphicRotationOffset);
		}
	}

	private Vector3 ProjectOnHinge(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection, float distanceLimit, float angleMin, float angleMax)
	{
		//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_0005: 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_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		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 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_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: 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 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)
		//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_000c: 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)
		float num = Vector3.Angle(from, to);
		return num * Mathf.Sign(Vector3.Dot(axis, Vector3.Cross(from, to)));
	}

	private void Start()
	{
		ResetParticlePos();
	}

	private void Update()
	{
		if (!ManualExecution)
		{
			Execute();
		}
	}
}
public class FireLightFlicker : MonoBehaviour
{
	public Light Light;

	public float BaseIntensity = 1f;

	public float FlickerMin = 1f;

	public float FlickerMax = 1f;

	public float FlickerSpeed = 1f;

	private float noiseOffset;

	private void Awake()
	{
		if ((Object)(object)Light == (Object)null)
		{
			Light = ((Component)this).GetComponent<Light>();
		}
		noiseOffset = Random.value * 1000f;
	}

	private void Update()
	{
		if (!((Object)(object)Light == (Object)null))
		{
			float num = Mathf.PerlinNoise(Time.time * FlickerSpeed + noiseOffset, 0f);
			Light.intensity = BaseIntensity * Mathf.Lerp(FlickerMin, FlickerMax, num);
		}
	}
}
public class GunStockLace : MonoBehaviour
{
	public float length = 0.5f;

	public float gravity = 9.81f;

	public float damping = 0.05f;

	public float maxDeviationAngle = 45f;

	public LayerMask collisionMask;

	public bool showGizmos = false;

	private Vector3 pendulumDirection;

	private Vector3 angularVelocity;

	private Quaternion baseRotation;

	private Vector3 restDirection;

	private Vector3 previousPosition;

	private void Start()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0028: 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)
		baseRotation = ((Component)this).transform.rotation;
		restDirection = baseRotation * -Vector3.up;
		pendulumDirection = restDirection;
		previousPosition = ((Component)this).transform.position;
	}

	private void FixedUpdate()
	{
		//IL_0007: 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_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_003f: 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_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_005b: 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_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_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_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_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_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = ((Component)this).transform.position - previousPosition;
		previousPosition = ((Component)this).transform.position;
		float fixedDeltaTime = Time.fixedDeltaTime;
		Vector3 val2 = Vector3.Cross(((Vector3)(ref pendulumDirection)).normalized, Vector3.down) * gravity / length;
		Vector3 val3 = val * 10f / fixedDeltaTime;
		angularVelocity += (val2 + val3) * fixedDeltaTime;
		angularVelocity *= Mathf.Clamp01(1f - damping * fixedDeltaTime);
		Quaternion val4 = Quaternion.Euler(angularVelocity * fixedDeltaTime * 57.29578f);
		pendulumDirection = val4 * pendulumDirection;
		HandleCollisionLimits();
		ClampToMaxAngle();
		((Component)this).transform.rotation = Quaternion.FromToRotation(-Vector3.up, pendulumDirection) * baseRotation;
	}

	private void HandleCollisionLimits()
	{
		//IL_0007: 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_001b: 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_0037: 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_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		RaycastHit val = default(RaycastHit);
		if (Physics.Raycast(((Component)this).transform.position, pendulumDirection, ref val, length, LayerMask.op_Implicit(collisionMask)))
		{
			Vector3 normal = ((RaycastHit)(ref val)).normal;
			Vector3 val2 = Vector3.ProjectOnPlane(pendulumDirection, normal);
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			float num = Vector3.Angle(pendulumDirection, normalized);
			pendulumDirection = Vector3.RotateTowards(pendulumDirection, normalized, num * ((float)Math.PI / 180f), 0f);
			angularVelocity = Vector3.ProjectOnPlane(angularVelocity, normal);
		}
	}

	private void ClampToMaxAngle()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: 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_003e: 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_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		float num = Vector3.Angle(restDirection, pendulumDirection);
		if (num > maxDeviationAngle)
		{
			pendulumDirection = Vector3.RotateTowards(restDirection, pendulumDirection, maxDeviationAngle * ((float)Math.PI / 180f), 0f);
			angularVelocity *= 0.5f;
		}
	}

	private void OnDrawGizmos()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: 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_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)
		if (showGizmos)
		{
			Gizmos.color = Color.yellow;
			Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + pendulumDirection * length);
			Gizmos.color = Color.red;
			Gizmos.DrawWireSphere(((Component)this).transform.position + pendulumDirection * length, 0.02f);
		}
	}
}
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;
		}
	}
}
namespace BitWizrd.Shotgun.M1887
{
	public class LeverShotgun : FVRFireArm
	{
		public enum LifterState
		{
			Down,
			Up
		}

		public enum ZPos
		{
			Forward,
			Middle,
			Rear
		}

		[Serializable]
		public class LeverActuatedPiece
		{
			public Transform Piece;

			public Vector3 PosBack;

			public Vector3 PosForward;

			public InterpStyle InterpStyle;

			public ActuationType ActuationType;
		}

		public enum ActuationType
		{
			Lever,
			Hammer
		}

		[Header("LeverAction Config")]
		public FVRFireArmChamber Chamber;

		public Transform Lever;

		public Transform LeverRoot;

		public Transform Hammer;

		public Transform Trigger;

		public Vector2 TriggerRotRange;

		public FVRAlternateGrip ForeGrip;

		public Vector2 LeverAngleRange = new Vector2(-68f, 0f);

		public Vector2 HammerAngleRange = new Vector2(-36f, 0f);

		public Vector3 EjectionDir = new Vector3(0f, 2f, 0f);

		public Vector3 EjectionSpin = new Vector3(80f, 0f, 0f);

		[Header("Lever Feel Tuning")]
		[Tooltip("Degrees of tolerance for when the lever's current rotation counts as fully open or fully closed. Within this many degrees of either end, ejection/chambering/hammer-cock trigger. Larger = more forgiving about needing to hit the exact endpoint.")]
		public float LeverPositionTolerance = 1f;

		[Tooltip("How far apart (in meters) the player's hands need to move, at minimum, to fully cycle the lever from closed to open. Smaller = a more sensitive/twitchy racking motion, larger = requires a bigger physical pull.")]
		public float RackingDistanceForFullPull = 0.04f;

		[Tooltip("Fraction (0-1) of Racking Distance For Full Pull the player's hands must move apart before the lever starts rotating at all. Prevents tiny hand jitter from nudging the lever open.")]
		[Range(0f, 1f)]
		public float RackingDeadzoneFraction = 0.125f;

		[Tooltip("Fraction (0-1) of Racking Distance For Full Pull the player needs to reach before the lever snaps the rest of the way open on its own. Lower this to make full cycling easier without requiring a precise, complete pull all the way to the physical limit.")]
		[Range(0f, 1f)]
		public float RackingSnapFraction = 0.875f;

		[Tooltip("Degrees per second the lever visually rotates toward its target position once a cycle starts. Higher = snappier, more immediate lever movement.")]
		public float LeverRotationSpeed = 700f;

		private bool m_isLeverReleasePressed;

		private float m_curLeverRot;

		private float m_tarLeverRot;

		private bool m_isActionMovingForward;

		private ZPos m_curLeverPos = ZPos.Rear;

		private ZPos m_lastLeverPos = ZPos.Rear;

		private FVRFirearmMovingProxyRound m_proxy;

		[Header("Round Positions Config")]
		public Transform ReceiverLowerPathForward;

		public Transform ReceiverLowerPathRearward;

		public Transform ReceiverUpperPathForward;

		public Transform ReceiverUpperPathRearward;

		public Transform ReceiverEjectionPathForward;

		public Transform ReceiverEjectionPathRearward;

		public Transform ReceiverEjectionPoint;

		private bool m_isHammerCocked;

		[Header("Spinning Config")]
		public Transform PoseSpinHolder;

		public bool CanSpin;

		private bool m_isSpinning;

		public LeverActuatedPiece[] ActuatedPieces;

		[Header("M1887 Lifter Config")]
		public LeverShotgunLifter Carrier;

		public FVRFireArmChamber LifterChamber;

		public FVRFireArmMagazineReloadTrigger MagazineReloadTrigger;

		public GameObject ReloadTriggerWell;

		public float TriggerResetThreshold = 0.1f;

		public float TriggerFiringThreshold = 0.8f;

		public bool FireOnTriggerDown;

		private float m_triggerFloat;

		private bool m_hasTriggerCycled;

		private bool m_lifterWasFullLastFrame;

		private bool m_hasInitLifterFillTracking;

		private bool m_suppressNextLifterFillSound;

		private int m_lastMagazineRoundCount;

		private bool m_hasInitMagazineTracking;

		private bool useLinearRacking = true;

		private float BaseAngleOffset;

		private Vector3 m_baseSpinPosition = Vector3.zero;

		private float curDistanceBetweenGrips = 1f;

		private float lastDistanceBetweenGrips = -1f;

		private float m_rackingDisplacement;

		private float xSpinRot;

		private float xSpinVel;

		public ZPos CurLeverPos => m_curLeverPos;

		public bool IsHammerCocked => m_isHammerCocked;

		public override void Awake()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//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)
			((FVRFireArm)this).Awake();
			EnsureChamberProxyStub(Chamber);
			EnsureChamberProxyStub(LifterChamber);
			base.FChambers.Add(Chamber);
			if ((Object)(object)LifterChamber != (Object)null)
			{
				base.FChambers.Add(LifterChamber);
			}
			GameObject val = new GameObject("m_proxyRound");
			m_proxy = val.AddComponent<FVRFirearmMovingProxyRound>();
			m_proxy.Init(((Component)this).transform);
			m_baseSpinPosition = PoseSpinHolder.localPosition;
		}

		private static void EnsureChamberProxyStub(FVRFireArmChamber chamber)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			if (!((Object)(object)chamber == (Object)null))
			{
				if ((Object)(object)chamber.ProxyRound == (Object)null)
				{
					GameObject val = new GameObject("ProxyRoundStub");
					val.transform.SetParent(((Component)chamber).transform, false);
					chamber.ProxyRound = val.transform;
				}
				if ((Object)(object)chamber.ProxyMesh == (Object)null)
				{
					chamber.ProxyMesh = ((Component)chamber.ProxyRound).gameObject.AddComponent<MeshFilter>();
				}
				if ((Object)(object)chamber.ProxyRenderer == (Object)null)
				{
					chamber.ProxyRenderer = ((Component)chamber.ProxyRound).gameObject.AddComponent<MeshRenderer>();
					((Renderer)chamber.ProxyRenderer).enabled = false;
				}
			}
		}

		public override void BeginInteraction(FVRViveHand hand)
		{
			((FVRFireArm)this).BeginInteraction(hand);
			SetBaseHandAngle(hand);
		}

		public override void FVRUpdate()
		{
			((FVRFireArm)this).FVRUpdate();
			UpdateLifterManualFillDetection();
			UpdateLifterTubeAbsorption();
		}

		private void UpdateLifterManualFillDetection()
		{
			if ((Object)(object)LifterChamber == (Object)null)
			{
				return;
			}
			bool isFull = LifterChamber.IsFull;
			if (!m_hasInitLifterFillTracking)
			{
				m_lifterWasFullLastFrame = isFull;
				m_hasInitLifterFillTracking = true;
				return;
			}
			if (isFull && !m_lifterWasFullLastFrame && !m_suppressNextLifterFillSound)
			{
				((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)5, 1f);
			}
			m_lifterWasFullLastFrame = isFull;
			m_suppressNextLifterFillSound = false;
		}

		private void UpdateLifterTubeAbsorption()
		{
			if ((Object)(object)base.Magazine == (Object)null || (Object)(object)LifterChamber == (Object)null)
			{
				return;
			}
			int numRounds = base.Magazine.m_numRounds;
			if (!m_hasInitMagazineTracking)
			{
				m_lastMagazineRoundCount = numRounds;
				m_hasInitMagazineTracking = true;
				return;
			}
			if (numRounds > m_lastMagazineRoundCount && LifterChamber.IsFull && !base.Magazine.IsFull())
			{
				FVRFireArmRound round = LifterChamber.GetRound();
				if ((Object)(object)round != (Object)null)
				{
					base.Magazine.AddRound(round, true, true, true);
					LifterChamber.SetRound((FVRFireArmRound)null, false);
					numRounds = base.Magazine.m_numRounds;
				}
			}
			m_lastMagazineRoundCount = numRounds;
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: 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)
			((FVRPhysicalObject)this).UpdateInteraction(hand);
			UpdateLever();
			Trigger.localEulerAngles = new Vector3(Mathf.Lerp(TriggerRotRange.x, TriggerRotRange.y, hand.Input.TriggerFloat), 0f, 0f);
			if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !((FVRPhysicalObject)this).IsAltHeld)
			{
				m_triggerFloat = hand.Input.TriggerFloat;
			}
			if (!m_hasTriggerCycled)
			{
				if (m_triggerFloat >= TriggerFiringThreshold)
				{
					m_hasTriggerCycled = true;
				}
			}
			else if (m_triggerFloat <= TriggerResetThreshold)
			{
				m_hasTriggerCycled = false;
			}
			if (m_curLeverPos == ZPos.Rear && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && m_isHammerCocked && ((FireOnTriggerDown && hand.Input.TriggerDown) || (!FireOnTriggerDown && m_hasTriggerCycled)) && (!Chamber.IsFull || !Chamber.IsSpent))
			{
				Fire();
				if (!FireOnTriggerDown)
				{
					m_hasTriggerCycled = true;
				}
			}
			float num = Mathf.InverseLerp(LeverAngleRange.y, LeverAngleRange.x, m_curLeverRot);
			if ((Object)(object)Hammer != (Object)null)
			{
				if (m_isHammerCocked)
				{
					Hammer.localEulerAngles = new Vector3(HammerAngleRange.x, 0f, 0f);
				}
				else
				{
					Hammer.localEulerAngles = new Vector3(Mathf.Lerp(HammerAngleRange.y, HammerAngleRange.x, num), 0f, 0f);
				}
			}
		}

		public override void EndInteraction(FVRViveHand hand)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			Trigger.localEulerAngles = new Vector3(0f, 0f, 0f);
			((FVRFireArm)this).EndInteraction(hand);
		}

		private void SetBaseHandAngle(FVRViveHand hand)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0041: 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_0043: 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)
			Vector3 val = Vector3.ProjectOnPlane(((FVRInteractiveObject)this).m_hand.PoseOverride.forward, LeverRoot.right);
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			Vector3 forward = LeverRoot.forward;
			float baseAngleOffset = Mathf.Atan2(Vector3.Dot(LeverRoot.right, Vector3.Cross(forward, normalized)), Vector3.Dot(forward, normalized)) * 57.29578f;
			BaseAngleOffset = baseAngleOffset;
		}

		private void UpdateLever()
		{
			//IL_00f0: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: 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_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: 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_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0815: Unknown result type (might be due to invalid IL or missing references)
			//IL_0820: Unknown result type (might be due to invalid IL or missing references)
			//IL_0830: Unknown result type (might be due to invalid IL or missing references)
			//IL_083b: Unknown result type (might be due to invalid IL or missing references)
			//IL_084b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0850: Unknown result type (might be due to invalid IL or missing references)
			//IL_085b: Unknown result type (might be due to invalid IL or missing references)
			//IL_086b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0870: Unknown result type (might be due to invalid IL or missing references)
			//IL_087b: Unknown result type (might be due to invalid IL or missing references)
			//IL_088b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0896: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a11: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a26: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			bool flag2 = false;
			if (((FVRInteractiveObject)this).IsHeld)
			{
				if (((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode)
				{
					flag = ((FVRInteractiveObject)this).m_hand.Input.BYButtonPressed;
					flag2 = ((FVRInteractiveObject)this).m_hand.Input.BYButtonUp;
				}
				else
				{
					flag = ((FVRInteractiveObject)this).m_hand.Input.TouchpadPressed;
					flag2 = ((FVRInteractiveObject)this).m_hand.Input.TouchpadUp;
				}
			}
			m_isLeverReleasePressed = false;
			bool flag3 = false;
			if (!((FVRPhysicalObject)this).IsAltHeld && (Object)(object)((FVRInteractiveObject)ForeGrip).m_hand != (Object)null)
			{
				if (((FVRInteractiveObject)ForeGrip).m_hand.Input.TriggerPressed && ((FVRInteractiveObject)ForeGrip).m_hasTriggeredUpSinceBegin && (int)GM.Options.ControlOptions.LongGunSnipingAssist != 1)
				{
					flag3 = true;
				}
				m_isLeverReleasePressed = true;
				curDistanceBetweenGrips = Vector3.Distance(((FVRInteractiveObject)this).m_hand.PalmTransform.position, ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.PalmTransform.position);
				if (lastDistanceBetweenGrips < 0f)
				{
					lastDistanceBetweenGrips = curDistanceBetweenGrips;
				}
			}
			else
			{
				lastDistanceBetweenGrips = -1f;
			}
			bool flag4 = !((FVRPhysicalObject)this).IsAltHeld && flag;
			m_isSpinning = false;
			if (flag4 && CanSpin)
			{
				m_isSpinning = true;
			}
			bool flag5 = false;
			if (m_isHammerCocked && !flag4 && m_curLeverPos == ZPos.Rear)
			{
				flag5 = true;
			}
			if (flag3)
			{
				flag5 = false;
			}
			if ((Object)(object)((FVRPhysicalObject)this).AltGrip == (Object)null && !((FVRPhysicalObject)this).IsAltHeld)
			{
				flag5 = true;
			}
			if (flag5 && useLinearRacking)
			{
				SetBaseHandAngle(((FVRInteractiveObject)this).m_hand);
				lastDistanceBetweenGrips = curDistanceBetweenGrips;
			}
			if (flag2 && m_curLeverPos != ZPos.Forward && m_rackingDisplacement < RackingDeadzoneFraction * RackingDistanceForFullPull)
			{
				m_tarLeverRot = 0f;
				PoseSpinHolder.localPosition = m_baseSpinPosition;
				lastDistanceBetweenGrips = curDistanceBetweenGrips;
				m_rackingDisplacement = 0f;
			}
			else if (m_isLeverReleasePressed && !flag5)
			{
				if (useLinearRacking)
				{
					curDistanceBetweenGrips = Vector3.Distance(((FVRInteractiveObject)this).m_hand.PalmTransform.position, ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.PalmTransform.position);
					Vector3 val = ((FVRInteractiveObject)this).m_hand.Input.VelLinearWorld - ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.Input.VelLinearWorld;
					float num = ((Vector3)(ref val)).magnitude * Time.deltaTime * 2f;
					float num2 = Mathf.Clamp(lastDistanceBetweenGrips - curDistanceBetweenGrips, 0f - num, num);
					m_rackingDisplacement += num2;
					m_rackingDisplacement = Mathf.Clamp(m_rackingDisplacement, 0f, RackingDistanceForFullPull);
					if (m_rackingDisplacement < RackingDeadzoneFraction * RackingDistanceForFullPull)
					{
						m_rackingDisplacement = 0f;
					}
					if (m_rackingDisplacement > RackingSnapFraction * RackingDistanceForFullPull)
					{
						m_rackingDisplacement = RackingDistanceForFullPull;
					}
					PoseSpinHolder.localPosition = m_baseSpinPosition + Vector3.forward * m_rackingDisplacement * 2f;
					m_tarLeverRot = Mathf.Lerp(LeverAngleRange.y, LeverAngleRange.x, m_rackingDisplacement / RackingDistanceForFullPull);
					lastDistanceBetweenGrips = curDistanceBetweenGrips;
				}
				else
				{
					Vector3 val2 = Vector3.ProjectOnPlane(((FVRInteractiveObject)this).m_hand.PoseOverride.forward, LeverRoot.right);
					Vector3 normalized = ((Vector3)(ref val2)).normalized;
					Vector3 forward = LeverRoot.forward;
					float num3 = Mathf.Atan2(Vector3.Dot(LeverRoot.right, Vector3.Cross(forward, normalized)), Vector3.Dot(forward, normalized)) * 57.29578f;
					num3 -= BaseAngleOffset;
					num3 *= 3f;
					num3 = Mathf.Clamp(num3, LeverAngleRange.x, LeverAngleRange.y);
					m_tarLeverRot = num3;
				}
			}
			else if (m_isSpinning)
			{
				float num4 = Mathf.Clamp(((Vector3)(ref ((FVRInteractiveObject)this).m_hand.Input.VelLinearWorld)).magnitude - 1f, 0f, 3f);
				float num5 = num4 * 120f;
				float num6 = Mathf.Repeat(Mathf.Abs(xSpinRot), 360f);
				num5 = Mathf.Clamp(num5, 0f, num6 * 0.5f);
				m_tarLeverRot = Mathf.Clamp(0f - num5, LeverAngleRange.x, LeverAngleRange.y);
				PoseSpinHolder.localPosition = m_baseSpinPosition;
			}
			if (Mathf.Abs(m_curLeverRot - LeverAngleRange.y) < LeverPositionTolerance)
			{
				if (m_lastLeverPos == ZPos.Forward)
				{
					m_curLeverPos = ZPos.Middle;
				}
				else
				{
					m_curLeverPos = ZPos.Rear;
					base.IsBreachOpenForGasOut = false;
				}
			}
			else if (Mathf.Abs(m_curLeverRot - LeverAngleRange.x) < LeverPositionTolerance)
			{
				if (m_lastLeverPos == ZPos.Rear)
				{
					m_curLeverPos = ZPos.Middle;
				}
				else
				{
					m_curLeverPos = ZPos.Forward;
					base.IsBreachOpenForGasOut = true;
				}
			}
			else
			{
				m_curLeverPos = ZPos.Middle;
				base.IsBreachOpenForGasOut = true;
			}
			if (m_curLeverPos == ZPos.Rear && m_lastLeverPos != ZPos.Rear)
			{
				m_tarLeverRot = LeverAngleRange.y;
				bool flag6 = (Object)(object)Carrier != (Object)null && Carrier.GetLifterState() == LifterState.Up;
				if ((Object)(object)Carrier != (Object)null)
				{
					Carrier.SetLifterState(LifterState.Down);
				}
				m_curLeverRot = LeverAngleRange.y;
				if (flag6 && !Chamber.IsFull && (Object)(object)LifterChamber != (Object)null && LifterChamber.IsFull)
				{
					TransferLifterToChamber();
				}
				else
				{
					((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)41, 1f);
				}
				if ((Object)(object)LifterChamber != (Object)null && !LifterChamber.IsFull && (Object)(object)base.Magazine != (Object)null && base.Magazine.HasARound())
				{
					GameObject val3 = base.Magazine.RemoveRound(false);
					FVRFireArmRound val4 = ((!((Object)(object)val3 != (Object)null)) ? null : val3.GetComponent<FVRFireArmRound>());
					if ((Object)(object)val4 != (Object)null)
					{
						m_suppressNextLifterFillSound = true;
						LifterChamber.SetRound(val4, true);
					}
				}
				m_isActionMovingForward = false;
			}
			else if (m_curLeverPos == ZPos.Forward && m_lastLeverPos != ZPos.Forward)
			{
				m_tarLeverRot = LeverAngleRange.x;
				if (!m_isActionMovingForward && (Object)(object)Carrier != (Object)null)
				{
					Carrier.SetLifterState(LifterState.Up);
				}
				m_curLeverRot = LeverAngleRange.x;
				m_isHammerCocked = true;
				((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
				if (!m_isActionMovingForward && Chamber.IsFull)
				{
					((FVRInteractiveObject)this).m_hand.Buzz(((FVRInteractiveObject)this).m_hand.Buzzer.Buzz_OnHoverInteractive);
					Chamber.EjectRound(ReceiverEjectionPoint.position, ((Component)this).transform.right * EjectionDir.x + ((Component)this).transform.up * EjectionDir.y + ((Component)this).transform.forward * EjectionDir.z, ((Component)this).transform.right * EjectionSpin.x + ((Component)this).transform.up * EjectionSpin.y + ((Component)this).transform.forward * EjectionSpin.z, ReceiverEjectionPoint.position, ReceiverEjectionPoint.rotation, false);
					((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)11, 1f);
				}
				else
				{
					((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)40, 1f);
				}
				m_isActionMovingForward = true;
			}
			float num7 = Mathf.InverseLerp(LeverAngleRange.y, LeverAngleRange.x, m_curLeverRot);
			bool flag7 = m_curLeverPos != ZPos.Rear;
			bool flag8 = (Object)(object)Chamber != (Object)null && !Chamber.IsFull;
			Chamber.IsAccessible = flag7 && flag8;
			if ((Object)(object)LifterChamber != (Object)null)
			{
				bool flag9 = (Object)(object)Carrier != (Object)null && Carrier.GetLifterState() == LifterState.Down;
				LifterChamber.IsAccessible = flag9 && !LifterChamber.IsFull;
			}
			for (int i = 0; i < ActuatedPieces.Length; i++)
			{
				if ((int)ActuatedPieces[i].InterpStyle == 0)
				{
					ActuatedPieces[i].Piece.localPosition = Vector3.Lerp(ActuatedPieces[i].PosBack, ActuatedPieces[i].PosForward, num7);
				}
				else
				{
					ActuatedPieces[i].Piece.localEulerAngles = Vector3.Lerp(ActuatedPieces[i].PosBack, ActuatedPieces[i].PosForward, num7);
				}
			}
			m_lastLeverPos = m_curLeverPos;
		}

		private void Fire()
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			m_isHammerCocked = false;
			((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
			if (Chamber.Fire())
			{
				((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f);
				((FVRFireArm)this).FireMuzzleSmoke();
				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);
				((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f);
			}
		}

		public override void FVRFixedUpdate()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			((FVRFireArm)this).FVRFixedUpdate();
			CheckMagazineState();
			m_curLeverRot = Mathf.MoveTowards(m_curLeverRot, m_tarLeverRot, LeverRotationSpeed * Time.deltaTime);
			Lever.localEulerAngles = new Vector3(m_curLeverRot, 0f, 0f);
			UpdateSpinning();
		}

		private void UpdateSpinning()
		{
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: 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_016c: 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)
			if (!((FVRInteractiveObject)this).IsHeld || ((FVRPhysicalObject)this).IsAltHeld || (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null)
			{
				m_isSpinning = false;
			}
			if (m_isSpinning)
			{
				Vector3 val = Vector3.zero;
				if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)
				{
					val = ((FVRInteractiveObject)this).m_hand.Input.VelLinearWorld;
				}
				float num = Vector3.Dot(((Vector3)(ref val)).normalized, ((Component)this).transform.up);
				num = Mathf.Clamp(num, 0f - ((Vector3)(ref val)).magnitude, ((Vector3)(ref val)).magnitude);
				if (Mathf.Abs(xSpinVel) < 90f)
				{
					xSpinVel += num * Time.deltaTime * 600f;
				}
				else if (Mathf.Sign(num) == Mathf.Sign(xSpinVel))
				{
					xSpinVel += num * Time.deltaTime * 600f;
				}
				if (Mathf.Abs(xSpinVel) < 90f)
				{
					if (Vector3.Dot(((Component)this).transform.up, Vector3.down) >= 0f && Mathf.Sign(xSpinVel) == 1f)
					{
						xSpinVel += Time.deltaTime * 50f;
					}
					if (Vector3.Dot(((Component)this).transform.up, Vector3.down) < 0f && Mathf.Sign(xSpinVel) == -1f)
					{
						xSpinVel -= Time.deltaTime * 50f;
					}
				}
				xSpinVel = Mathf.Clamp(xSpinVel, -200f, 200f);
				xSpinRot += xSpinVel * Time.deltaTime * 5f;
				PoseSpinHolder.localEulerAngles = new Vector3(xSpinRot, 0f, 0f);
				xSpinVel = Mathf.Lerp(xSpinVel, 0f, Time.deltaTime * 0.6f);
			}
			else
			{
				xSpinRot = 0f;
				xSpinVel = 0f;
				PoseSpinHolder.localEulerAngles = new Vector3(xSpinRot, 0f, 0f);
			}
		}

		private void TransferLifterToChamber()
		{
			FVRFireArmRound round = LifterChamber.GetRound();
			if ((Object)(object)round != (Object)null)
			{
				Chamber.SetRound(round, true);
				LifterChamber.SetRound((FVRFireArmRound)null, false);
				if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)
				{
					((FVRInteractiveObject)this).m_hand.Buzz(((FVRInteractiveObject)this).m_hand.Buzzer.Buzz_OnHoverInteractive);
				}
				((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)10, 1f);
			}
			else
			{
				LifterChamber.SetRound((FVRFireArmRound)null, false);
			}
		}

		private void CheckMagazineState()
		{
			if (!((Object)(object)base.Magazine == (Object)null))
			{
				bool flag = base.Magazine.IsFull();
				bool flag2 = (Object)(object)Carrier != (Object)null && Carrier.GetLifterState() == LifterState.Down;
				bool active = m_curLeverPos != ZPos.Rear && flag2 && !flag;
				if ((Object)(object)MagazineReloadTrigger != (Object)null)
				{
					((Component)MagazineReloadTrigger).gameObject.SetActive(active);
				}
				if ((Object)(object)ReloadTriggerWell != (Object)null)
				{
					ReloadTriggerWell.SetActive(active);
				}
			}
		}

		public void NotifyLifterLowered()
		{
			if (m_curLeverPos != ZPos.Rear && !((Object)(object)LifterChamber == (Object)null) && LifterChamber.IsFull && (Object)(object)base.Magazine != (Object)null && !base.Magazine.IsFull())
			{
				FVRFireArmRound round = LifterChamber.GetRound();
				if ((Object)(object)round != (Object)null)
				{
					base.Magazine.AddRound(round, true, true, true);
					LifterChamber.SetRound((FVRFireArmRound)null, false);
				}
			}
		}

		public void NotifyLifterRaised()
		{
		}

		public override List<FireArmRoundClass> GetChamberRoundList()
		{
			//IL_0034: 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)
			List<FireArmRoundClass> list = new List<FireArmRoundClass>();
			if (Chamber.IsFull && !Chamber.IsSpent)
			{
				list.Add(Chamber.GetRound().RoundClass);
			}
			if ((Object)(object)LifterChamber != (Object)null && LifterChamber.IsFull && !LifterChamber.IsSpent)
			{
				list.Add(LifterChamber.GetRound().RoundClass);
			}
			return (list.Count <= 0) ? null : list;
		}

		public override void SetLoadedChambers(List<FireArmRoundClass> rounds)
		{
			//IL_0016: 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)
			if (rounds.Count > 0)
			{
				Chamber.Autochamber(rounds[0]);
			}
			if (rounds.Count > 1 && (Object)(object)LifterChamber != (Object)null)
			{
				m_suppressNextLifterFillSound = true;
				LifterChamber.Autochamber(rounds[1]);
			}
		}
	}
	public class LeverShotgunLifter : FVRInteractiveObject
	{
		public LeverShotgun Gun;

		public float RotUp = -24f;

		public float RotDown = 0f;

		public float SpringLerpSpeed = 14f;

		public float HandLerpSpeed = 90f;

		public float HapticFrequency = 0.1f;

		public float HandUpDistance = 0.01f;

		public float HandDownDistance = 0.045f;

		[Header("Shell Catch")]
		public Transform ShellCatch;

		public float ShellCatchRotUp = 23.5f;

		public float ShellCatchRotDown = 0f;

		private float m_lifterLerp;

		private bool m_isBeingHeld;

		private float m_hapticTimer;

		private float m_lastLifterLerp;

		private LeverShotgun.LifterState m_currentState = LeverShotgun.LifterState.Down;

		public override void Awake()
		{
			((FVRInteractiveObject)this).Awake();
			if ((Object)(object)Gun == (Object)null)
			{
				Gun = ((Component)this).GetComponentInParent<LeverShotgun>();
			}
			m_lifterLerp = 0f;
		}

		public override void UpdateInteraction(FVRViveHand hand)
		{
			//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_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_0087: 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_0097: 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_00ad: 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_00b7: 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_00ca: 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)
			((FVRInteractiveObject)this).UpdateInteraction(hand);
			if (!((Object)(object)Gun != (Object)null) || Gun.CurLeverPos == LeverShotgun.ZPos.Middle)
			{
				m_isBeingHeld = false;
			}
			else if (hand.Input.TriggerFloat > 0.5f)
			{
				m_isBeingHeld = true;
				Vector3 pos = ((HandInput)(ref hand.Input)).Pos;
				Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(((Component)this).transform.position - ((Component)this).transform.up * HandUpDistance, ((Component)this).transform.position - ((Component)this).transform.up * HandDownDistance, pos);
				float num = Mathf.InverseLerp(HandUpDistance, HandDownDistance, Vector3.Distance(closestValidPoint, ((Component)this).transform.position));
				if (!(num < m_lifterLerp))
				{
					return;
				}
				m_lifterLerp = Mathf.Lerp(m_lifterLerp, num, Time.deltaTime * HandLerpSpeed);
				UpdateStateFromLerp();
				bool flag = Mathf.Abs(m_lifterLerp - m_lastLifterLerp) > 0.001f;
				m_lastLifterLerp = m_lifterLerp;
				if (flag)
				{
					m_hapticTimer += Time.deltaTime;
					if (m_hapticTimer >= HapticFrequency)
					{
						hand.Buzz(hand.Buzzer.Buzz_BeginInteraction);
						m_hapticTimer = 0f;
					}
				}
			}
			else
			{
				m_isBeingHeld = false;
			}
		}

		public float GetLifterLerp()
		{
			return m_lifterLerp;
		}

		public bool IsLifterBeingHeld()
		{
			return m_isBeingHeld;
		}

		public LeverShotgun.LifterState GetLifterState()
		{
			return m_currentState;
		}

		public void SetLifterState(LeverShotgun.LifterState state)
		{
			if (state != m_currentState && (Object)(object)Gun != (Object)null)
			{
				if (state == LeverShotgun.LifterState.Up)
				{
					((FVRFireArm)Gun).PlayAudioEvent((FirearmAudioEventType)23, 1f);
					Gun.NotifyLifterRaised();
				}
				else
				{
					((FVRFireArm)Gun).PlayAudioEvent((FirearmAudioEventType)24, 1f);
					Gun.NotifyLifterLowered();
				}
			}
			m_currentState = state;
			switch (state)
			{
			case LeverShotgun.LifterState.Down:
				m_lifterLerp = 0f;
				break;
			case LeverShotgun.LifterState.Up:
				m_lifterLerp = 1f;
				break;
			}
		}

		private void UpdateStateFromLerp()
		{
			LeverShotgun.LifterState lifterState = ((!(m_lifterLerp < 0.5f)) ? LeverShotgun.LifterState.Up : LeverShotgun.LifterState.Down);
			if (lifterState != m_currentState)
			{
				SetLifterState(lifterState);
			}
		}

		public override void FVRFixedUpdate()
		{
			//IL_007b: 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)
			((FVRInteractiveObject)this).FVRFixedUpdate();
			float num = ((m_currentState != LeverShotgun.LifterState.Up) ? 0f : 1f);
			if (!m_isBeingHeld)
			{
				m_lifterLerp = Mathf.Lerp(m_lifterLerp, num, Time.deltaTime * SpringLerpSpeed);
				UpdateStateFromLerp();
			}
			((Component)this).transform.localEulerAngles = new Vector3(Mathf.Lerp(RotDown, RotUp, m_lifterLerp), 0f, 0f);
			if ((Object)(object)ShellCatch != (Object)null)
			{
				ShellCatch.localEulerAngles = new Vector3(Mathf.Lerp(ShellCatchRotDown, ShellCatchRotUp, m_lifterLerp), 0f, 0f);
			}
		}
	}
}
public class ParticleAffectorCoordinator : MonoBehaviour
{
	[Serializable]
	public struct BeamConfig
	{
		public Transform SourceTransform;

		public Vector3 SourceOffset;

		public Transform DestTransform;

		public Vector3 DestOffset;

		public bool HasLine;
	}

	[Serializable]
	public struct LocationOffsetEntry
	{
		public Vector3 Direction;

		public float ScaleMin;

		public float ScaleMax;
	}

	[Serializable]
	public struct VelocityExtraEntry
	{
		public Vector3 Direction;

		public float ConeAngleDeg;

		public float SpeedMin;

		public float SpeedMax;
	}

	[Serializable]
	public struct GravityEntry
	{
		public bool UseAxis;

		public float Accel;

		public float Decay;

		public Vector3 Axis;

		public Transform Target;
	}

	[Serializable]
	public struct VortexEntry
	{
		public float Speed;

		public float Decay;

		public Vector3 Axis;

		public Transform Target;

		public float Drag;
	}

	public ParticleSystem Ps;

	public bool HasBeam;

	public BeamConfig Beam;

	public LocationOffsetEntry[] LocationOffsets;

	public string[] LocationOffsetScaleCurveKeysStrs;

	[NonSerialized]
	private AnimationCurve[] _locationOffsetScaleCurves;

	public VelocityExtraEntry[] VelocityExtras;

	public GravityEntry[] GravityEntries;

	public VortexEntry[] VortexEntries;

	public bool HasGravityDrag;

	public float GravityDrag;

	public bool HasMoveRelativeToEmitter;

	public Transform MoveRelEmitter;

	public float MoveRelPositionInherit;

	public float MoveRelVelocityInherit;

	public bool HasAlignRotation;

	public Transform AlignParentTransform;

	public Vector3 AlignAxisLocal;

	[NonSerialized]
	private Vector3 _alignTargetWorldDir;

	private Particle[] buffer;

	private Vector3 beamSourceWorld;

	private Vector3 beamDestWorld;

	private Vector3 lastEmitterPos;

	private Quaternion lastEmitterRot;

	private HashSet<uint> lastFrameSeeds = new HashSet<uint>();

	private HashSet<uint> currentFrameSeeds = new HashSet<uint>();

	private void Awake()
	{
		//IL_00b7: 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_01ce: 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_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: 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_00de: 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_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: 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_0235: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//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_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Ps == (Object)null)
		{
			Ps = ((Component)this).GetComponent<ParticleSystem>();
		}
		if (LocationOffsetScaleCurveKeysStrs != null && LocationOffsetScaleCurveKeysStrs.Length > 0)
		{
			_locationOffsetScaleCurves = (AnimationCurve[])(object)new AnimationCurve[LocationOffsetScaleCurveKeysStrs.Length];
			for (int i = 0; i < LocationOffsetScaleCurveKeysStrs.Length; i++)
			{
				_locationOffsetScaleCurves[i] = ParseScaleCurveKeysStr(LocationOffsetScaleCurveKeysStrs[i]);
			}
		}
		if (HasBeam)
		{
			Vector3 val = ((!((Object)(object)Beam.SourceTransform != (Object)null)) ? ((Component)this).transform.position : Beam.SourceTransform.position);
			Vector3 val2 = ((!((Object)(object)Beam.DestTransform != (Object)null)) ? ((Component)this).transform.position : Beam.DestTransform.position);
			beamSourceWorld = val + Beam.SourceOffset;
			beamDestWorld = val2 + Beam.DestOffset;
			if (Beam.HasLine)
			{
				LineRenderer val3 = ((Component)this).GetComponent<LineRenderer>();
				if ((Object)(object)val3 == (Object)null)
				{
					val3 = ((Component)this).gameObject.AddComponent<LineRenderer>();
				}
				ParticleSystemRenderer component = ((Component)this).GetComponent<ParticleSystemRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					((Renderer)val3).material = ((Renderer)component).sharedMaterial;
				}
				val3.useWorldSpace = true;
				val3.positionCount = 2;
				val3.SetPosition(0, beamSourceWorld);
				val3.SetPosition(1, beamDestWorld);
			}
		}
		if (HasMoveRelativeToEmitter)
		{
			if ((Object)(object)MoveRelEmitter == (Object)null)
			{
				MoveRelEmitter = ((Component)this).transform;
			}
			lastEmitterPos = MoveRelEmitter.position;
			lastEmitterRot = MoveRelEmitter.rotation;
		}
		if (HasAlignRotation)
		{
			Quaternion val4 = ((!((Object)(object)AlignParentTransform != (Object)null)) ? Quaternion.identity : AlignParentTransform.rotation);
			Vector3 val5 = val4 * AlignAxisLocal;
			_alignTargetWorldDir = ((Vector3)(ref val5)).normalized;
		}
	}

	private void LateUpdate()
	{
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: 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_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: 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_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_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0954: Unknown result type (might be due to invalid IL or missing references)
		//IL_0956: Unknown result type (might be due to invalid IL or missing references)
		//IL_0962: Unknown result type (might be due to invalid IL or missing references)
		//IL_0967: 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_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: 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_0212: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0238: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_032f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0334: Unknown result type (might be due to invalid IL or missing references)
		//IL_0343: Unknown result type (might be due to invalid IL or missing references)
		//IL_0348: 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_0380: 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_0389: Unknown result type (might be due to invalid IL or missing references)
		//IL_038e: Unknown result type (might be due to invalid IL or missing references)
		//IL_048e: Unknown result type (might be due to invalid IL or missing references)
		//IL_049d: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0501: Unknown result type (might be due to invalid IL or missing references)
		//IL_08c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_08dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0567: Unknown result type (might be due to invalid IL or missing references)
		//IL_0557: Unknown result type (might be due to invalid IL or missing references)
		//IL_068b: Unknown result type (might be due to invalid IL or missing references)
		//IL_068d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0698: Unknown result type (might be due to invalid IL or missing references)
		//IL_069d: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_056c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0843: Unknown result type (might be due to invalid IL or missing references)
		//IL_0845: Unknown result type (might be due to invalid IL or missing references)
		//IL_0848: Unknown result type (might be due to invalid IL or missing references)
		//IL_084d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0852: Unknown result type (might be due to invalid IL or missing references)
		//IL_0857: Unknown result type (might be due to invalid IL or missing references)
		//IL_0859: Unknown result type (might be due to invalid IL or missing references)
		//IL_085e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0860: Unknown result type (might be due to invalid IL or missing references)
		//IL_0862: Unknown result type (might be due to invalid IL or missing references)
		//IL_086a: Unknown result type (might be due to invalid IL or missing references)
		//IL_086f: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0595: Unknown result type (might be due to invalid IL or missing references)
		//IL_058b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0422: Unknown result type (might be due to invalid IL or missing references)
		//IL_0424: Unknown result type (might be due to invalid IL or missing references)
		//IL_0433: Unknown result type (might be due to invalid IL or missing references)
		//IL_0438: Unknown result type (might be due to invalid IL or missing references)
		//IL_043f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0444: Unknown result type (might be due to invalid IL or missing references)
		//IL_0449: Unknown result type (might be due to invalid IL or missing references)
		//IL_0883: Unknown result type (might be due to invalid IL or missing references)
		//IL_0885: Unknown result type (might be due to invalid IL or missing references)
		//IL_0887: Unknown result type (might be due to invalid IL or missing references)
		//IL_088c: Unknown result type (might be due to invalid IL or missing references)
		//IL_088e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0890: Unknown result type (might be due to invalid IL or missing references)
		//IL_0898: Unknown result type (might be due to invalid IL or missing references)
		//IL_089d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0720: Unknown result type (might be due to invalid IL or missing references)
		//IL_0716: Unknown result type (might be due to invalid IL or missing references)
		//IL_059a: Unknown result type (might be due to invalid IL or missing references)
		//IL_059c: Unknown result type (might be due to invalid IL or missing references)
		//IL_059e: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0725: Unknown result type (might be due to invalid IL or missing references)
		//IL_0727: Unknown result type (might be due to invalid IL or missing references)
		//IL_0729: Unknown result type (might be due to invalid IL or missing references)
		//IL_072b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0730: Unknown result type (might be due to invalid IL or missing references)
		//IL_0764: Unknown result type (might be due to invalid IL or missing references)
		//IL_0766: Unknown result type (might be due to invalid IL or missing references)
		//IL_0768: Unknown result type (might be due to invalid IL or missing references)
		//IL_076d: Unknown result type (might be due to invalid IL or missing references)
		//IL_076f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0771: Unknown result type (might be due to invalid IL or missing references)
		//IL_0773: Unknown result type (might be due to invalid IL or missing references)
		//IL_0775: Unknown result type (might be due to invalid IL or missing references)
		//IL_077c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0781: Unknown result type (might be due to invalid IL or missing references)
		//IL_0786: Unknown result type (might be due to invalid IL or missing references)
		//IL_0788: Unknown result type (might be due to invalid IL or missing references)
		//IL_078d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0618: Unknown result type (might be due to invalid IL or missing references)
		//IL_061a: Unknown result type (might be due to invalid IL or missing references)
		//IL_061c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0621: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0603: Unknown result type (might be due to invalid IL or missing references)
		//IL_0608: Unknown result type (might be due to invalid IL or missing references)
		//IL_060a: Unknown result type (might be due to invalid IL or missing references)
		//IL_060f: Unknown result type (might be due to invalid IL or missing references)
		//IL_07bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_07cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_064f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0653: Unknown result type (might be due to invalid IL or missing references)
		//IL_065d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0662: Unknown result type (might be due to invalid IL or missing references)
		//IL_0667: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Ps == (Object)null)
		{
			return;
		}
		bool flag = GravityEntries != null && GravityEntries.Length > 0;
		bool flag2 = VortexEntries != null && VortexEntries.Length > 0;
		bool flag3 = LocationOffsets != null && LocationOffsets.Length > 0;
		bool flag4 = VelocityExtras != null && VelocityExtras.Length > 0;
		if (!HasBeam && !flag3 && !flag4 && !flag && !flag2 && !HasMoveRelativeToEmitter && !HasAlignRotation)
		{
			return;
		}
		float num = Mathf.Max(Time.deltaTime, 0.0001f);
		Vector3 val = Vector3.zero;
		Quaternion val2 = Quaternion.identity;
		if (HasMoveRelativeToEmitter && (Object)(object)MoveRelEmitter != (Object)null)
		{
			val = MoveRelEmitter.position;
			val2 = MoveRelEmitter.rotation * Quaternion.Inverse(lastEmitterRot);
		}
		int particleCount = Ps.particleCount;
		if (particleCount > 0)
		{
			if (buffer == null || buffer.Length < particleCount)
			{
				buffer = (Particle[])(object)new Particle[Mathf.Max(particleCount, 64)];
			}
			int particles = Ps.GetParticles(buffer);
			Quaternion rotation = ((Component)this).transform.rotation;
			Vector3 val3 = ((!HasBeam) ? Vector3.zero : (beamDestWorld - beamSourceWorld));
			bool flag5 = false;
			float rotation2 = 0f;
			if (HasAlignRotation && (Object)(object)Camera.main != (Object)null)
			{
				Transform transform = ((Component)Camera.main).transform;
				Vector3 val4 = _alignTargetWorldDir - Vector3.Dot(_alignTargetWorldDir, transform.forward) * transform.forward;
				if (((Vector3)(ref val4)).sqrMagnitude > 1E-06f)
				{
					float num2 = Vector3.Angle(transform.up, val4);
					float num3 = Mathf.Sign(Vector3.Dot(transform.forward, Vector3.Cross(transform.up, val4)));
					rotation2 = num2 * num3;
					flag5 = true;
				}
			}
			currentFrameSeeds.Clear();
			for (int i = 0; i < particles; i++)
			{
				currentFrameSeeds.Add(((Particle)(ref buffer[i])).randomSeed);
			}
			int num4 = 0;
			if (HasBeam)
			{
				for (int j = 0; j < particles; j++)
				{
					if (!lastFrameSeeds.Contains(((Particle)(ref buffer[j])).randomSeed))
					{
						num4++;
					}
				}
			}
			int num5 = 0;
			for (int k = 0; k < particles; k++)
			{
				bool flag6 = !lastFrameSeeds.Contains(((Particle)(ref buffer[k])).randomSeed);
				Vector3 val5 = ((Particle)(ref buffer[k])).position;
				Vector3 val6 = ((Particle)(ref buffer[k])).velocity;
				if (HasBeam && flag6)
				{
					float num6 = ((num4 <= 1) ? 0.5f : ((float)num5 / (float)(num4 - 1)));
					val5 = beamSourceWorld + val3 * num6;
					num5++;
				}
				if (flag3 && flag6)
				{
					float value = Random.value;
					for (int l = 0; l < LocationOffsets.Length; l++)
					{
						AnimationCurve val7 = ((_locationOffsetScaleCurves == null || l >= _locationOffsetScaleCurves.Length) ? null : _locationOffsetScaleCurves[l]);
						float num7 = ((val7 == null) ? Mathf.Lerp(LocationOffsets[l].ScaleMin, LocationOffsets[l].ScaleMax, value) : val7.Evaluate(value));
						val5 += rotation * LocationOffsets[l].Direction * num7;
					}
				}
				if (flag4 && flag6)
				{
					for (int m = 0; m < VelocityExtras.Length; m++)
					{
						float value2 = Random.value;
						float value3 = Random.value;
						float value4 = Random.value;
						Vector3 val8 = rotation * RandomDirectionInCone(VelocityExtras[m].Direction, VelocityExtras[m].ConeAngleDeg, value2, value3);
						float num8 = Mathf.Lerp(VelocityExtras[m].SpeedMin, VelocityExtras[m].SpeedMax, value4);
						val6 += val8 * num8;
					}
				}
				if (flag)
				{
					for (int n = 0; n < GravityEntries.Length; n++)
					{
						GravityEntry gravityEntry = GravityEntries[n];
						Vector3 val9 = ((!((Object)(object)gravityEntry.Target != (Object)null)) ? ((Component)this).transform.position : gravityEntry.Target.position);
						Vector3 val10 = ((!(((Vector3)(ref gravityEntry.Axis)).sqrMagnitude > 1E-06f)) ? Vector3.up : ((Vector3)(ref gravityEntry.Axis)).normalized);
						Vector3 val11 = rotation * val10;
						float num9 = ((!(gravityEntry.Decay > 0f)) ? 0f : (1f / (gravityEntry.Decay * gravityEntry.Decay)));
						Vector3 val13;
						if (gravityEntry.UseAxis)
						{
							Vector3 val12 = val5 - val9;
							val13 = val9 + val11 * Vector3.Dot(val11, val12) - val5;
						}
						else
						{
							val13 = val9 - val5;
						}
						float sqrMagnitude = ((Vector3)(ref val13)).sqrMagnitude;
						if (sqrMagnitude > 1E-08f)
						{
							float num10 = gravityEntry.Accel / (1f + num9 * sqrMagnitude);
							val6 += ((Vector3)(ref val13)).normalized * (num10 * num);
						}
					}
					if (HasGravityDrag)
					{
						val6 -= val6 * (GravityDrag * num);
					}
				}
				if (flag2)
				{
					for (int num11 = 0; num11 < VortexEntries.Length; num11++)
					{
						VortexEntry vortexEntry = VortexEntries[num11];
						Vector3 val14 = ((!((Object)(object)vortexEntry.Target != (Object)null)) ? ((Component)this).transform.position : vortexEntry.Target.position);
						Vector3 val15 = ((!(((Vector3)(ref vortexEntry.Axis)).sqrMagnitude > 1E-06f)) ? Vector3.up : ((Vector3)(ref vortexEntry.Axis)).normalized);
						Vector3 val16 = rotation * val15;
						float num12 = ((!(vortexEntry.Decay > 0f)) ? 0f : (1f / (vortexEntry.Decay * vortexEntry.Decay)));
						Vector3 val17 = val5 - val14;
						Vector3 val18 = val14 + val16 * Vector3.Dot(val16, val17) - val5;
						float sqrMagnitude2 = ((Vector3)(ref val18)).sqrMagnitude;
						if (sqrMagnitude2 > 1E-08f)
						{
							float num13 = vortexEntry.Speed / (1f + num12 * sqrMagnitude2);
							Vector3 val19 = Vector3.Cross(((Vector3)(ref val18)).normalized, val16) * num13;
							val6 += (val19 - val6) * vortexEntry.Drag * num;
						}
					}
				}
				if (HasMoveRelativeToEmitter && (Object)(object)MoveRelEmitter != (Object)null && !flag6)
				{
					if (MoveRelPositionInherit > 0f)
					{
						Vector3 val20 = val2 * (val5 - lastEmitterPos) + val;
						val5 = Vector3.Lerp(val5, val20, MoveRelPositionInherit);
					}
					if (MoveRelVelocityInherit > 0f)
					{
						Vector3 val21 = val2 * val6;
						val6 = Vector3.Lerp(val6, val21, MoveRelVelocityInherit);
					}
				}
				if (flag5)
				{
					((Particle)(ref buffer[k])).rotation = rotation2;
				}
				((Particle)(ref buffer[k])).position = val5;
				((Particle)(ref buffer[k])).velocity = val6;
			}
			Ps.SetParticles(buffer, particles);
			HashSet<uint> hashSet = lastFrameSeeds;
			lastFrameSeeds = currentFrameSeeds;
			currentFrameSeeds = hashSet;
		}
		else
		{
			lastFrameSeeds.Clear();
		}
		if (HasMoveRelativeToEmitter && (Object)(object)MoveRelEmitter != (Object)null)
		{
			lastEmitterPos = val;
			lastEmitterRot = MoveRelEmitter.rotation;
		}
	}

	private static AnimationCurve ParseScaleCurveKeysStr(string keysStr)
	{
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Expected O, but got Unknown
		if (string.IsNullOrEmpty(keysStr))
		{
			return null;
		}
		string[] array = keysStr.Split(new char[1] { ';' });
		Keyframe[] array2 = (Keyframe[])(object)new Keyframe[array.Length];
		for (int i = 0; i < array.Length; i++)
		{
			string[] array3 = array[i].Split(new char[1] { ',' });
			float num = float.Parse(array3[0], CultureInfo.InvariantCulture);
			float num2 = float.Parse(array3[1], CultureInfo.InvariantCulture);
			ref Keyframe reference = ref array2[i];
			reference = new Keyframe(num, num2, 0f, 0f);
		}
		return new AnimationCurve(array2);
	}

	private static Vector3 RandomDirectionInCone(Vector3 axis, float halfAngleDeg, float u1, float u2)
	{
		//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_00f6: 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_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		if (halfAngleDeg >= 179.9f || ((Vector3)(ref axis)).sqrMagnitude < 1E-08f)
		{
			float num = 1f - 2f * u1;
			float num2 = Mathf.Sqrt(Mathf.Max(0f, 1f - num * num));
			float num3 = u2 * 2f * (float)Math.PI;
			return new Vector3(num2 * Mathf.Cos(num3), num2 * Mathf.Sin(num3), num);
		}
		float num4 = halfAngleDeg * ((float)Math.PI / 180f);
		float num5 = Mathf.Lerp(Mathf.Cos(num4), 1f, u1);
		float num6 = Mathf.Sqrt(Mathf.Max(0f, 1f - num5 * num5));
		float num7 = u2 * 2f * (float)Math.PI;
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor(num6 * Mathf.Cos(num7), num6 * Mathf.Sin(num7), num5);
		Quaternion val2 = Quaternion.FromToRotation(Vector3.forward, ((Vector3)(ref axis)).normalized);
		return val2 * val;
	}
}
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);
		}
	}
}
public class SpawnDurationRuntime : MonoBehaviour
{
	public float Delay;

	public float Duration;

	private ParticleSystem ps;

	private void Awake()
	{
		ps = ((Component)this).GetComponent<ParticleSystem>();
	}

	private void OnEnable()
	{
		if (Duration > 0f)
		{
			((MonoBehaviour)this).Invoke("StopEmission", Delay + Duration);
		}
	}

	private void StopEmission()
	{
		if ((Object)(object)ps != (Object)null)
		{
			ps.Stop(false, (ParticleSystemStopBehavior)1);
		}
	}
}