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.HuntTheCordwainer { [BepInPlugin("BitWizrd.HuntTheCordwainer", "HuntTheCordwainer", "1.0.8")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class HuntTheCordwainerPlugin : 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.HuntTheCordwainer"); OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntTheCordwainer", "", "thecordwainer", "", ""); } } } public class AudioStopWhenDone : MonoBehaviour { public AudioSource Src; public float Delay; public float Duration = 1f; private void Awake() { if ((Object)(object)Src == (Object)null) { Src = ((Component)this).GetComponent(); } } private void OnEnable() { ((MonoBehaviour)this).CancelInvoke(); if ((Object)(object)Src != (Object)null && Src.loop && !Src.isPlaying) { Src.Play(); } if (Duration > 0f) { ((MonoBehaviour)this).Invoke("StopLoop", Mathf.Max(0f, Delay) + Duration); } } private void OnDisable() { ((MonoBehaviour)this).CancelInvoke(); } private void StopLoop() { if ((Object)(object)Src != (Object)null && Src.loop) { Src.Stop(); } ((Behaviour)this).enabled = false; } } public class AutoDestructWhenDone : MonoBehaviour { [Tooltip("Seconds between checks.")] public float PollInterval = 0.5f; [Tooltip("Seconds after enabling before the first check, so a delayed start is not mistaken for finished.")] public float StartGrace = 1f; private ParticleSystem[] m_systems; private AudioSource[] m_sources; private float m_nextPoll; private void OnEnable() { m_nextPoll = Time.time + Mathf.Max(StartGrace, PollInterval); } private void Update() { if (!Application.isPlaying || Time.time < m_nextPoll) { return; } m_nextPoll = Time.time + PollInterval; if (m_systems == null) { m_systems = ((Component)this).GetComponentsInChildren(true); m_sources = ((Component)this).GetComponentsInChildren(true); } for (int i = 0; i < m_systems.Length; i++) { ParticleSystem val = m_systems[i]; if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy && val.IsAlive(false)) { return; } } for (int j = 0; j < m_sources.Length; j++) { AudioSource val2 = m_sources[j]; if ((Object)(object)val2 != (Object)null && ((Component)val2).gameObject.activeInHierarchy && val2.isPlaying) { return; } } Object.Destroy((Object)(object)((Component)this).gameObject); } } 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(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Object)((Component)componentsInChildren[i]).gameObject).name = name; } } } namespace BitWizrd.Revolver.ConversionChain { public class Chain : FVRFireArm { [Header("Chain Revolver")] public ChainCylinder ChainCylinder; public Transform Hammer; public Transform LoadingGate; public Transform Trigger; public Transform HammerFanDir; public Transform PoseSpinHolder; public Transform Pose_Main; public Transform Pose_Toggled; public float Hammer_Rot_Uncocked; public float Hammer_Rot_Halfcocked; public float Hammer_Rot_Cocked; public float LoadingGate_Rot_Closed; public float LoadingGate_Rot_Open; public float Trigger_Rot_Forward; public float Trigger_Rot_Rearward; public bool StateToggles = true; public float TriggerThreshold = 0.9f; public bool CanSpin = true; public bool HasTransferBarSafety; public bool IsAccessTwoChambersBack; public Transform ChainHolder; public bool AllChambersAccessible = false; [Header("Ejection")] [Tooltip("Ejection speed in m/s. 1 matches the stock revolvers.")] public float EjectSpeed = 1f; [Tooltip("With the loading gate open, a spent case in the gate chamber slides out and drops when the gun is tilted so that chamber points downward.")] public bool GravityEject = true; [Tooltip("Degrees the chamber's exit direction must point below horizontal before gravity ejects the case.")] public float GravityEjectMinTilt = 30f; private int m_curChamber; private float m_curChamberLerp; private float m_tarChamberLerp; private bool m_isSpinning; private bool m_isStateToggled; private float m_triggerFloat; private bool m_isHammerCocking; private bool m_isHammerCocked; private float m_hammerCockLerp; private float m_hammerCockSpeed = 10f; private float xSpinRot; private float xSpinVel; private float timeSinceColFire; private float m_chainHolderBaseAngle; private float m_chainHolderCurAngle; private float m_chainHolderTargetAngle; private float m_chainHolderLerp; private float m_chainHolderLerpDuration = 0.1f; private readonly CylinderSlideEjector m_slide = new CylinderSlideEjector(); public int CurChamber { get { return m_curChamber; } set { m_curChamber = value; if (m_curChamber < 0) { m_curChamber += ChainCylinder.NumChambers; } m_curChamber %= ChainCylinder.NumChambers; } } public int NextChamber => (m_curChamber - 1 + ChainCylinder.NumChambers) % ChainCylinder.NumChambers; public int PrevChamber => (m_curChamber + 1) % ChainCylinder.NumChambers; public int PrevChamber2 => (m_curChamber + 2) % ChainCylinder.NumChambers; public override void Awake() { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).Awake(); base.FChambers.Clear(); FVRFireArmChamber[] chambers = ChainCylinder.Chambers; foreach (FVRFireArmChamber item in chambers) { base.FChambers.Add(item); } m_chainHolderBaseAngle = 0f; m_chainHolderCurAngle = 0f; m_chainHolderTargetAngle = 0f; m_chainHolderLerp = 1f; if ((Object)(object)ChainCylinder != (Object)null && ChainCylinder.LerpSpeed > 0f) { m_chainHolderLerpDuration = 1f / ChainCylinder.LerpSpeed; } if ((Object)(object)((FVRInteractiveObject)this).PoseOverride_Touch != (Object)null) { Pose_Main.localPosition = ((FVRInteractiveObject)this).PoseOverride_Touch.localPosition; Pose_Main.localRotation = ((FVRInteractiveObject)this).PoseOverride_Touch.localRotation; } } public override void BeginInteraction(FVRViveHand hand) { //IL_00a2: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_006e: 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).BeginInteraction(hand); if (((FVRPhysicalObject)this).IsAltHeld) { return; } if (!m_isStateToggled) { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Main.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Main.localRotation; } } else { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Toggled.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Toggled.localRotation; } } } public override void UpdateInteraction(FVRViveHand hand) { //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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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) ((FVRPhysicalObject)this).UpdateInteraction(hand); if (!((FVRPhysicalObject)this).IsAltHeld || (Object)(object)((FVRPhysicalObject)this).AltGrip == (Object)null) { m_isSpinning = false; ProcessControls(hand); } UpdateTriggerHammer(hand); UpdateCylinderRot(); if (!((FVRInteractiveObject)this).IsHeld) { m_isSpinning = false; } if (m_chainHolderLerp < 1f) { m_chainHolderLerp += Time.deltaTime / m_chainHolderLerpDuration; if (m_chainHolderLerp > 1f) { m_chainHolderLerp = 1f; } float z = Mathf.Lerp(m_chainHolderCurAngle, m_chainHolderTargetAngle, m_chainHolderLerp); if ((Object)(object)ChainHolder != (Object)null) { Vector3 localEulerAngles = ChainHolder.localEulerAngles; localEulerAngles.z = z; ChainHolder.localEulerAngles = localEulerAngles; } } else if ((Object)(object)ChainHolder != (Object)null) { Vector3 localEulerAngles2 = ChainHolder.localEulerAngles; localEulerAngles2.z = m_chainHolderTargetAngle; ChainHolder.localEulerAngles = localEulerAngles2; } } private void ProcessControls(FVRViveHand hand) { //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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!m_isStateToggled) { if (hand.Input.TouchpadPressed && !hand.IsInStreamlinedMode && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) < 45f) { m_isSpinning = true; } if (hand.IsInStreamlinedMode) { if (hand.Input.AXButtonDown) { CockHammer(5f); } if (hand.Input.BYButtonDown && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); } } else if (hand.Input.TouchpadDown) { if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) < 45f) { CockHammer(5f); } else if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); } } return; } if (hand.IsInStreamlinedMode) { if (hand.Input.AXButtonDown) { AdvanceCylinder(); } if (hand.Input.BYButtonDown && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); } } else if (hand.Input.TouchpadDown) { if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f); } else if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f) { AdvanceCylinder(); } } if (hand.Input.TriggerDown) { EjectPrevCylinder(); } } public void ProcessControlsFromBarrelGrip(FVRViveHand hand) { m_isSpinning = false; ProcessControls(hand); } public override void EndInteraction(FVRViveHand hand) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) m_triggerFloat = 0f; ((FVRFireArm)this).EndInteraction(hand); ((FVRPhysicalObject)this).RootRigidbody.AddRelativeTorque(new Vector3(xSpinVel, 0f, 0f), (ForceMode)1); } public override void FVRFixedUpdate() { UpdateSpinning(); if (timeSinceColFire < 3f) { timeSinceColFire += Time.deltaTime; } ((FVRFireArm)this).FVRFixedUpdate(); } private void UpdateTriggerHammer(FVRViveHand hand) { //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0204: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) ChainCylinder.CurrentChamberIndex = CurChamber; if (((FVRInteractiveObject)this).IsHeld && !m_isStateToggled && !m_isHammerCocked && !m_isHammerCocking && (Object)(object)hand.OtherHand != (Object)null) { Vector3 velLinearWorld = hand.OtherHand.Input.VelLinearWorld; float num = Vector3.Distance(hand.OtherHand.PalmTransform.position, HammerFanDir.position); if (num < 0.15f && Vector2.Angle(Vector2.op_Implicit(velLinearWorld), Vector2.op_Implicit(HammerFanDir.forward)) < 60f && ((Vector3)(ref velLinearWorld)).magnitude > 1f) { CockHammer(10f); } } if (m_isHammerCocking) { if (m_hammerCockLerp < 1f) { m_hammerCockLerp += Time.deltaTime * m_hammerCockSpeed; } else { m_hammerCockLerp = 1f; m_isHammerCocking = false; m_isHammerCocked = true; CurChamber--; m_curChamberLerp = 0f; m_tarChamberLerp = 0f; } } if (!m_isStateToggled) { Hammer.localEulerAngles = new Vector3(Mathf.Lerp(Hammer_Rot_Uncocked, Hammer_Rot_Cocked, m_hammerCockLerp), 0f, 0f); } else { Hammer.localEulerAngles = new Vector3(Hammer_Rot_Halfcocked, 0f, 0f); } if ((Object)(object)LoadingGate != (Object)null) { if (!m_isStateToggled) { LoadingGate.localEulerAngles = new Vector3(0f, 0f, LoadingGate_Rot_Closed); } else { LoadingGate.localEulerAngles = new Vector3(0f, 0f, LoadingGate_Rot_Open); } } m_triggerFloat = 0f; if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !m_isSpinning && !m_isStateToggled) { m_triggerFloat = hand.Input.TriggerFloat; } Trigger.localEulerAngles = new Vector3(Mathf.Lerp(Trigger_Rot_Forward, Trigger_Rot_Rearward, m_triggerFloat), 0f, 0f); if (m_triggerFloat > TriggerThreshold) { DropHammer(); } } private void DropHammer() { if (m_isHammerCocked) { m_isHammerCocked = false; m_isHammerCocking = false; m_hammerCockLerp = 0f; Fire(); } } private void AdvanceCylinder() { CurChamber--; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f); ChainCylinder.CurrentLerpDuration = 1f / ((!(ChainCylinder.LerpSpeed > 0f)) ? 10f : ChainCylinder.LerpSpeed); ChainCylinder.Advance(); m_chainHolderTargetAngle = (m_chainHolderCurAngle = m_chainHolderTargetAngle) - 72f; m_chainHolderLerp = 0f; } public void EjectPrevCylinder() { if (m_isStateToggled) { int num = PrevChamber; if (IsAccessTwoChambersBack) { num = PrevChamber2; } FVRFireArmChamber chamber = ChainCylinder.Chambers[num]; m_slide.ReleaseSpeed = EjectSpeed; if (m_slide.Eject(((Component)ChainCylinder).transform, ChainCylinder.Chambers, chamber, forward: false)) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); } } } public override void FVRUpdate() { ((FVRFireArm)this).FVRUpdate(); m_slide.Tick(); if (GravityEject && m_isStateToggled) { int num = ((!IsAccessTwoChambersBack) ? PrevChamber : PrevChamber2); if (m_slide.TryGravityEject(((Component)ChainCylinder).transform, ChainCylinder.Chambers, ChainCylinder.Chambers[num], GravityEjectMinTilt, forward: false)) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); } } } public override void OnDestroy() { m_slide.Clear(); ((FVRPhysicalObject)this).OnDestroy(); } private void Fire() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); if (base.FChambers[CurChamber].Fire()) { FVRFireArmChamber val = base.FChambers[CurChamber]; ((FVRFireArm)this).Fire(val, ((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(val.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { val.IsSpent = false; val.UpdateProxyDisplay(); } } } private void UpdateCylinderRot() { if (AllChambersAccessible) { for (int i = 0; i < base.FChambers.Count; i++) { int curChamber = CurChamber; int num = (CurChamber + 1) % ChainCylinder.NumChambers; int num2 = (CurChamber + ChainCylinder.NumChambers - 1) % ChainCylinder.NumChambers; if (i == curChamber || i == num || i == num2) { base.FChambers[i].IsAccessible = false; } else { base.FChambers[i].IsAccessible = true; } } if (m_isStateToggled) { int num3 = (CurChamber + 1) % ChainCylinder.NumChambers; if (num3 >= 0 && num3 < base.FChambers.Count) { base.FChambers[num3].IsAccessible = true; } } return; } for (int j = 0; j < base.FChambers.Count; j++) { base.FChambers[j].IsAccessible = false; } if (m_isStateToggled) { int num4 = (CurChamber + 1) % ChainCylinder.NumChambers; if (IsAccessTwoChambersBack) { num4 = (CurChamber + 2) % ChainCylinder.NumChambers; } if (num4 >= 0 && num4 < base.FChambers.Count) { base.FChambers[num4].IsAccessible = true; } } } private void UpdateSpinning() { //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0273: 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_0049: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) if (!((FVRInteractiveObject)this).IsHeld) { 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.VelLinearLocal; } 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, -500f, 500f); 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.localRotation = Quaternion.RotateTowards(PoseSpinHolder.localRotation, Quaternion.identity, Time.deltaTime * 500f); PoseSpinHolder.localEulerAngles = new Vector3(PoseSpinHolder.localEulerAngles.x, 0f, 0f); } } public override List GetChamberRoundList() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) bool flag = false; List list = new List(); for (int i = 0; i < base.FChambers.Count; i++) { if (base.FChambers[i].IsFull) { list.Add(base.FChambers[i].GetRound().RoundClass); flag = true; } } if (flag) { return list; } return null; } public override void SetLoadedChambers(List rounds) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (rounds.Count <= 0) { return; } for (int i = 0; i < base.FChambers.Count; i++) { if (i < rounds.Count) { base.FChambers[i].Autochamber(rounds[i]); } } } private void CockHammer(float speed) { if (!m_isHammerCocked && !m_isHammerCocking) { m_hammerCockSpeed = speed; m_isHammerCocking = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); ChainCylinder.CurrentLerpDuration = 1f / m_hammerCockSpeed; ChainCylinder.StartAdvanceLerp(); m_chainHolderTargetAngle = (m_chainHolderCurAngle = m_chainHolderTargetAngle) - 72f; m_chainHolderLerp = 0f; } } private void ToggleState() { //IL_00a6: 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_0034: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) m_isStateToggled = !m_isStateToggled; if (!((FVRPhysicalObject)this).IsAltHeld) { if (!m_isStateToggled) { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Main.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Main.localRotation; } } else { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Toggled.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Toggled.localRotation; } } } m_isHammerCocking = false; m_isHammerCocked = false; m_hammerCockLerp = 0f; } } public class ChainBarrelGrip : FVRAlternateGrip { public override void Awake() { if ((Object)(object)base.PrimaryObject == (Object)null) { base.PrimaryObject = (FVRPhysicalObject)(object)((Component)this).GetComponentInParent(); } ((FVRAlternateGrip)this).Awake(); } public override void UpdateInteraction(FVRViveHand hand) { ((FVRAlternateGrip)this).UpdateInteraction(hand); Chain chain = base.PrimaryObject as Chain; if ((Object)(object)chain != (Object)null) { chain.ProcessControlsFromBarrelGrip(hand); } } } public class ChainCylinder : MonoBehaviour { public enum WaggleModeType { PerLinkParticles, SinglePendulum } private class ChainLink { public Transform transform; public Vector3 baseLocalPos; public Quaternion baseLocalRot; public Vector3 particlePos; private Vector3 particleVel; private float restVelocityThreshold = 0.003f; public float distanceLimit = 0.12f; public float gravityScale = 0.8f; public float springRate = 0.85f; public float damping = 0.6f; public float positionScale = 0.2f; public bool isKinematic = false; public ChainLink prevLink; public ChainLink nextLink; public bool useSpring = true; public bool useAngleLimit = false; public float angleLimitDegrees = 25f; public float anchorBlendTime = 0.15f; public float motionResponse = 1f; private float anchorWeight = 0f; private float dampingJitter = 1f; private float springJitter = 1f; private float uniqueOffset1; private float uniqueOffset2; private float uniqueOffset3; private float moveScale; private float noiseFrequency1; private float noiseFrequency2; private float noiseFrequency3; public float swingWeight = 0f; public float collisionFraction = 1f; private Collider[] m_solidColliders; private Vector3[] m_restCenters; private Vector3[] m_lastCenters; private bool FullyAnchored => isKinematic && anchorWeight >= 1f; public void Initialize() { //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_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) baseLocalPos = transform.localPosition; baseLocalRot = transform.localRotation; ResetParticle(); uniqueOffset1 = Random.Range(0f, 100f); uniqueOffset2 = Random.Range(0f, 100f); uniqueOffset3 = Random.Range(0f, 100f); noiseFrequency1 = Random.Range(0.6f, 1.2f); noiseFrequency2 = Random.Range(0.6f, 1.2f); noiseFrequency3 = Random.Range(0.6f, 1.2f); moveScale = Random.Range(0.7f, 1f); dampingJitter = Random.Range(0.9f, 1.1f); springJitter = Random.Range(0.85f, 1.15f); } private float IdealDistanceTo(ChainLink other) { //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_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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) Transform parent = transform.parent; if ((Object)(object)parent == (Object)null) { return Vector3.Distance(baseLocalPos, other.baseLocalPos); } return Vector3.Distance(parent.TransformPoint(baseLocalPos), parent.TransformPoint(other.baseLocalPos)); } public void CacheColliders() { //IL_0062: 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_00a0: Unknown result type (might be due to invalid IL or missing references) List list = new List(); List list2 = new List(); Collider[] components = ((Component)transform).GetComponents(); foreach (Collider val in components) { if (val.isTrigger) { continue; } BoxCollider val2 = (BoxCollider)(object)((val is BoxCollider) ? val : null); SphereCollider val3 = (SphereCollider)(object)((val is SphereCollider) ? val : null); CapsuleCollider val4 = (CapsuleCollider)(object)((val is CapsuleCollider) ? val : null); if ((Object)(object)val2 != (Object)null) { list2.Add(val2.center); } else if ((Object)(object)val3 != (Object)null) { list2.Add(val3.center); } else { if (!((Object)(object)val4 != (Object)null)) { continue; } list2.Add(val4.center); } list.Add(val); } m_solidColliders = list.ToArray(); m_restCenters = list2.ToArray(); m_lastCenters = list2.ToArray(); } public void HoldCollidersAtRest() { //IL_004d: 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_005e: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) if (m_solidColliders == null || m_solidColliders.Length == 0) { return; } Transform parent = transform.parent; for (int i = 0; i < m_solidColliders.Length; i++) { Collider val = m_solidColliders[i]; if ((Object)(object)val == (Object)null) { continue; } Vector3 val2 = baseLocalPos + baseLocalRot * Vector3.Scale(transform.localScale, m_restCenters[i]); Vector3 val3 = ((!((Object)(object)parent != (Object)null)) ? val2 : parent.TransformPoint(val2)); Vector3 val4 = transform.InverseTransformPoint(val3); Vector3 val5 = val4 - m_lastCenters[i]; if (!(((Vector3)(ref val5)).sqrMagnitude < 1E-12f)) { m_lastCenters[i] = val4; BoxCollider val6 = (BoxCollider)(object)((val is BoxCollider) ? val : null); SphereCollider val7 = (SphereCollider)(object)((val is SphereCollider) ? val : null); CapsuleCollider val8 = (CapsuleCollider)(object)((val is CapsuleCollider) ? val : null); if ((Object)(object)val6 != (Object)null) { val6.center = val4; } else if ((Object)(object)val7 != (Object)null) { val7.center = val4; } else if ((Object)(object)val8 != (Object)null) { val8.center = val4; } } } } public void UpdateAnchor(float deltaTime) { anchorWeight = Mathf.MoveTowards(anchorWeight, (!isKinematic) ? 0f : 1f, deltaTime / Mathf.Max(anchorBlendTime, 0.0001f)); } public void ResetParticle() { //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_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) particlePos = transform.position; particleVel = Vector3.zero; } public void SetToBasePosition() { //IL_0008: 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) transform.localPosition = baseLocalPos; transform.localRotation = baseLocalRot; ResetParticle(); } public void SetBasePosition(Vector3 pos, Quaternion rot) { //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_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_0022: 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) baseLocalPos = pos; baseLocalRot = rot; if (FullyAnchored) { transform.localPosition = baseLocalPos; transform.localRotation = baseLocalRot; ResetParticle(); } } public void UpdatePhysics(float deltaTime, float movementAmount, bool advancing) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_011d: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: 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_027f: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: 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_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: 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_0408: 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_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0416: 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_0421: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: 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_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_042f: 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_043e: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: 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_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: 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_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) if (deltaTime <= 0f) { return; } anchorWeight = Mathf.MoveTowards(anchorWeight, (!isKinematic) ? 0f : 1f, deltaTime / Mathf.Max(anchorBlendTime, 0.0001f)); if (FullyAnchored) { transform.localPosition = baseLocalPos; transform.localRotation = baseLocalRot; ResetParticle(); return; } Vector3 position = transform.position; bool flag = movementAmount < 0.001f && !advancing; if (flag && ((Vector3)(ref particleVel)).magnitude < restVelocityThreshold) { transform.localPosition = Vector3.Lerp(transform.localPosition, baseLocalPos, deltaTime * 3f); transform.localRotation = baseLocalRot; particleVel = Vector3.zero; particlePos = transform.position; return; } Vector3 val = Physics.gravity * gravityScale; Vector3 val2 = Vector3.zero; if (movementAmount > 0.005f && !advancing) { float time = Time.time; float num = Mathf.PerlinNoise(time * noiseFrequency1 + uniqueOffset1, uniqueOffset2) * 2f - 1f; float num2 = Mathf.PerlinNoise(uniqueOffset2, time * noiseFrequency2 + uniqueOffset3) * 2f - 1f; float num3 = Mathf.PerlinNoise(uniqueOffset3 + time * noiseFrequency3, time * noiseFrequency1) * 2f - 1f; val2 = new Vector3(num * 0.05f, num2 * 0.05f, num3 * 0.05f) * moveScale * Mathf.Min(1f, movementAmount * 6f); } if (!advancing && ((Vector3)(ref val2)).magnitude < 0.001f) { float num4 = Time.time * 0.3f; val2 += new Vector3(Mathf.Sin(num4 * 1.2f + uniqueOffset1) * 0.006f, Mathf.Cos(num4 * 0.9f + uniqueOffset2) * 0.006f, Mathf.Sin(num4 * 0.7f + uniqueOffset3) * 0.006f) * moveScale * 0.1f; } Vector3 val3 = particlePos; float num5 = ((!advancing) ? (damping * dampingJitter) : 0.85f); Vector3 val4 = val + val2 - particleVel * num5; Vector3 val5 = particleVel + val4 * (motionResponse * deltaTime); Vector3 newPos = val3 + val5 * deltaTime; float num6 = (advancing ? 0.95f : ((!flag) ? (springRate * springJitter) : 0.98f)); if (useSpring || advancing || flag) { Vector3 val6 = transform.parent.TransformPoint(baseLocalPos); newPos = Vector3.Lerp(newPos, val6, 1f - Mathf.Exp((0f - num6) * deltaTime)); } if (useAngleLimit && prevLink != null) { newPos = ClampToAngleCone(newPos); } float num7 = ((!advancing) ? (distanceLimit * moveScale) : (distanceLimit * 0.3f)); float num8 = Vector3.Distance(newPos, position); if (num8 > num7) { Vector3 val7 = newPos - position; newPos = position + ((Vector3)(ref val7)).normalized * num7; } particlePos = newPos; particleVel = (particlePos - val3) / deltaTime; if (flag) { particleVel *= 0.8f; } if ((prevLink != null && prevLink.isKinematic) || (nextLink != null && nextLink.isKinematic)) { EnforceKinematicConnectivity(ref newPos); } else { EnforceLooseConnectivity(ref newPos); } Vector3 val8 = particlePos - position; Vector3 val9 = transform.parent.InverseTransformDirection(val8); float num9 = ((!advancing) ? (positionScale * moveScale) : (positionScale * 0.3f)); val9 *= num9; Vector3 val10 = baseLocalPos + val9; transform.localPosition = ((!(anchorWeight > 0f)) ? val10 : Vector3.Lerp(val10, baseLocalPos, anchorWeight)); transform.localRotation = baseLocalRot; } private Vector3 ClampToAngleCone(Vector3 pos) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00be: 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_00b5: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) Transform parent = transform.parent; Vector3 position = prevLink.transform.position; Vector3 val = ((!((Object)(object)parent != (Object)null)) ? transform.position : parent.TransformPoint(baseLocalPos)); Vector3 val2 = val - position; Vector3 val3 = pos - position; float magnitude = ((Vector3)(ref val2)).magnitude; float magnitude2 = ((Vector3)(ref val3)).magnitude; if (magnitude < 0.0001f || magnitude2 < 0.0001f) { return pos; } val2 /= magnitude; Vector3 val4 = val3 / magnitude2; float num = Vector3.Angle(val2, val4); if (num <= angleLimitDegrees) { return pos; } Vector3 val5 = Vector3.Cross(val2, val4); if (((Vector3)(ref val5)).sqrMagnitude < 1E-10f) { return pos; } Vector3 val6 = Quaternion.AngleAxis(angleLimitDegrees, ((Vector3)(ref val5)).normalized) * val2; return position + val6 * magnitude2; } private void EnforceLooseConnectivity(ref Vector3 newPos) { //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0073: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_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) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (prevLink != null && !prevLink.isKinematic) { float num = IdealDistanceTo(prevLink); Vector3 position = prevLink.transform.position; float num2 = Vector3.Distance(newPos, position); if (Mathf.Abs(num2 - num) > num * 0.6f) { Vector3 val = newPos - position; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = position + normalized * num; newPos = Vector3.Lerp(newPos, val2, 0.3f); } } if (nextLink != null && !nextLink.isKinematic) { float num3 = IdealDistanceTo(nextLink); Vector3 position2 = nextLink.transform.position; float num4 = Vector3.Distance(newPos, position2); if (Mathf.Abs(num4 - num3) > num3 * 0.6f) { Vector3 val3 = newPos - position2; Vector3 normalized2 = ((Vector3)(ref val3)).normalized; Vector3 val4 = position2 + normalized2 * num3; newPos = Vector3.Lerp(newPos, val4, 0.3f); } } particlePos = newPos; } private void EnforceKinematicConnectivity(ref Vector3 newPos) { //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0071: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) if (prevLink != null && prevLink.isKinematic) { float num = IdealDistanceTo(prevLink); Vector3 position = prevLink.transform.position; float num2 = Vector3.Distance(newPos, position); if (Mathf.Abs(num2 - num) > 0.005f) { Vector3 val = newPos - position; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = position + normalized * num; newPos = Vector3.Lerp(newPos, val2, 0.95f); } } if (nextLink != null && nextLink.isKinematic) { float num3 = IdealDistanceTo(nextLink); Vector3 position2 = nextLink.transform.position; float num4 = Vector3.Distance(newPos, position2); if (Mathf.Abs(num4 - num3) > 0.005f) { Vector3 val3 = newPos - position2; Vector3 normalized2 = ((Vector3)(ref val3)).normalized; Vector3 val4 = position2 + normalized2 * num3; newPos = Vector3.Lerp(newPos, val4, 0.95f); } } particlePos = newPos; } } public int NumChambers = 17; public Transform[] ChamberModels; public FVRFireArmChamber[] Chambers; [HideInInspector] public Vector3[] ChamberPositions; [HideInInspector] public Quaternion[] ChamberRotations; public float LerpSpeed = 10f; private int m_curChamber = 0; private float[] m_lerpProgress; private int[] m_targetIndices; private float m_hammerLerp = 0f; public int CurrentChamberIndex = 0; public float CurrentLerpDuration = 0.1f; [Tooltip("The distance the particle is clamped to")] public float WaggleDistanceLimit = 0.15f; [Tooltip("Only used when 'Waggle Use Angle Limits' is on. A link's particle may not swing further than max(Left, Right) degrees from the straight line through the previous link. The cone is symmetric: separate left/right limits would need a hinge axis, which these links do not have.")] public float WaggleAngleLimitLeft = 25f; [Tooltip("See Waggle Angle Limit Left. The larger of the two is used.")] public float WaggleAngleLimitRight = 25f; [Tooltip("Turns the angle limits above on. Off by default so existing prefabs keep their current look.")] public bool WaggleUseAngleLimits = false; [Tooltip("Multiplier for physics gravity affecting the particles")] public float WaggleGravityScale = 0.7f; [Tooltip("Pulls moving particles back towards their slot. Off = only the settle pull at rest and the distance clamp hold them.")] public bool WaggleUseSpring = true; [Tooltip("Spring pull rate in 1/seconds: the remaining distance to the slot shrinks by a factor of e every 1/rate seconds (0.95 = about a 1 s time constant). Frame-rate independent.")] public float WaggleSpringApproachRate = 0.8f; [Tooltip("Velocity drag. Scaled by the same response factor as gravity (see MotionResponse), so 0.6 is a very light drag.")] public float WaggleDamping = 0.6f; [Tooltip("Seconds a link takes to blend into/out of the fixed (kinematic) window around the current chamber, so links do not snap when the window moves.")] public float AnchorBlendTime = 0.15f; [Header("Wobble mode")] [Tooltip("PerLinkParticles = the original independent per-link particle sim. SinglePendulum = Hunt's model: ONE inertial pendulum (see Pendulum below) whose swing is spread over the free links, which also rotate to follow the chain. The Waggle* values above are ignored in SinglePendulum mode, except AnchorBlendTime.")] public WaggleModeType WaggleMode = WaggleModeType.PerLinkParticles; [Header("Single Pendulum mode")] [Tooltip("Where the pendulum hangs from (its local axes define Aim / Plane Normal). Defaults to this object.")] public Transform PendulumPivot; public CryPendulum Pendulum = new CryPendulum(); [Tooltip("How much of the bob's displacement (metres, root space) is applied to the middle of the free chain. The bob swings on a 0.5 m lever, a chain link only needs a few cm: 0.2 gives up to ~2.5 cm at the 15 degree limit.")] public float PendulumChainScale = 0.2f; [Tooltip("Rotate each free link to follow the new chain tangent (the 'articulated' look). Off = links only translate.")] public bool PendulumFollowTangent = true; [Tooltip("Draws the pendulum rest rod (white), bob (red), plane normal (yellow) when this object is selected, to check Aim / Plane Normal.")] public bool PendulumGizmos = true; [Tooltip("The chain droops towards gravity (the component of gravity perpendicular to the hanging direction), so a gun lying on its side lets the chain lay down, while an upright gun keeps it hanging straight. Hunt's chain has no gravity; this is an addition.")] public bool GravitySag = true; [Tooltip("Metres the middle of the free chain moves towards gravity when the gun lies with gravity perpendicular to the hanging direction. Scales with sin(tilt).")] public float GravitySagDistance = 0.04f; [Tooltip("Seconds the sag takes to follow a change of gun orientation (critically damped), so it never pops.")] public float GravitySagSmoothTime = 0.3f; [Tooltip("The link BoxColliders are solid and part of the gun's rigidbody. Moving the links moves them, which on a gun lying on the ground pushes the whole gun around, and the pendulum then reacts to that. With this on, each link's solid collider is shifted back so it stays at the rest slot while the visual moves.")] public bool FreezeLinkColliders = true; [Tooltip("While the gun is not held and nearly still, the pendulum's damping is multiplied by this so it settles instead of ringing on after spawn or a drop.")] public float RestDampingMultiplier = 6f; [Tooltip("Linear speed (m/s) below which an unheld gun counts as resting.")] public float RestLinearSpeed = 0.05f; [Tooltip("Angular speed (rad/s) below which an unheld gun counts as resting.")] public float RestAngularSpeed = 0.3f; [Tooltip("Stops the displaced links from passing through the gun: each link is swept from its rest slot to where it wants to go and stops at the gun's own solid colliders (and any in Chain Blockers).")] public bool LinkGunCollision = true; [Tooltip("Half-thickness of a link for the sweep, metres.")] public float LinkCollisionRadius = 0.006f; [Tooltip("Gap kept between a stopped link and the surface, metres.")] public float LinkCollisionSkin = 0.001f; [Tooltip("How fast a blocked link is allowed to move back out (fraction of its wanted offset per second). Being pushed in is always instant.")] public float CollisionRelaxRate = 6f; [Tooltip("How far a blocked link's limit spreads to its neighbours: each link may move at most (its neighbour's allowed fraction + this) of its wanted offset. 0 = neighbours are pulled back as much as the blocked link; 1 = no spreading (the old behaviour, which let neighbours stretch away and clip).")] [Range(0f, 1f)] public float CollisionPropagation = 0.3f; [Tooltip("Also stops the links at the environment (floor, tables, walls) while the gun lies against it.")] public bool LinkEnvironmentCollision = true; [Tooltip("Layers counted as environment for the links. Default: Default (0) and Environment (19). Add layers for props you want the chain to rest on; do not include the player or hands.")] public LayerMask EnvironmentMask = LayerMask.op_Implicit(524289); [Tooltip("Extra colliders the links must not enter, e.g. simple boxes standing in for the receiver or cylinder if their meshes have no collider. These can be triggers.")] public Collider[] ChainBlockers; private RaycastHit[] m_castHits; private Vector3[] m_swingOffset; private float[] m_allowed; private float[] m_swingTarget; private Vector3[] m_swingPos; private Vector3 m_sag; private Vector3 m_sagVelocity; private ChainLink[] m_chainLinks; private Vector3 m_lastPosition; private Quaternion m_lastRotation; private float m_movementAmount = 0f; private const float STABILITY_THRESHOLD = 0.002f; private const float MotionResponse = 1f / 15f; private const float MaxPhysicsDelta = 1f / 30f; private bool m_isAdvancing = false; [Header("Audio Cue Settings")] [Tooltip("Velocity threshold for playing jingle sound")] public float JingleVelocityThreshold = 1.5f; [Tooltip("Minimum time between jingle sounds in seconds")] public float JingleCooldownTime = 0.7f; private float m_lastJingleTime = 0f; private FVRFireArm m_firearm; private Rigidbody m_firearmRb; [Tooltip("Enable or disable the jingle sound when the chain moves")] public bool EnableJingleSound = true; private void Awake() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) if (ChamberModels == null || ChamberModels.Length != NumChambers || Chambers == null || Chambers.Length != NumChambers) { return; } ChamberPositions = (Vector3[])(object)new Vector3[NumChambers]; ChamberRotations = (Quaternion[])(object)new Quaternion[NumChambers]; for (int i = 0; i < NumChambers; i++) { ref Vector3 reference = ref ChamberPositions[i]; reference = ChamberModels[i].localPosition; ref Quaternion reference2 = ref ChamberRotations[i]; reference2 = ChamberModels[i].localRotation; } m_firearm = ((Component)this).GetComponentInParent(); if ((Object)(object)m_firearm != (Object)null) { m_firearmRb = ((Component)m_firearm).GetComponent(); } m_lerpProgress = new float[NumChambers]; m_targetIndices = new int[NumChambers]; for (int j = 0; j < NumChambers; j++) { m_targetIndices[j] = j; } m_chainLinks = new ChainLink[NumChambers]; for (int k = 0; k < NumChambers; k++) { m_chainLinks[k] = new ChainLink(); m_chainLinks[k].transform = ChamberModels[k]; m_chainLinks[k].distanceLimit = WaggleDistanceLimit; m_chainLinks[k].gravityScale = WaggleGravityScale; m_chainLinks[k].springRate = WaggleSpringApproachRate; m_chainLinks[k].damping = WaggleDamping; m_chainLinks[k].useSpring = WaggleUseSpring; m_chainLinks[k].useAngleLimit = WaggleUseAngleLimits; m_chainLinks[k].angleLimitDegrees = Mathf.Max(WaggleAngleLimitLeft, WaggleAngleLimitRight); m_chainLinks[k].anchorBlendTime = AnchorBlendTime; m_chainLinks[k].motionResponse = 1f / 15f; if (k == 4 || k == 14) { m_chainLinks[k].damping *= 1.2f; m_chainLinks[k].springRate *= 1.1f; } m_chainLinks[k].positionScale = 0.2f; m_chainLinks[k].Initialize(); m_chainLinks[k].CacheColliders(); } for (int l = 0; l < NumChambers; l++) { int num = (l - 1 + NumChambers) % NumChambers; int num2 = (l + 1) % NumChambers; m_chainLinks[l].prevLink = m_chainLinks[num]; m_chainLinks[l].nextLink = m_chainLinks[num2]; } for (int m = 0; m < NumChambers; m++) { ChamberModels[m].localPosition = ChamberPositions[m]; ChamberModels[m].localRotation = ChamberRotations[m]; } DisableCollisionsBetweenLinks(); m_lastPosition = ((Component)this).transform.position; m_lastRotation = ((Component)this).transform.rotation; } private void DisableCollisionsBetweenLinks() { List list = new List(); Transform[] chamberModels = ChamberModels; foreach (Transform val in chamberModels) { Collider[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); if (componentsInChildren != null && componentsInChildren.Length > 0) { list.AddRange(componentsInChildren); } } if (list.Count <= 0) { return; } for (int j = 0; j < list.Count; j++) { if ((Object)(object)list[j] == (Object)null || !list[j].enabled) { continue; } for (int k = j + 1; k < list.Count; k++) { if (!((Object)(object)list[k] == (Object)null) && list[k].enabled) { Physics.IgnoreCollision(list[j], list[k], true); } } } } public void Advance() { m_isAdvancing = true; for (int i = 0; i < NumChambers; i++) { m_targetIndices[i] = (m_targetIndices[i] + 1) % NumChambers; m_lerpProgress[i] = 0f; } } public void StartAdvanceLerp() { m_isAdvancing = true; for (int i = 0; i < NumChambers; i++) { m_targetIndices[i] = (m_targetIndices[i] + 1) % NumChambers; m_lerpProgress[i] = 0f; } } public void SetHammerLerp(float lerp) { m_hammerLerp = lerp; } private float CalculateMovement() { //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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_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) float num = 0f; if ((Object)(object)m_firearmRb != (Object)null) { Vector3 velocity = m_firearmRb.velocity; num = ((Vector3)(ref velocity)).magnitude; } else if ((Object)(object)m_firearm != (Object)null) { num = Vector3.Distance(((Component)m_firearm).transform.position, m_lastPosition) / Mathf.Max(Time.deltaTime, 0.0001f); m_lastPosition = ((Component)m_firearm).transform.position; } else { num = Vector3.Distance(((Component)this).transform.position, m_lastPosition) / Mathf.Max(Time.deltaTime, 0.0001f); m_lastPosition = ((Component)this).transform.position; } float num2 = Quaternion.Angle(((Component)this).transform.rotation, m_lastRotation) / 90f; m_lastRotation = ((Component)this).transform.rotation; float num3 = Mathf.Max(num, num2 * 5f); m_movementAmount = Mathf.Lerp(m_movementAmount, num3, Time.deltaTime * 10f); CheckPlayJingleSound(m_movementAmount); return m_movementAmount; } private void CheckPlayJingleSound(float movement) { if (!EnableJingleSound || !((Object)(object)m_firearm != (Object)null) || !((FVRInteractiveObject)m_firearm).IsHeld || !(movement > JingleVelocityThreshold) || !(Time.time > m_lastJingleTime + JingleCooldownTime)) { return; } try { if ((Object)(object)m_firearm != (Object)null && (Object)(object)m_firearm.AudioClipSet != (Object)null && m_firearm.AudioClipSet.BeltGrab != null && m_firearm.AudioClipSet.BeltGrab.Clips != null && m_firearm.AudioClipSet.BeltGrab.Clips.Count > 0) { m_firearm.PlayAudioEvent((FirearmAudioEventType)50, 1f); m_lastJingleTime = Time.time; } } catch (Exception) { } } private void UpdateKinematicLinks() { int num = -2; int num2 = 6; for (int i = 0; i < NumChambers; i++) { m_chainLinks[i].isKinematic = false; } for (int j = 0; j < num2; j++) { int num3 = (CurrentChamberIndex + num + j + NumChambers) % NumChambers; if (num3 >= 0 && num3 < NumChambers) { m_chainLinks[num3].isKinematic = true; } } } private void Update() { //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) if (m_chainLinks == null) { return; } float movementAmount = CalculateMovement(); bool flag = true; for (int i = 0; i < NumChambers; i++) { if (m_lerpProgress[i] < 1f) { flag = false; break; } } if (flag) { m_isAdvancing = false; } if (m_hammerLerp > 0f && m_hammerLerp < 1f) { for (int j = 0; j < NumChambers; j++) { int num = m_targetIndices[j]; int num2 = (m_targetIndices[j] + 1) % NumChambers; Vector3 val = Vector3.Lerp(ChamberPositions[num], ChamberPositions[num2], m_hammerLerp); Quaternion val2 = Quaternion.Slerp(ChamberRotations[num], ChamberRotations[num2], m_hammerLerp); ChamberModels[j].localPosition = val; ChamberModels[j].localRotation = val2; m_chainLinks[j].SetBasePosition(val, val2); } } else { for (int k = 0; k < NumChambers; k++) { if (m_lerpProgress[k] < 1f) { m_lerpProgress[k] += Time.deltaTime / ((!(CurrentLerpDuration > 0f)) ? 0.1f : CurrentLerpDuration); if (m_lerpProgress[k] > 1f) { m_lerpProgress[k] = 1f; } } int num3 = (m_targetIndices[k] + NumChambers - 1) % NumChambers; int num4 = m_targetIndices[k]; Vector3 pos = Vector3.Lerp(ChamberPositions[num3], ChamberPositions[num4], m_lerpProgress[k]); Quaternion rot = Quaternion.Slerp(ChamberRotations[num3], ChamberRotations[num4], m_lerpProgress[k]); m_chainLinks[k].SetBasePosition(pos, rot); } } UpdateKinematicLinks(); if (WaggleMode == WaggleModeType.SinglePendulum) { UpdatePendulumChain(Time.deltaTime); } else { for (int l = 0; l < NumChambers; l++) { m_chainLinks[l].UpdatePhysics(Mathf.Min(Time.deltaTime, 1f / 30f), movementAmount, m_isAdvancing); } } if (FreezeLinkColliders) { for (int m = 0; m < NumChambers; m++) { m_chainLinks[m].HoldCollidersAtRest(); } } } private void OnEnable() { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Pendulum.Reset(); m_sag = Vector3.zero; m_sagVelocity = Vector3.zero; } private void FixedUpdate() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (m_chainLinks == null || WaggleMode != WaggleModeType.SinglePendulum) { return; } Transform pivot = ((!((Object)(object)PendulumPivot != (Object)null)) ? ((Component)this).transform : PendulumPivot); Transform root = ((!((Object)(object)m_firearm != (Object)null)) ? ((Component)this).transform : ((Component)m_firearm).transform); int num; if ((Object)(object)m_firearm != (Object)null && (Object)(object)m_firearmRb != (Object)null && !((FVRInteractiveObject)m_firearm).IsHeld) { Vector3 velocity = m_firearmRb.velocity; if (((Vector3)(ref velocity)).sqrMagnitude < RestLinearSpeed * RestLinearSpeed) { Vector3 angularVelocity = m_firearmRb.angularVelocity; num = ((((Vector3)(ref angularVelocity)).sqrMagnitude < RestAngularSpeed * RestAngularSpeed) ? 1 : 0); goto IL_00e5; } } num = 0; goto IL_00e5; IL_00e5: bool flag = (byte)num != 0; Pendulum.Step(root, pivot, Time.fixedDeltaTime, (!flag) ? 1f : RestDampingMultiplier); } private bool IsChainBlocker(Collider c) { if (ChainBlockers != null) { for (int i = 0; i < ChainBlockers.Length; i++) { if ((Object)(object)ChainBlockers[i] == (Object)(object)c) { return true; } } } if (c.isTrigger) { return false; } if (ChamberModels != null && ChamberModels.Length > 0 && (Object)(object)ChamberModels[0] != (Object)null) { Transform parent = ChamberModels[0].parent; if ((Object)(object)parent != (Object)null && ((Component)c).transform.IsChildOf(parent)) { return false; } } if ((Object)(object)m_firearmRb != (Object)null) { return (Object)(object)c.attachedRigidbody == (Object)(object)m_firearmRb; } return (Object)(object)m_firearm != (Object)null && ((Component)c).transform.IsChildOf(((Component)m_firearm).transform); } private float AllowedFraction(Vector3 restWorld, Vector3 worldOffset) { //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_0046: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) float magnitude = ((Vector3)(ref worldOffset)).magnitude; if (magnitude < 0.0005f) { return 1f; } if (m_castHits == null) { m_castHits = (RaycastHit[])(object)new RaycastHit[16]; } Vector3 val = worldOffset / magnitude; int num = Physics.SphereCastNonAlloc(restWorld, LinkCollisionRadius, val, m_castHits, magnitude, -1, (QueryTriggerInteraction)2); float num2 = magnitude; for (int i = 0; i < num; i++) { RaycastHit val2 = m_castHits[i]; if (!((Object)(object)((RaycastHit)(ref val2)).collider == (Object)null) && !(((RaycastHit)(ref val2)).distance <= 1E-05f) && IsChainBlocker(((RaycastHit)(ref val2)).collider) && ((RaycastHit)(ref val2)).distance < num2) { num2 = ((RaycastHit)(ref val2)).distance; } } float num3 = ((!(num2 >= magnitude)) ? Mathf.Max(0f, num2 - LinkCollisionSkin) : magnitude); if (LinkEnvironmentCollision && ((LayerMask)(ref EnvironmentMask)).value != 0) { int num4 = Physics.RaycastNonAlloc(restWorld, val, m_castHits, magnitude + LinkCollisionRadius, ((LayerMask)(ref EnvironmentMask)).value, (QueryTriggerInteraction)1); for (int j = 0; j < num4; j++) { RaycastHit val3 = m_castHits[j]; Collider collider = ((RaycastHit)(ref val3)).collider; if (!((Object)(object)collider == (Object)null) && !collider.isTrigger && !IsPartOfThisGun(collider)) { float num5 = Mathf.Max(0f, ((RaycastHit)(ref val3)).distance - LinkCollisionRadius - LinkCollisionSkin); if (num5 < num3) { num3 = num5; } } } } if (num3 >= magnitude) { return 1f; } return Mathf.Clamp01(num3 / magnitude); } private bool IsPartOfThisGun(Collider c) { if ((Object)(object)m_firearmRb != (Object)null && (Object)(object)c.attachedRigidbody == (Object)(object)m_firearmRb) { return true; } if ((Object)(object)m_firearm != (Object)null && ((Component)c).transform.IsChildOf(((Component)m_firearm).transform)) { return true; } return ((Component)c).transform.IsChildOf(((Component)this).transform); } private Vector3 ComputeGravitySag(Transform pivot, Transform root) { //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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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) if (!GravitySag || GravitySagDistance <= 0f) { return Vector3.zero; } Vector3 gravity = Physics.gravity; if (((Vector3)(ref gravity)).sqrMagnitude < 1E-06f) { return Vector3.zero; } Quaternion val = Quaternion.Inverse(root.rotation) * pivot.rotation; Vector3 val2 = root.InverseTransformDirection(((Vector3)(ref gravity)).normalized); Vector3 val3 = ((!(((Vector3)(ref Pendulum.Aim)).sqrMagnitude > 1E-08f)) ? Vector3.down : ((Vector3)(ref Pendulum.Aim)).normalized); Vector3 val4 = val * val3; Vector3 val5 = val2 - val4 * Vector3.Dot(val2, val4); if ((Pendulum.LimitPlane0 || Pendulum.LimitPlane1) && ((Vector3)(ref Pendulum.PlaneNormal)).sqrMagnitude > 1E-08f) { Vector3 val6 = val * ((Vector3)(ref Pendulum.PlaneNormal)).normalized; val5 -= val6 * Vector3.Dot(val5, val6); } return val5 * GravitySagDistance; } private void UpdatePendulumChain(float deltaTime) { //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: 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_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_053f: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_0375: 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_0382: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: 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_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_0636: Unknown result type (might be due to invalid IL or missing references) //IL_0638: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) Transform pivot = ((!((Object)(object)PendulumPivot != (Object)null)) ? ((Component)this).transform : PendulumPivot); Transform val = ((!((Object)(object)m_firearm != (Object)null)) ? ((Component)this).transform : ((Component)m_firearm).transform); if (m_swingTarget == null || m_swingTarget.Length != NumChambers) { m_swingTarget = new float[NumChambers]; m_swingPos = (Vector3[])(object)new Vector3[NumChambers]; } for (int i = 0; i < NumChambers; i++) { m_swingTarget[i] = 0f; m_chainLinks[i].UpdateAnchor(deltaTime); } int num = -1; for (int j = 0; j < NumChambers; j++) { if (m_chainLinks[j].isKinematic && !m_chainLinks[(j + 1) % NumChambers].isKinematic) { num = (j + 1) % NumChambers; break; } } if (num >= 0) { int k; for (k = 0; k < NumChambers && !m_chainLinks[(num + k) % NumChambers].isKinematic; k++) { } for (int l = 0; l < k; l++) { float num2 = ((float)l + 1f) / ((float)k + 1f); m_swingTarget[(num + l) % NumChambers] = Mathf.Sin((float)Math.PI * num2); } } Vector3 val2 = ComputeGravitySag(pivot, val); if (deltaTime > 0f) { m_sag = Vector3.SmoothDamp(m_sag, val2, ref m_sagVelocity, Mathf.Max(GravitySagSmoothTime, 0.0001f), float.PositiveInfinity, deltaTime); } Vector3 val3 = m_sag; if (Pendulum.Initialized) { val3 += Pendulum.TipDisplacement * PendulumChainScale; } Vector3 val4 = val.TransformDirection(val3); float num3 = deltaTime / Mathf.Max(AnchorBlendTime, 0.0001f); if (m_swingOffset == null || m_swingOffset.Length != NumChambers) { m_swingOffset = (Vector3[])(object)new Vector3[NumChambers]; m_allowed = new float[NumChambers]; } for (int m = 0; m < NumChambers; m++) { ChainLink chainLink = m_chainLinks[m]; chainLink.swingWeight = Mathf.MoveTowards(chainLink.swingWeight, m_swingTarget[m], num3); Transform parent = chainLink.transform.parent; Vector3 val5 = ((!((Object)(object)parent != (Object)null)) ? (val4 * chainLink.swingWeight) : (parent.InverseTransformVector(val4) * chainLink.swingWeight)); m_swingOffset[m] = val5; m_allowed[m] = 1f; if (LinkGunCollision) { Vector3 restWorld = ((!((Object)(object)parent != (Object)null)) ? chainLink.baseLocalPos : parent.TransformPoint(chainLink.baseLocalPos)); Vector3 worldOffset = ((!((Object)(object)parent != (Object)null)) ? val5 : parent.TransformVector(val5)); m_allowed[m] = AllowedFraction(restWorld, worldOffset); } } if (LinkGunCollision) { for (int n = 0; n < 2; n++) { for (int num4 = 0; num4 < NumChambers; num4++) { int num5 = (num4 - 1 + NumChambers) % NumChambers; m_allowed[num4] = Mathf.Min(m_allowed[num4], m_allowed[num5] + CollisionPropagation); } for (int num6 = NumChambers - 1; num6 >= 0; num6--) { int num7 = (num6 + 1) % NumChambers; m_allowed[num6] = Mathf.Min(m_allowed[num6], m_allowed[num7] + CollisionPropagation); } } } for (int num8 = 0; num8 < NumChambers; num8++) { ChainLink chainLink2 = m_chainLinks[num8]; Vector3 val6 = m_swingOffset[num8]; if (LinkGunCollision) { float num9 = m_allowed[num8]; if (num9 < chainLink2.collisionFraction) { chainLink2.collisionFraction = num9; } else { chainLink2.collisionFraction = Mathf.MoveTowards(chainLink2.collisionFraction, num9, deltaTime * CollisionRelaxRate); } val6 *= chainLink2.collisionFraction; } ref Vector3 reference = ref m_swingPos[num8]; reference = chainLink2.baseLocalPos + val6; chainLink2.transform.localPosition = m_swingPos[num8]; chainLink2.transform.localRotation = chainLink2.baseLocalRot; } if (!PendulumFollowTangent) { return; } for (int num10 = 0; num10 < NumChambers; num10++) { ChainLink chainLink3 = m_chainLinks[num10]; if (!(chainLink3.swingWeight < 0.001f)) { int num11 = (num10 - 1 + NumChambers) % NumChambers; int num12 = (num10 + 1) % NumChambers; Vector3 val7 = m_chainLinks[num12].baseLocalPos - m_chainLinks[num11].baseLocalPos; Vector3 val8 = m_swingPos[num12] - m_swingPos[num11]; if (!(((Vector3)(ref val7)).sqrMagnitude < 1E-10f) && !(((Vector3)(ref val8)).sqrMagnitude < 1E-10f)) { chainLink3.transform.localRotation = Quaternion.FromToRotation(val7, val8) * chainLink3.baseLocalRot; } } } } private void OnDrawGizmosSelected() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) if (PendulumGizmos && WaggleMode == WaggleModeType.SinglePendulum) { Transform val = ((!((Object)(object)PendulumPivot != (Object)null)) ? ((Component)this).transform : PendulumPivot); float num = Mathf.Max(Pendulum.Length, 0.1f); Vector3 val2 = ((!(((Vector3)(ref Pendulum.Aim)).sqrMagnitude > 1E-08f)) ? Vector3.down : ((Vector3)(ref Pendulum.Aim)).normalized); Gizmos.color = Color.white; Gizmos.DrawLine(val.position, val.position + val.TransformDirection(val2) * num); Gizmos.color = Color.yellow; Gizmos.DrawLine(val.position, val.position + val.TransformDirection(((Vector3)(ref Pendulum.PlaneNormal)).normalized) * 0.1f); if (Application.isPlaying && Pendulum.Initialized) { Gizmos.color = Color.red; Gizmos.DrawLine(val.position, Pendulum.PosGlobal); Gizmos.DrawSphere(Pendulum.PosGlobal, 0.01f); } } } } public class ChainEjectorRod : FVRInteractiveObject { public Chain ChainRevolver; public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); if ((Object)(object)ChainRevolver != (Object)null) { ChainRevolver.EjectPrevCylinder(); } } } } public class ComponentActivateRandomRuntime : MonoBehaviour { public float Probability; public int Group; public float SelectionStart; [NonSerialized] private bool rollResolved; [NonSerialized] private float sharedRoll; private void Awake() { if (Probability >= 1f) { return; } bool flag; if (Group != 0) { if (!rollResolved) { ResolveGroupRollsForRoot(); } flag = sharedRoll >= SelectionStart && sharedRoll <= SelectionStart + Probability; } else { flag = Random.value <= Probability; } if (!flag) { ((Component)this).gameObject.SetActive(false); } } private void ResolveGroupRollsForRoot() { ComponentActivateRandomRuntime[] componentsInChildren = ((Component)((Component)this).transform.root).GetComponentsInChildren(true); Dictionary dictionary = new Dictionary(); foreach (ComponentActivateRandomRuntime componentActivateRandomRuntime in componentsInChildren) { if (componentActivateRandomRuntime.Group != 0 && !componentActivateRandomRuntime.rollResolved) { if (!dictionary.TryGetValue(componentActivateRandomRuntime.Group, out var value)) { value = Random.value; dictionary[componentActivateRandomRuntime.Group] = value; } componentActivateRandomRuntime.sharedRoll = value; componentActivateRandomRuntime.rollResolved = true; } } } } 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(); } 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(); if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)weapon).gameObject.AddComponent(); } 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); } } [ExecuteInEditMode] public class CryErosionDriver : MonoBehaviour { private static readonly int ErosionValueId = Shader.PropertyToID("_ErosionValue"); [Range(0f, 1f)] public float Burn = 0f; public Renderer[] Renderers; public bool HideWhenGone = true; private MaterialPropertyBlock _block; private float _burnRate; private float _lastApplied = -1f; public void BurnOver(float seconds) { _burnRate = ((!(seconds > 0.0001f)) ? 0f : ((1f - Burn) / seconds)); if (_burnRate <= 0f) { Burn = 1f; } } public void Restore() { _burnRate = 0f; Burn = 0f; Apply(force: true); } private void LateUpdate() { if (_burnRate > 0f && Application.isPlaying) { Burn = Mathf.Min(1f, Burn + _burnRate * Time.deltaTime); if (Burn >= 1f) { _burnRate = 0f; } } Apply(force: false); } private void OnValidate() { Apply(force: true); } private void Apply(bool force) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown float num = Mathf.Clamp01(Burn); if (!force && Mathf.Approximately(num, _lastApplied)) { return; } _lastApplied = num; if (Renderers == null || Renderers.Length == 0) { Renderers = ((Component)this).GetComponentsInChildren(true); } if (_block == null) { _block = new MaterialPropertyBlock(); } bool flag = HideWhenGone && num >= 1f; for (int i = 0; i < Renderers.Length; i++) { Renderer val = Renderers[i]; if (!((Object)(object)val == (Object)null)) { val.GetPropertyBlock(_block); _block.SetFloat(ErosionValueId, 1f - num); val.SetPropertyBlock(_block); if (HideWhenGone) { val.enabled = !flag; } } } } } namespace BitWizrd.Revolver.ConversionChain { [Serializable] public class CryPendulum { [Tooltip("Direction the pendulum hangs at rest, in the PIVOT's local space. Hunt chain_jiggle: (0,-1,0) in the joint's own (Cry) axes.")] public Vector3 Aim = Vector3.down; [Tooltip("Normal of the plane the pendulum is confined to, in the pivot's local space. Hunt: aim.GetOrthogonal() = (0,0,1) for aim (0,-1,0).")] public Vector3 PlaneNormal = Vector3.forward; [Tooltip("Hunt: both planes on, which confines the swing to one plane.")] public bool LimitPlane0 = true; public bool LimitPlane1 = true; [Tooltip("Lever arm in metres (min 0.1). Root translation deflects the bob by roughly displacement / length, so this matters. Hunt: 0.5")] public float Length = 0.5f; [Tooltip("Spring towards the aim direction. Enters SQUARED. Hunt: 25")] public float Stiffness = 25f; [Tooltip("Linear damping, 1 - damping * dt per frame. Hunt: 2")] public float Damping = 2f; [Tooltip("Per-axis gain on how far root movement drags the bob (root-local axes). Hunt: 1,1,1")] public Vector3 ForceMovementMultiplier = Vector3.one; [Tooltip("WORLD gravity in m/s^2. Hunt chaingun: 0 (pure inertia).")] public Vector3 Gravity = Vector3.zero; [Tooltip("Maximum deflection from the aim direction, degrees. Hunt: 15")] public float LimitAngle = 15f; [Tooltip("If root movement in one frame exceeds this many metres (teleport, spawn), the bob is snapped back to rest instead of being flung.")] public float TeleportResetDistance = 1f; private Vector3 m_posAbs; private Vector3 m_posGlobal; private Vector3 m_vel; private bool m_init; private Vector3 m_tipDisplacement; private Quaternion m_rotation = Quaternion.identity; public Vector3 PosGlobal => m_posGlobal; public bool Initialized => m_init; public Vector3 TipDisplacement => m_tipDisplacement; public Quaternion Rotation => m_rotation; public void Reset() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) m_init = false; m_vel = Vector3.zero; m_tipDisplacement = Vector3.zero; m_rotation = Quaternion.identity; } public void Step(Transform root, Transform pivot, float deltaTime) { Step(root, pivot, deltaTime, 1f); } public void Step(Transform root, Transform pivot, float deltaTime, float dampingScale) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_0229: 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_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: 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_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: 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_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: 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_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0391: 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_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)root == (Object)null) && !((Object)(object)pivot == (Object)null)) { float num = Mathf.Clamp(deltaTime, 0.001f, 0.0333f); float num2 = Mathf.Max(Length, 0.1f); Quaternion val = Quaternion.Inverse(root.rotation) * pivot.rotation; Vector3 val2 = root.InverseTransformPoint(pivot.position); Vector3 val3 = ((!(((Vector3)(ref Aim)).sqrMagnitude > 1E-08f)) ? Vector3.down : ((Vector3)(ref Aim)).normalized); Vector3 val4 = val * (val3 * num2); Vector3 normalized = ((Vector3)(ref val4)).normalized; if (!m_init) { m_posAbs = val2 + normalized * num2; m_posGlobal = root.TransformPoint(m_posAbs); m_vel = Vector3.zero; m_init = true; } Vector3 val5 = m_posAbs - val2; Vector3 val6 = root.InverseTransformPoint(m_posGlobal) - m_posAbs; if (((Vector3)(ref val6)).magnitude > TeleportResetDistance) { m_posAbs = val2 + normalized * num2; m_posGlobal = root.TransformPoint(m_posAbs); m_vel = Vector3.zero; val5 = m_posAbs - val2; val6 = Vector3.zero; } Vector3 val7 = val5 + Vector3.Scale(val6, ForceMovementMultiplier); if (((Vector3)(ref val7)).sqrMagnitude < 1E-12f) { val7 = normalized * num2; } Vector3 normalized2 = ((Vector3)(ref val7)).normalized; Vector3 val8 = Vector3.Cross(Vector3.Cross(normalized, normalized2), val7); float num3 = 1f - (Vector3.Dot(normalized, normalized2) + 1f) * 0.5f; float sqrMagnitude = ((Vector3)(ref val8)).sqrMagnitude; if (sqrMagnitude > 1E-20f) { m_vel -= val8 * (1f / Mathf.Sqrt(sqrMagnitude)) * (Stiffness * Stiffness * num3 * num); } Vector3 direction = val7 + m_vel * num; ApplyPlanes(val, ref direction, ref m_vel); if (((Vector3)(ref direction)).sqrMagnitude < 1E-12f) { direction = normalized; } ((Vector3)(ref direction)).Normalize(); float num4 = Vector3.Dot(normalized, direction) + 1f; if (num4 > 1E-05f) { ApplyCone(normalized, ref direction, ref m_vel); Quaternion val9 = Quaternion.FromToRotation(normalized, direction); m_vel = (val9 * normalized * num2 - val7) / num; m_posAbs = val2 + val9 * normalized * num2; m_posGlobal = root.TransformPoint(m_posAbs); m_rotation = val9; } else { m_vel = (direction * num2 - val7) / num; m_posAbs = val2 + direction * num2; m_posGlobal = root.TransformPoint(m_posAbs); } m_vel += root.InverseTransformDirection(Gravity) * num; m_vel *= Mathf.Max(0f, 1f - Damping * Mathf.Max(dampingScale, 0f) * num); m_tipDisplacement = m_posAbs - (val2 + normalized * num2); } } private void ApplyPlanes(Quaternion nodeQ, ref Vector3 direction, ref Vector3 velocity) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //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_0049: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_00b7: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00fa: Unknown result type (might be due to invalid IL or missing references) if ((!LimitPlane0 && !LimitPlane1) || ((Vector3)(ref PlaneNormal)).sqrMagnitude < 1E-08f) { return; } Quaternion val = Quaternion.Inverse(nodeQ); Vector3 val2 = val * direction; Vector3 val3 = val * velocity; Vector3 normalized = ((Vector3)(ref PlaneNormal)).normalized; if (LimitPlane0) { float num = Vector3.Dot(val2, normalized); if (num <= 0f) { val2 -= normalized * num; val3 -= normalized * Vector3.Dot(val3, normalized); } } if (LimitPlane1) { Vector3 val4 = -normalized; float num2 = Vector3.Dot(val2, val4); if (num2 <= 0f) { val2 -= val4 * num2; val3 -= val4 * Vector3.Dot(val3, val4); } } direction = nodeQ * val2; velocity = nodeQ * val3; } private void ApplyCone(Vector3 target, ref Vector3 direction, ref Vector3 velocity) { //IL_0001: 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_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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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) if (!(Vector3.Angle(target, direction) <= LimitAngle)) { velocity -= target * Mathf.Max(0f, Vector3.Dot(velocity, target)); Vector3 val = Vector3.Cross(target, direction); if (!(((Vector3)(ref val)).sqrMagnitude < 1E-12f)) { direction = Quaternion.AngleAxis(LimitAngle, ((Vector3)(ref val)).normalized) * target; } } } } } [ExecuteInEditMode] public class CryRibbon : MonoBehaviour { private class ParentSlot { public uint Seed; public Vector3 Pos; public Vector3 Vel; public float Age01 = 1f; public bool Dead; } private struct SeedInfo { public int Slot; public float Fraction; } private sealed class AgeComparer : IComparer { public Particle[] Buf; public int Compare(int a, int b) { float num = ((Particle)(ref Buf[a])).startLifetime - ((Particle)(ref Buf[a])).remainingLifetime; float num2 = ((Particle)(ref Buf[b])).startLifetime - ((Particle)(ref Buf[b])).remainingLifetime; if (num > num2) { return -1; } if (num < num2) { return 1; } return 0; } } public ParticleSystem OwnPs; public ParticleSystem ParentSystem; public Transform EffectRoot; public Material RibbonMaterial; public float SizeConstant = 1f; public AnimationCurve SizeOverLife = new AnimationCurve(); public AnimationCurve SizeBySpawnFraction = new AnimationCurve(); public float OpacityConstant = 1f; public AnimationCurve OpacityOverLife = new AnimationCurve(); public AnimationCurve OpacityBySpawnFraction = new AnimationCurve(); public Gradient ColorOverLife = new Gradient(); public bool StreamFromAge; public float TextureFrequency = 1f; public bool FlipU; public bool FlipV; public bool ConnectToParent; public bool SampleParentAlpha; public AnimationCurve ParentOpacityOverLife = null; public AnimationCurve FacingOpacity = null; public int PerParentTotal = 1; public float SpawnDelay; public float SpawnDuration; public bool RateMode; public float SpawnRate; public float CountMin = 1f; public float CountMax = 1f; public float RestartPeriod; public float LifetimeMin = 1f; public float LifetimeMax = 1f; public int VelocityMode; public Vector3 AxisLocal = Vector3.up; public float ConeAngle; public float SpeedMin; public float SpeedMax; public AnimationCurve SpeedBySpawnFraction = new AnimationCurve(); public float Drag; public float GravityScale; public bool LifetimePerInstance; public AnimationCurve DragParentAge = null; public AnimationCurve DragSpawnFraction = null; private readonly List m_parents = new List(); private readonly Dictionary m_parentIndex = new Dictionary(); private readonly Dictionary m_vertSlot = new Dictionary(); private readonly Dictionary m_seedFirstFrame = new Dictionary(); private readonly List m_prune = new List(); private readonly Dictionary m_slotBirthCount = new Dictionary(); private Particle[] m_ownBuf = (Particle[])(object)new Particle[0]; private Particle[] m_parentBuf = (Particle[])(object)new Particle[0]; private readonly HashSet m_liveSeeds = new HashSet(); private readonly List m_seen = new List(); private readonly List m_freeSlots = new List(); private readonly Dictionary m_slotRefs = new Dictionary(); private readonly Dictionary m_groupIndex = new Dictionary(); private readonly List> m_groupLists = new List>(); private readonly List m_groupSlots = new List(); private readonly AgeComparer m_ageComparer = new AgeComparer(); private const int k_slotRecycleThreshold = 32; private Mesh m_mesh; private readonly List m_verts = new List(); private readonly List m_uvs = new List(); private readonly List m_cols = new List(); private readonly List m_norms = new List(); private readonly List m_tans = new List(); private readonly List m_tris = new List(); private readonly Vector3[] m_posBuf = (Vector3[])(object)new Vector3[256]; private readonly float[] m_fracBuf = new float[256]; private readonly float[] m_ageBuf = new float[256]; public static readonly List EditInstances = new List(); private int m_lastFrame = -1; private static Camera s_viewerCamera; public bool IsBusy { get { if (!((Behaviour)this).isActiveAndEnabled) { return false; } if ((Object)(object)OwnPs == (Object)null) { OwnPs = ((Component)this).GetComponent(); } if ((Object)(object)OwnPs != (Object)null && OwnPs.particleCount > 0) { return true; } if ((Object)(object)ParentSystem != (Object)null && ParentSystem.IsAlive(true)) { return true; } return false; } } public int InstanceCount => m_parents.Count; public int TrackCount => m_parents.Count; private void OnEnable() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown if (!Application.isPlaying && !EditInstances.Contains(this)) { EditInstances.Add(this); } m_parents.Clear(); m_parentIndex.Clear(); m_freeSlots.Clear(); m_vertSlot.Clear(); m_seedFirstFrame.Clear(); m_slotBirthCount.Clear(); if ((Object)(object)OwnPs == (Object)null) { OwnPs = ((Component)this).GetComponent(); } if ((Object)(object)m_mesh == (Object)null) { m_mesh = new Mesh(); ((Object)m_mesh).hideFlags = (HideFlags)61; ((Object)m_mesh).name = "CryRibbon"; m_mesh.MarkDynamic(); } } private void OnDisable() { EditInstances.Remove(this); } public void EditorTick() { if (!Application.isPlaying && !((Object)(object)this == (Object)null)) { LateUpdate(); } } private void OnDestroy() { if (!((Object)(object)m_mesh == (Object)null)) { if (Application.isPlaying) { Object.Destroy((Object)(object)m_mesh); } else { Object.DestroyImmediate((Object)(object)m_mesh); } } } private void LateUpdate() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)RibbonMaterial == (Object)null) { return; } int frame = CryEditClock.Frame; if (m_lastFrame == frame) { return; } m_lastFrame = frame; if ((Object)(object)OwnPs == (Object)null) { OwnPs = ((Component)this).GetComponent(); } if (!((Object)(object)OwnPs == (Object)null)) { UpdateParents(); Camera val = ResolveViewerCamera(); if (!((Object)(object)val == (Object)null)) { BuildAndDraw(((Component)val).transform.position); } } } private void UpdateParents() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ParentSystem == (Object)null) { return; } MainModule main = ParentSystem.main; int maxParticles = ((MainModule)(ref main)).maxParticles; if (m_parentBuf.Length < maxParticles) { m_parentBuf = (Particle[])(object)new Particle[maxParticles]; } int particles = ParentSystem.GetParticles(m_parentBuf); RecycleDeadSlots(); m_seen.Clear(); for (int i = 0; i < m_parents.Count; i++) { m_seen.Add(item: false); } for (int j = 0; j < particles; j++) { uint randomSeed = ((Particle)(ref m_parentBuf[j])).randomSeed; if (!m_parentIndex.TryGetValue(randomSeed, out var value)) { if (m_freeSlots.Count > 0) { value = m_freeSlots[m_freeSlots.Count - 1]; m_freeSlots.RemoveAt(m_freeSlots.Count - 1); m_parents[value].Seed = randomSeed; } else { ParentSlot parentSlot = new ParentSlot(); parentSlot.Seed = randomSeed; value = m_parents.Count; m_parents.Add(parentSlot); m_seen.Add(item: false); } m_parentIndex[randomSeed] = value; } ParentSlot parentSlot2 = m_parents[value]; parentSlot2.Pos = ToWorldPoint(ParentSystem, ((Particle)(ref m_parentBuf[j])).position); parentSlot2.Vel = ToWorldVector(ParentSystem, ((Particle)(ref m_parentBuf[j])).velocity); float startLifetime = ((Particle)(ref m_parentBuf[j])).startLifetime; float num = startLifetime - ((Particle)(ref m_parentBuf[j])).remainingLifetime; parentSlot2.Age01 = ((!(startLifetime > 1E-06f)) ? 1f : Mathf.Clamp01(num / startLifetime)); parentSlot2.Dead = false; m_seen[value] = true; } for (int k = 0; k < m_parents.Count; k++) { if (!m_seen[k]) { m_parents[k].Dead = true; } } } private void RecycleDeadSlots() { if (m_parents.Count < 32) { return; } m_slotRefs.Clear(); foreach (KeyValuePair item in m_vertSlot) { m_slotRefs[item.Value.Slot] = 1; } for (int i = 0; i < m_parents.Count; i++) { ParentSlot parentSlot = m_parents[i]; if (parentSlot.Dead && !m_slotRefs.ContainsKey(i) && m_parentIndex.TryGetValue(parentSlot.Seed, out var value) && value == i) { m_parentIndex.Remove(parentSlot.Seed); m_slotBirthCount.Remove(i); m_freeSlots.Add(i); } } } private float ParentAge01(int slot) { if (slot < 0 || slot >= m_parents.Count) { return 1f; } return m_parents[slot].Age01; } private void BuildAndDraw(Vector3 camPos) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: 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_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_0695: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) m_verts.Clear(); m_uvs.Clear(); m_cols.Clear(); m_norms.Clear(); m_tans.Clear(); m_tris.Clear(); MainModule main = OwnPs.main; int maxParticles = ((MainModule)(ref main)).maxParticles; if (m_ownBuf.Length < maxParticles) { m_ownBuf = (Particle[])(object)new Particle[maxParticles]; } int particles = OwnPs.GetParticles(m_ownBuf); bool flag = m_parents.Count > 0; int frame = CryEditClock.Frame; for (int i = 0; i < particles; i++) { uint randomSeed = ((Particle)(ref m_ownBuf[i])).randomSeed; if (m_vertSlot.ContainsKey(randomSeed)) { continue; } if (!m_seedFirstFrame.ContainsKey(randomSeed)) { m_seedFirstFrame[randomSeed] = frame; } Vector3 val = ToWorldVector(OwnPs, ((Particle)(ref m_ownBuf[i])).velocity); bool flag2 = ((Vector3)(ref val)).sqrMagnitude > 1E-08f; bool flag3 = frame - m_seedFirstFrame[randomSeed] >= 3; if (!flag2 && !flag3 && flag) { continue; } SeedInfo value = new SeedInfo { Slot = 0, Fraction = 0f }; if (flag) { int slot = 0; Vector3 val2 = ToWorldPoint(OwnPs, ((Particle)(ref m_ownBuf[i])).position); float num = float.MaxValue; float num2 = float.MaxValue; for (int j = 0; j < m_parents.Count; j++) { if (!m_parents[j].Dead) { Vector3 val3 = val2 - m_parents[j].Pos; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude < num) { num2 = num; num = sqrMagnitude; slot = j; } else if (sqrMagnitude < num2) { num2 = sqrMagnitude; } } } bool flag4 = num2 > 1E-12f && num <= num2 * 0.25f; if (!flag4 && flag2) { float num3 = -2f; Vector3 normalized = ((Vector3)(ref val)).normalized; for (int k = 0; k < m_parents.Count; k++) { if (m_parents[k].Dead) { continue; } Vector3 vel = m_parents[k].Vel; if (!(((Vector3)(ref vel)).sqrMagnitude < 1E-08f)) { float num4 = Vector3.Dot(normalized, ((Vector3)(ref vel)).normalized); if (num4 > num3) { num3 = num4; slot = k; } } } flag4 = true; } if (!flag4) { continue; } value.Slot = slot; } int value2 = 0; m_slotBirthCount.TryGetValue(value.Slot, out value2); int num5 = Mathf.Max(2, PerParentTotal); value.Fraction = Mathf.Clamp01((float)value2 / (float)(num5 - 1)); m_slotBirthCount[value.Slot] = value2 + 1; m_vertSlot[randomSeed] = value; } m_liveSeeds.Clear(); for (int l = 0; l < particles; l++) { m_liveSeeds.Add(((Particle)(ref m_ownBuf[l])).randomSeed); } m_prune.Clear(); foreach (KeyValuePair item in m_vertSlot) { if (!m_liveSeeds.Contains(item.Key)) { m_prune.Add(item.Key); } } for (int m = 0; m < m_prune.Count; m++) { m_vertSlot.Remove(m_prune[m]); m_seedFirstFrame.Remove(m_prune[m]); } m_groupIndex.Clear(); m_groupSlots.Clear(); for (int n = 0; n < particles; n++) { if (!m_vertSlot.TryGetValue(((Particle)(ref m_ownBuf[n])).randomSeed, out var value3)) { continue; } if (!m_groupIndex.TryGetValue(value3.Slot, out var value4)) { value4 = m_groupSlots.Count; if (value4 == m_groupLists.Count) { m_groupLists.Add(new List()); } else { m_groupLists[value4].Clear(); } m_groupIndex[value3.Slot] = value4; m_groupSlots.Add(value3.Slot); } m_groupLists[value4].Add(n); } m_ageComparer.Buf = m_ownBuf; for (int num6 = 0; num6 < m_groupSlots.Count; num6++) { List list = m_groupLists[num6]; list.Sort(m_ageComparer); BuildStrip(list, m_groupSlots[num6], camPos); if (m_verts.Count >= 500) { break; } } m_mesh.Clear(); if (m_verts.Count >= 4) { m_mesh.SetVertices(m_verts); m_mesh.SetUVs(0, m_uvs); m_mesh.SetColors(m_cols); m_mesh.SetNormals(m_norms); m_mesh.SetTangents(m_tans); m_mesh.SetTriangles(m_tris, 0); m_mesh.RecalculateBounds(); Graphics.DrawMesh(m_mesh, Matrix4x4.identity, RibbonMaterial, ((Component)this).gameObject.layer, (Camera)null, 0, (MaterialPropertyBlock)null, false, false); } } private void BuildStrip(List order, int slot, Vector3 camPos) { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: 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_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022d: 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_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0259: 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_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: 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_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0660: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Unknown result type (might be due to invalid IL or missing references) //IL_067d: 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_069a: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_06b4: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Unknown result type (might be due to invalid IL or missing references) //IL_06ba: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Unknown result type (might be due to invalid IL or missing references) //IL_06d3: Unknown result type (might be due to invalid IL or missing references) //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_06f0: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: 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_0385: 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_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_0408: 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_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_0593: 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_059b: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) int num = order.Count; bool flag = ConnectToParent && (Object)(object)ParentSystem != (Object)null && slot >= 0 && slot < m_parents.Count && !m_parents[slot].Dead; if (num + (flag ? 1 : 0) < 2) { return; } if (num > m_posBuf.Length) { num = m_posBuf.Length; } int count = m_verts.Count; for (int i = 0; i < num; i++) { int num2 = order[i]; ref Vector3 reference = ref m_posBuf[i]; reference = ToWorldPoint(OwnPs, ((Particle)(ref m_ownBuf[num2])).position); float num3 = 0f; if (m_vertSlot.TryGetValue(((Particle)(ref m_ownBuf[num2])).randomSeed, out var value)) { num3 = value.Fraction; } m_fracBuf[i] = num3; float startLifetime = ((Particle)(ref m_ownBuf[num2])).startLifetime; float num4 = startLifetime - ((Particle)(ref m_ownBuf[num2])).remainingLifetime; m_ageBuf[i] = ((!(startLifetime > 1E-06f)) ? 1f : Mathf.Clamp01(num4 / startLifetime)); } bool flag2 = FacingOpacity != null && FacingOpacity.length > 0; Vector3 val = Vector3.right; float num5 = 0f; Color32 item = default(Color32); ((Color32)(ref item))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0); float num6 = 0f; Vector3 val2 = Vector3.forward; Vector4 item2 = default(Vector4); for (int j = 0; j < num; j++) { float num7 = m_ageBuf[j]; Vector3 val3 = m_posBuf[Mathf.Min(j + 1, num - 1)] - m_posBuf[Mathf.Max(j - 1, 0)]; Vector3 val4 = m_posBuf[j] - camPos; Vector3 val5 = Vector3.Cross(val3, val4); if (((Vector3)(ref val5)).sqrMagnitude < 1E-12f) { val5 = val; } else { ((Vector3)(ref val5)).Normalize(); } val = val5; float num8 = ((SizeOverLife == null || SizeOverLife.length <= 0) ? SizeConstant : SizeOverLife.Evaluate(num7)); if (SizeBySpawnFraction != null && SizeBySpawnFraction.length > 0) { num8 *= SizeBySpawnFraction.Evaluate(m_fracBuf[j]); } float num9 = Mathf.Max(num8, 0f); float num10 = ((OpacityOverLife == null || OpacityOverLife.length <= 0) ? OpacityConstant : OpacityOverLife.Evaluate(num7)); if (OpacityBySpawnFraction != null && OpacityBySpawnFraction.length > 0) { num10 *= OpacityBySpawnFraction.Evaluate(m_fracBuf[j]); } if (SampleParentAlpha) { num10 *= EvaluateParentAlpha(ParentAge01(slot)); } if (flag2) { float magnitude = ((Vector3)(ref val3)).magnitude; if (magnitude > 1E-06f) { num10 *= FacingOpacity.Evaluate(Mathf.Clamp01(Mathf.Abs(Vector3.Dot(val3 / magnitude, ((Vector3)(ref val4)).normalized)))); } } Color val6 = ((ColorOverLife == null) ? Color.white : ColorOverLife.Evaluate(num7)); num10 *= 1f - Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((num7 - 0.85f) / 0.15f)); val6.a = Mathf.Clamp01(num10); Color32 val7 = Color32.op_Implicit(val6); float num11 = 1f - ((!StreamFromAge) ? m_fracBuf[j] : num7) * TextureFrequency; num11 -= Mathf.Floor(num11); if (FlipV) { num11 = 1f - num11; } float num12 = ((!FlipU) ? 0f : 1f); float num13 = ((!FlipU) ? 1f : 0f); Vector3 val8 = -((Vector3)(ref val4)).normalized; ((Vector4)(ref item2))..ctor(val5.x, val5.y, val5.z, -1f); m_verts.Add(m_posBuf[j] - val5 * num9); m_uvs.Add(new Vector2(num12, num11)); m_cols.Add(val7); m_norms.Add(val8); m_tans.Add(item2); m_verts.Add(m_posBuf[j] + val5 * num9); m_uvs.Add(new Vector2(num13, num11)); m_cols.Add(val7); m_norms.Add(val8); m_tans.Add(item2); num5 = num9; item = val7; num6 = num11; val2 = val8; } int num14 = num - 1; if (flag) { Vector3 pos = m_parents[slot].Pos; Vector3 item3 = pos - camPos; item3 = ((!(((Vector3)(ref item3)).sqrMagnitude < 1E-12f)) ? (-((Vector3)(ref item3)).normalized) : val2); Vector4 item4 = default(Vector4); ((Vector4)(ref item4))..ctor(val.x, val.y, val.z, -1f); float num15 = ((!FlipU) ? 0f : 1f); float num16 = ((!FlipU) ? 1f : 0f); m_verts.Add(pos - val * num5); m_uvs.Add(new Vector2(num15, num6)); m_cols.Add(item); m_norms.Add(item3); m_tans.Add(item4); m_verts.Add(pos + val * num5); m_uvs.Add(new Vector2(num16, num6)); m_cols.Add(item); m_norms.Add(item3); m_tans.Add(item4); num14 = num; } for (int k = 0; k < num14; k++) { int num17 = count + k * 2; m_tris.Add(num17); m_tris.Add(num17 + 2); m_tris.Add(num17 + 1); m_tris.Add(num17 + 1); m_tris.Add(num17 + 2); m_tris.Add(num17 + 3); m_tris.Add(num17); m_tris.Add(num17 + 1); m_tris.Add(num17 + 2); m_tris.Add(num17 + 1); m_tris.Add(num17 + 3); m_tris.Add(num17 + 2); } } private float EvaluateParentAlpha(float parentAge01) { if (ParentOpacityOverLife == null || ParentOpacityOverLife.length == 0) { return 1f; } return Mathf.Clamp01(ParentOpacityOverLife.Evaluate(Mathf.Clamp01(parentAge01))); } private static Vector3 ToWorldPoint(ParticleSystem ps, Vector3 p) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0021: 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_0015: 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_002d: Unknown result type (might be due to invalid IL or missing references) MainModule main = ps.main; return ((int)((MainModule)(ref main)).simulationSpace != 1) ? ((Component)ps).transform.TransformPoint(p) : p; } private static Vector3 ToWorldVector(ParticleSystem ps, Vector3 v) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0021: 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_0015: 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_002d: Unknown result type (might be due to invalid IL or missing references) MainModule main = ps.main; return ((int)((MainModule)(ref main)).simulationSpace != 1) ? ((Component)ps).transform.TransformVector(v) : v; } private static Camera ResolveViewerCamera() { if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled) { return s_viewerCamera; } s_viewerCamera = Camera.main; if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled) { return s_viewerCamera; } s_viewerCamera = Camera.current; if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled) { return s_viewerCamera; } Camera[] allCameras = Camera.allCameras; s_viewerCamera = ((allCameras == null || allCameras.Length <= 0) ? null : allCameras[0]); return s_viewerCamera; } } 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(); } } } namespace BitWizrd.Revolver { public class CylinderSlideEjector { private class EjectingRound { public FVRFireArmRound Prefab; public bool Spent; public Transform Proxy; public Vector3 StartLocal; public Vector3 DirLocal; public float Distance; public float Travelled; public FVRFireArmChamber Chamber; public bool Gravity; public float Speed; public Transform GunRoot; } private class Ghost { public Rigidbody Body; public Collider[] RoundCols; public Collider[] GunCols; public float Until; } public float Clearance = 0.003f; private const float MaxStroke = 0.15f; private const float GhostTime = 0.4f; private const float GhostDepenSpeed = 1f; private const float SlideTime = 0.1f; public float ReleaseSpeed = 1f; private readonly List m_ejecting = new List(); private readonly List m_ghosts = new List(); public bool Eject(SingleActionRevolverCylinder cylinder, FVRFireArmChamber chamber) { return (Object)(object)cylinder != (Object)null && Begin(((Component)cylinder).transform, cylinder.Chambers, chamber, gravity: false, forward: false); } public bool Eject(Transform cylinderRoot, FVRFireArmChamber[] chambers, FVRFireArmChamber chamber, bool forward) { return Begin(cylinderRoot, chambers, chamber, gravity: false, forward); } public bool TryGravityEject(SingleActionRevolverCylinder cylinder, FVRFireArmChamber chamber, float minTiltDegrees) { if ((Object)(object)cylinder == (Object)null) { return false; } return TryGravityEject(((Component)cylinder).transform, cylinder.Chambers, chamber, minTiltDegrees, forward: false); } public bool TryGravityEject(Transform cylinderRoot, FVRFireArmChamber[] chambers, FVRFireArmChamber chamber, float minTiltDegrees, bool forward) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_006b: 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_006d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cylinderRoot == (Object)null || (Object)(object)chamber == (Object)null || !chamber.IsFull || !chamber.IsSpent) { return false; } Vector3 gravity = Physics.gravity; Vector3 normalized = ((Vector3)(ref gravity)).normalized; Vector3 val = ((!forward) ? (-((Component)chamber).transform.forward) : ((Component)chamber).transform.forward); float num = Vector3.Dot(val, normalized); if (num < Mathf.Sin(Mathf.Clamp(minTiltDegrees, 1f, 89f) * ((float)Math.PI / 180f))) { return false; } return Begin(cylinderRoot, chambers, chamber, gravity: true, forward); } private bool Begin(Transform cylinder, FVRFireArmChamber[] chambers, FVRFireArmChamber chamber, bool gravity, bool forward) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cylinder == (Object)null || (Object)(object)chamber == (Object)null || !chamber.IsFull) { return false; } FVRFireArmRound round = chamber.GetRound(); if ((Object)(object)round == (Object)null) { return false; } Transform transform = ((Component)chamber).transform; Vector3 val = ((!forward) ? (-transform.forward) : transform.forward); EjectingRound ejectingRound = new EjectingRound(); ejectingRound.Prefab = round; ejectingRound.Spent = chamber.IsSpent; ejectingRound.StartLocal = cylinder.InverseTransformPoint(transform.position); ejectingRound.DirLocal = cylinder.InverseTransformVector(val); ejectingRound.Travelled = 0f; ejectingRound.Chamber = chamber; FVRPhysicalObject componentInParent = ((Component)cylinder).GetComponentInParent(); ejectingRound.GunRoot = ((!((Object)(object)componentInParent != (Object)null)) ? cylinder.root : ((Component)componentInParent).transform); ejectingRound.Gravity = gravity; ejectingRound.Speed = 0f; Mesh val2 = ((!((Object)(object)chamber.ProxyMesh != (Object)null)) ? null : chamber.ProxyMesh.sharedMesh); Material val3 = ((!((Object)(object)chamber.ProxyRenderer != (Object)null)) ? null : ((Renderer)chamber.ProxyRenderer).sharedMaterial); Vector3 worldScale = ((!((Object)(object)chamber.ProxyRound != (Object)null)) ? Vector3.one : chamber.ProxyRound.lossyScale); if ((Object)(object)val2 == (Object)null) { MeshFilter val4 = null; if ((Object)(object)round.FiredRenderer != (Object)null) { val4 = ((Component)round.FiredRenderer).GetComponent(); } if ((Object)(object)val4 == (Object)null || (Object)(object)val4.sharedMesh == (Object)null) { val4 = ((Component)round).GetComponentInChildren(); } if ((Object)(object)val4 != (Object)null && (Object)(object)val4.sharedMesh != (Object)null) { val2 = val4.sharedMesh; MeshRenderer component = ((Component)val4).GetComponent(); val3 = ((!((Object)(object)component != (Object)null)) ? val3 : ((Renderer)component).sharedMaterial); } else { Debug.LogWarning((object)("CylinderSlideEjector: no mesh found for '" + ((Object)round).name + "' in chamber '" + ((Object)chamber).name + "'; it will drop without a slide."), (Object)(object)chamber); } } ejectingRound.Distance = MeasureClearDistance(cylinder, chambers, transform, val2, worldScale, val) + Clearance; if (ejectingRound.Distance > 0.15f) { Debug.LogWarning((object)("CylinderSlideEjector: measured stroke " + ejectingRound.Distance + " m on '" + ((Object)cylinder).name + "' exceeds " + 0.15f + " m; clamping. Check meshes/scale under the Cylinder."), (Object)(object)cylinder); ejectingRound.Distance = 0.15f; } if ((Object)(object)val2 != (Object)null) { ejectingRound.Proxy = CreateProxy(cylinder, transform, val2, val3, worldScale); } chamber.SetRound((FVRFireArmRound)null, false); if ((Object)(object)ejectingRound.Proxy == (Object)null) { ReleaseRound(ejectingRound, transform.position + val * ejectingRound.Distance, transform.rotation, val, (!gravity) ? ReleaseSpeed : 0f); return true; } ApplyProxyPose(ejectingRound); m_ejecting.Add(ejectingRound); return true; } public void Tick() { //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_00e9: 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_00fb: 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_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) for (int num = m_ghosts.Count - 1; num >= 0; num--) { if ((Object)(object)m_ghosts[num].Body == (Object)null) { m_ghosts.RemoveAt(num); } else if (Time.time >= m_ghosts[num].Until) { SetGhostIgnore(m_ghosts[num], ignore: false); m_ghosts.RemoveAt(num); } } for (int num2 = m_ejecting.Count - 1; num2 >= 0; num2--) { EjectingRound ejectingRound = m_ejecting[num2]; if ((Object)(object)ejectingRound.Proxy == (Object)null) { m_ejecting.RemoveAt(num2); continue; } Vector3 val = ejectingRound.Proxy.parent.TransformVector(ejectingRound.DirLocal); Vector3 normalized = ((Vector3)(ref val)).normalized; if (ejectingRound.Gravity) { float num3 = Vector3.Dot(normalized, Physics.gravity); ejectingRound.Speed = Mathf.Max(0f, ejectingRound.Speed + num3 * Time.deltaTime); ejectingRound.Travelled = Mathf.Min(ejectingRound.Distance, ejectingRound.Travelled + ejectingRound.Speed * Time.deltaTime); if (ejectingRound.Speed <= 0f && num3 <= 0f) { PutBack(ejectingRound); m_ejecting.RemoveAt(num2); continue; } } else { float num4 = ejectingRound.Distance / 0.1f * Time.deltaTime; ejectingRound.Travelled = Mathf.MoveTowards(ejectingRound.Travelled, ejectingRound.Distance, num4); } ApplyProxyPose(ejectingRound); if (ejectingRound.Travelled >= ejectingRound.Distance) { ReleaseRound(ejectingRound, ejectingRound.Proxy.position, ejectingRound.Proxy.rotation, normalized, (!ejectingRound.Gravity) ? ReleaseSpeed : ejectingRound.Speed); m_ejecting.RemoveAt(num2); } } } public void Clear() { for (int i = 0; i < m_ejecting.Count; i++) { if ((Object)(object)m_ejecting[i].Proxy != (Object)null) { Object.Destroy((Object)(object)((Component)m_ejecting[i].Proxy).gameObject); } } m_ejecting.Clear(); for (int j = 0; j < m_ghosts.Count; j++) { SetGhostIgnore(m_ghosts[j], ignore: false); } m_ghosts.Clear(); } private static void SetGhostIgnore(Ghost gh, bool ignore) { for (int i = 0; i < gh.RoundCols.Length; i++) { if ((Object)(object)gh.RoundCols[i] == (Object)null) { continue; } for (int j = 0; j < gh.GunCols.Length; j++) { if ((Object)(object)gh.GunCols[j] != (Object)null && (Object)(object)gh.GunCols[j] != (Object)(object)gh.RoundCols[i]) { Physics.IgnoreCollision(gh.RoundCols[i], gh.GunCols[j], ignore); } } } } private static Transform CreateProxy(Transform cyl, Transform chamberT, Mesh mesh, Material mat, Vector3 worldScale) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("EjectingRoundProxy"); Transform transform = val.transform; transform.SetParent(cyl, false); val.AddComponent().sharedMesh = mesh; ((Renderer)val.AddComponent()).sharedMaterial = mat; transform.rotation = chamberT.rotation; Vector3 lossyScale = cyl.lossyScale; transform.localScale = new Vector3((lossyScale.x == 0f) ? 1f : (worldScale.x / lossyScale.x), (lossyScale.y == 0f) ? 1f : (worldScale.y / lossyScale.y), (lossyScale.z == 0f) ? 1f : (worldScale.z / lossyScale.z)); return transform; } private static void ApplyProxyPose(EjectingRound er) { //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) er.Proxy.localPosition = er.StartLocal + er.DirLocal * er.Travelled; } private void PutBack(EjectingRound er) { //IL_0022: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) Vector3 pos = ((!((Object)(object)er.Proxy != (Object)null)) ? Vector3.zero : er.Proxy.position); Quaternion rot = ((!((Object)(object)er.Proxy != (Object)null)) ? Quaternion.identity : er.Proxy.rotation); Vector3 val2; if ((Object)(object)er.Proxy != (Object)null) { Vector3 val = er.Proxy.parent.TransformVector(er.DirLocal); val2 = ((Vector3)(ref val)).normalized; } else { val2 = Vector3.down; } Vector3 worldDir = val2; if ((Object)(object)er.Chamber != (Object)null && !er.Chamber.IsFull && (Object)(object)er.Prefab != (Object)null) { if ((Object)(object)er.Proxy != (Object)null) { Object.Destroy((Object)(object)((Component)er.Proxy).gameObject); } er.Chamber.SetRound(er.Prefab, false); er.Chamber.IsSpent = er.Spent; er.Chamber.UpdateProxyDisplay(); } else { ReleaseRound(er, pos, rot, worldDir, 0f); } } public void GhostFromGun(FVRFireArmRound round, Transform gunRoot) { if (!((Object)(object)round == (Object)null) && !((Object)(object)((FVRPhysicalObject)round).RootRigidbody == (Object)null)) { ((FVRPhysicalObject)round).RootRigidbody.maxDepenetrationVelocity = 1f; if (!((Object)(object)gunRoot == (Object)null)) { Ghost ghost = new Ghost(); ghost.Body = ((FVRPhysicalObject)round).RootRigidbody; ghost.RoundCols = ((Component)round).GetComponentsInChildren(true); ghost.GunCols = ((Component)gunRoot).GetComponentsInChildren(true); ghost.Until = Time.time + 0.4f; SetGhostIgnore(ghost, ignore: true); m_ghosts.Add(ghost); } } } private void ReleaseRound(EjectingRound er, Vector3 pos, Quaternion rot, Vector3 worldDir, float speed) { //IL_0048: 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_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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)er.Proxy != (Object)null) { Object.Destroy((Object)(object)((Component)er.Proxy).gameObject); } if ((Object)(object)er.Prefab == (Object)null || er.Prefab.IsCaseless) { return; } Vector3 val = worldDir * speed; val = Vector3.Lerp(val * 0.7f, val, Random.value) + GM.CurrentMovementManager.GetFilteredVel(); GameObject val2 = Object.Instantiate(((Component)er.Prefab).gameObject, pos + worldDir * speed * Time.deltaTime, rot); FVRFireArmRound component = val2.GetComponent(); if (!((Object)(object)component == (Object)null)) { ((FVRPhysicalObject)component).SetIFF(GM.CurrentPlayerBody.GetPlayerIFF()); ((FVRPhysicalObject)component).RootRigidbody.velocity = val; ((FVRPhysicalObject)component).RootRigidbody.maxAngularVelocity = 200f; ((FVRPhysicalObject)component).RootRigidbody.angularVelocity = Vector3.zero; GhostFromGun(component, er.GunRoot); if (er.Spent) { component.SetKillCounting(true); component.Fire(); } } } private static float MeasureClearDistance(Transform cylinder, FVRFireArmChamber[] chambers, Transform ct, Mesh roundMesh, Vector3 worldScale, Vector3 dir) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_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_002d: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ct.position; float min = 0f; float num = 0f; if ((Object)(object)roundMesh != (Object)null) { Matrix4x4 m = Matrix4x4.TRS(ct.position, ct.rotation, worldScale); min = float.MaxValue; num = float.MinValue; ProjectBounds(roundMesh.bounds, m, position, dir, ref min, ref num); } float min2 = float.MaxValue; float max = float.MinValue; bool flag = false; MeshFilter[] componentsInChildren = ((Component)cylinder).GetComponentsInChildren(false); for (int i = 0; i < componentsInChildren.Length; i++) { if (!((Object)(object)componentsInChildren[i].sharedMesh == (Object)null) && IsVisible(((Component)componentsInChildren[i]).GetComponent()) && !IsUnderChamber(chambers, ((Component)componentsInChildren[i]).transform)) { ProjectBounds(componentsInChildren[i].sharedMesh.bounds, ((Component)componentsInChildren[i]).transform.localToWorldMatrix, position, dir, ref min2, ref max); flag = true; } } SkinnedMeshRenderer[] componentsInChildren2 = ((Component)cylinder).GetComponentsInChildren(false); for (int j = 0; j < componentsInChildren2.Length; j++) { if (!((Object)(object)componentsInChildren2[j].sharedMesh == (Object)null) && ((Renderer)componentsInChildren2[j]).enabled && !IsUnderChamber(chambers, ((Component)componentsInChildren2[j]).transform)) { ProjectBounds(componentsInChildren2[j].sharedMesh.bounds, ((Component)componentsInChildren2[j]).transform.localToWorldMatrix, position, dir, ref min2, ref max); flag = true; } } if (MeasureBoneVertices(cylinder, chambers, position, dir, ref min2, ref max)) { flag = true; } if (!flag) { max = 0f; } return Mathf.Max(0f, max - min); } private static bool MeasureBoneVertices(Transform cylinder, FVRFireArmChamber[] chambers, Vector3 origin, Vector3 dir, ref float min, ref float max) { //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_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) Transform val = cylinder.root; FVRPhysicalObject componentInParent = ((Component)cylinder).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { val = ((Component)componentInParent).transform; } bool result = false; SkinnedMeshRenderer[] componentsInChildren = ((Component)val).GetComponentsInChildren(false); foreach (SkinnedMeshRenderer val2 in componentsInChildren) { Mesh sharedMesh = val2.sharedMesh; if ((Object)(object)sharedMesh == (Object)null || !((Renderer)val2).enabled) { continue; } Transform[] bones = val2.bones; bool[] array = new bool[bones.Length]; bool flag = false; for (int j = 0; j < bones.Length; j++) { if ((Object)(object)bones[j] != (Object)null && bones[j].IsChildOf(cylinder) && !IsUnderChamber(chambers, bones[j])) { array[j] = true; flag = true; } } if (!flag) { continue; } Vector3[] vertices = sharedMesh.vertices; BoneWeight[] boneWeights = sharedMesh.boneWeights; Matrix4x4[] bindposes = sharedMesh.bindposes; if (vertices.Length == 0 || boneWeights.Length != vertices.Length) { continue; } for (int k = 0; k < vertices.Length; k++) { BoneWeight val3 = boneWeights[k]; int num = ((BoneWeight)(ref val3)).boneIndex0; float num2 = ((BoneWeight)(ref val3)).weight0; if (((BoneWeight)(ref val3)).weight1 > num2) { num2 = ((BoneWeight)(ref val3)).weight1; num = ((BoneWeight)(ref val3)).boneIndex1; } if (((BoneWeight)(ref val3)).weight2 > num2) { num2 = ((BoneWeight)(ref val3)).weight2; num = ((BoneWeight)(ref val3)).boneIndex2; } if (((BoneWeight)(ref val3)).weight3 > num2) { num2 = ((BoneWeight)(ref val3)).weight3; num = ((BoneWeight)(ref val3)).boneIndex3; } if (num >= 0 && num < bones.Length && array[num]) { Matrix4x4 val4 = bones[num].localToWorldMatrix * bindposes[num]; Vector3 val5 = ((Matrix4x4)(ref val4)).MultiplyPoint3x4(vertices[k]); float num3 = Vector3.Dot(val5 - origin, dir); if (num3 < min) { min = num3; } if (num3 > max) { max = num3; } result = true; } } } return result; } private static bool IsVisible(Renderer r) { return (Object)(object)r != (Object)null && r.enabled; } private static bool IsUnderChamber(FVRFireArmChamber[] chambers, Transform t) { for (int i = 0; i < chambers.Length; i++) { if ((Object)(object)chambers[i] != (Object)null && t.IsChildOf(((Component)chambers[i]).transform)) { return true; } } return false; } private static void ProjectBounds(Bounds b, Matrix4x4 m, Vector3 origin, Vector3 dir, ref float min, ref float max) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) Vector3 center = ((Bounds)(ref b)).center; Vector3 extents = ((Bounds)(ref b)).extents; Vector3 val = default(Vector3); for (int i = 0; i < 8; i++) { ((Vector3)(ref val))..ctor(center.x + (((i & 1) != 0) ? extents.x : (0f - extents.x)), center.y + (((i & 2) != 0) ? extents.y : (0f - extents.y)), center.z + (((i & 4) != 0) ? extents.z : (0f - extents.z))); float num = Vector3.Dot(((Matrix4x4)(ref m)).MultiplyPoint3x4(val) - origin, dir); if (num < min) { min = num; } if (num > max) { max = num; } } } } } public class DecalLayFlat : MonoBehaviour { private void Awake() { Flatten(); } private void OnEnable() { if (Application.isPlaying) { Flatten(); } } private void Flatten() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Quaternion rotation = ((Component)this).transform.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; ((Component)this).transform.rotation = Quaternion.Euler(90f, y, 0f); } } namespace BitWizrd.Revolver.DoubleAction { public class DoubleActionEjectorRod : FVRInteractiveObject { public DoubleActionLoadingGateRevolver revolver; } public class DoubleActionLoadingGateEjectorRod : FVRInteractiveObject { public DoubleActionLoadingGateRevolver Revolver; public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); Revolver.EjectPrevCylinder(); } } public class DoubleActionLoadingGateRevolver : FVRFireArm { public enum RotAxis { X, Y, Z } public enum CylinderRotAxis { Authored, X, Y, Z } [Header("Single Action Revolver")] public bool AllowsSuppressor; public Transform Hammer; public Transform LoadingGate; public Transform Trigger; public Transform EjectorRod; public SingleActionRevolverCylinder Cylinder; public CylinderRotAxis CylinderAxis = CylinderRotAxis.Authored; public bool InvertCylinderSpin; public bool InvertCylinderTranslate; public bool TranslateFromRealTrigger; public bool CylinderTranslateRelative; private Vector3 m_cylinderRestPos; public bool InvertHammerRot; public bool InvertLoadingGateRot; public bool InvertTriggerRot; public bool InvertSpinRot; public Transform HammerFanDir; private int m_curChamber; private float m_curChamberLerp; private float m_tarChamberLerp; [Header("Component Movement Params")] public float Hammer_Rot_Uncocked; public float Hammer_Rot_Halfcocked; public float Hammer_Rot_Cocked; public float LoadingGate_Rot_Closed; public float LoadingGate_Rot_Open; public float Trigger_Rot_Forward; public float Trigger_Rot_Rearward; public Vector3 EjectorRod_Pos_Forward; public Vector3 EjectorRod_Pos_Rearward; public bool DoesCylinderTranslateForward; public bool IsAccessTwoChambersBack; public Vector3 CylinderBackPos; public Vector3 CylinderFrontPos; public RotAxis HammerAxis = RotAxis.X; public RotAxis LoadingGateAxis = RotAxis.Z; public RotAxis TriggerAxis = RotAxis.X; [Header("Spinning Config")] public Transform PoseSpinHolder; public bool CanSpin = true; public bool CanFan = true; public RotAxis SpinAxis = RotAxis.X; private bool m_isSpinning; [Header("StateToggling")] public bool StateToggles = true; private bool m_isStateToggled; public Transform Pose_Main; public Transform Pose_Toggled; public float TriggerThreshold = 0.9f; public float TriggerResetThreshold = 0.3f; private float m_hammerTranslate; private float m_firedTriggerPeak; private float m_translateLerp; private float m_camFloor; private readonly List m_hoveredRounds = new List(); private float m_triggerFloat; private float xSpinRot; private float xSpinVel; private float timeSinceColFire; [Header("DoubleAction Config")] private float m_tarTriggerFloat; private float m_tarRealTriggerFloat; private float m_triggerCurrentRot; private float m_curTriggerFloat; private float m_curRealTriggerFloat; private float lastTriggerRot; private RecockingState m_recockingState; private float m_recockingLerp; private bool m_shouldRecock; [SerializeField] private bool DoesFiringRecock = false; private bool m_hasTriggerCycled; public bool CanManuallyCockHammer; private bool m_isHammerLocked; private float m_hammerCurrentRot; private Vector2 RecockingSpeeds = new Vector2(8f, 3f); public Transform RecockingPiece; public Transform RecockingPoint_Forward; public Transform RecockingPoint_Rearward; public float ejectedRoundOffset; [Tooltip("Extra distance (m) past the cylinder's rear face before an ejected round is released. The round slides out of its chamber first (see CylinderSlideEjector).")] public float EjectClearance = 0.003f; [Tooltip("With the loading gate open, a spent case in the accessible chamber slides out and drops under gravity when the gun is tilted rear-down.")] public bool GravityEject = true; [Tooltip("How far (degrees) the chamber's rear must point below horizontal before a spent case slides out.")] public float GravityEjectMinTilt = 30f; private readonly CylinderSlideEjector m_slide = new CylinderSlideEjector(); public bool doesToggleStateHalfRotatesCylinder; public int CurChamber { get { return m_curChamber; } set { m_curChamber = value % Cylinder.NumChambers; } } public int NextChamber => (m_curChamber + 1) % Cylinder.NumChambers; public int PrevChamber { get { int num = m_curChamber - 1; return (num >= 0) ? num : (Cylinder.NumChambers - 1); } } public int PrevChamber2 { get { int num = m_curChamber - 2; return (num >= 0) ? num : (Cylinder.NumChambers + num); } } private static Vector3 AxisVector(RotAxis axis, float angle) { //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_0056: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) return (Vector3)(axis switch { RotAxis.Y => new Vector3(0f, angle, 0f), RotAxis.Z => new Vector3(0f, 0f, angle), _ => new Vector3(angle, 0f, 0f), }); } private static float AxisValue(Vector3 euler, RotAxis axis) { return axis switch { RotAxis.Y => euler.y, RotAxis.Z => euler.z, _ => euler.x, }; } private Quaternion GetCylinderRotation(int chamberIndex) { //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_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_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_008a: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) Quaternion localRotationFromCylinder = Cylinder.GetLocalRotationFromCylinder(chamberIndex); if (CylinderAxis == CylinderRotAxis.Authored) { return localRotationFromCylinder; } float num = 2f * Mathf.Atan2(localRotationFromCylinder.z, localRotationFromCylinder.w) * 57.29578f; if (InvertCylinderSpin) { num = 0f - num; } Vector3 val = Vector3.forward; if (CylinderAxis == CylinderRotAxis.X) { val = Vector3.right; } else if (CylinderAxis == CylinderRotAxis.Y) { val = Vector3.up; } return Quaternion.AngleAxis(num, val); } public override void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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(); m_cylinderRestPos = ((Component)Cylinder).transform.localPosition; FVRFireArmChamber[] chambers = Cylinder.Chambers; foreach (FVRFireArmChamber item in chambers) { base.FChambers.Add(item); } if ((Object)(object)((FVRInteractiveObject)this).PoseOverride_Touch != (Object)null) { Pose_Main.localPosition = ((FVRInteractiveObject)this).PoseOverride_Touch.localPosition; Pose_Main.localRotation = ((FVRInteractiveObject)this).PoseOverride_Touch.localRotation; } } public override void BeginInteraction(FVRViveHand hand) { //IL_00a2: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_006e: 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).BeginInteraction(hand); if (((FVRPhysicalObject)this).IsAltHeld) { return; } if (!m_isStateToggled) { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Main.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Main.localRotation; } } else { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Toggled.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Toggled.localRotation; } } } public override void UpdateInteraction(FVRViveHand hand) { //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); m_isSpinning = false; if (!((FVRPhysicalObject)this).IsAltHeld) { if (!m_isStateToggled) { if (hand.Input.TouchpadPressed && !hand.IsInStreamlinedMode && (double)Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) < 45.0) { m_isSpinning = true; } if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonDown && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); } } else if (hand.Input.TouchpadDown && (double)Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45.0 && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); } } else { if (hand.IsInStreamlinedMode) { if (hand.Input.AXButtonDown) { AdvanceCylinder(); } if (hand.Input.BYButtonDown && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f); } } else if (hand.Input.TouchpadDown) { if ((double)Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45.0 && StateToggles) { ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f); } else if ((double)Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45.0) { AdvanceCylinder(); } } if (hand.Input.TriggerDown) { EjectPrevCylinder(); } } } UpdateTriggerHammer(); UpdateCylinderRot(); if (!((FVRInteractiveObject)this).IsHeld || ((FVRPhysicalObject)this).IsAltHeld || (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null) { m_isSpinning = false; } } public override void EndInteraction(FVRViveHand hand) { //IL_00df: 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) m_triggerFloat = 0f; m_hasTriggerCycled = false; m_curTriggerFloat = 0f; m_curRealTriggerFloat = 0f; m_firedTriggerPeak = 0f; m_triggerCurrentRot = Trigger_Rot_Forward; lastTriggerRot = m_triggerCurrentRot; if ((Object)(object)Trigger != (Object)null) { Trigger.localEulerAngles = AxisVector(TriggerAxis, (!InvertTriggerRot) ? m_triggerCurrentRot : (0f - m_triggerCurrentRot)); } m_hammerTranslate = ((!m_isHammerLocked) ? 0f : 1f); m_camFloor = 0f; UpdateCylinderTranslate(snap: true); ((FVRFireArm)this).EndInteraction(hand); ((FVRPhysicalObject)this).RootRigidbody.AddRelativeTorque(new Vector3(xSpinVel, 0f, 0f), (ForceMode)1); } public override void FVRUpdate() { ((FVRFireArm)this).FVRUpdate(); m_slide.Tick(); if (GravityEject && m_isStateToggled && (Object)(object)Cylinder != (Object)null) { int num = ((!IsAccessTwoChambersBack) ? PrevChamber : PrevChamber2); m_slide.Clearance = EjectClearance; if (m_slide.TryGravityEject(Cylinder, Cylinder.Chambers[num], GravityEjectMinTilt)) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); } } UpdateRecocking(); } public override void FVRFixedUpdate() { UpdateSpinning(); if ((double)timeSinceColFire < 3.0) { timeSinceColFire += Time.deltaTime; } ((FVRFireArm)this).FVRFixedUpdate(); UpdateHoveredRounds(); } private void UpdateHoveredRounds() { //IL_008f: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) FVRFireArmChamber val = null; if (m_isStateToggled) { for (int i = 0; i < Cylinder.Chambers.Length; i++) { if (Cylinder.Chambers[i].IsAccessible) { val = Cylinder.Chambers[i]; break; } } } Collider val2 = ((!((Object)(object)val != (Object)null) || val.IsFull) ? null : ((Component)val).GetComponent()); List list = null; if ((Object)(object)val2 != (Object)null) { Bounds bounds = val2.bounds; Collider[] array = Physics.OverlapBox(((Bounds)(ref bounds)).center, ((Bounds)(ref bounds)).extents, Quaternion.identity, -1, (QueryTriggerInteraction)2); for (int j = 0; j < array.Length; j++) { FVRFireArmRound componentInParent = ((Component)array[j]).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && !componentInParent.IsSpent && componentInParent.isManuallyChamberable && componentInParent.RoundType == val.RoundType && !((Object)(object)componentInParent.m_hoverOverReloadTrigger != (Object)null)) { if (list == null) { list = new List(); } if (!list.Contains(componentInParent)) { list.Add(componentInParent); } } } } for (int num = m_hoveredRounds.Count - 1; num >= 0; num--) { FVRFireArmRound val3 = m_hoveredRounds[num]; if ((Object)(object)val3 == (Object)null) { m_hoveredRounds.RemoveAt(num); } else if (list == null || !list.Contains(val3)) { if ((Object)(object)val3.HoveredOverChamber != (Object)null && IsOurChamber(val3.HoveredOverChamber)) { val3.HoveredOverChamber = null; } m_hoveredRounds.RemoveAt(num); } } if (list == null) { return; } for (int k = 0; k < list.Count; k++) { FVRFireArmRound val4 = list[k]; if ((Object)(object)val4.HoveredOverChamber == (Object)null) { val4.HoveredOverChamber = val; if (!m_hoveredRounds.Contains(val4)) { m_hoveredRounds.Add(val4); } } } } private bool IsOurChamber(FVRFireArmChamber chamber) { for (int i = 0; i < Cylinder.Chambers.Length; i++) { if ((Object)(object)Cylinder.Chambers[i] == (Object)(object)chamber) { return true; } } return false; } private void UpdateRecocking() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0085: 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_009b: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) RecockingState recockingState = m_recockingState; if ((int)recockingState != 1) { if ((int)recockingState == 2) { m_recockingLerp -= Time.deltaTime * RecockingSpeeds.y; if ((double)m_recockingLerp <= 0.0) { m_recockingState = (RecockingState)0; } m_recockingLerp = Mathf.Clamp(m_recockingLerp, 0f, 1f); RecockingPiece.position = Vector3.Lerp(RecockingPoint_Forward.position, RecockingPoint_Rearward.position, m_recockingLerp); } } else { m_recockingLerp += Time.deltaTime * RecockingSpeeds.x; if ((double)m_recockingLerp >= 1.0) { m_recockingState = (RecockingState)2; m_isHammerLocked = true; } m_recockingLerp = Mathf.Clamp(m_recockingLerp, 0f, 1f); RecockingPiece.position = Vector3.Lerp(RecockingPoint_Forward.position, RecockingPoint_Rearward.position, m_recockingLerp); } } private void InitiateRecock() { //IL_0002: 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) if ((int)m_recockingState == 0) { m_recockingLerp = 0f; m_recockingState = (RecockingState)1; } } private void UpdateCylinderTranslate() { UpdateCylinderTranslate(snap: false); } private void UpdateCylinderTranslate(bool snap) { //IL_00e3: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) if (DoesCylinderTranslateForward) { m_hammerTranslate = Mathf.MoveTowards(m_hammerTranslate, (!m_isHammerLocked) ? 0f : 1f, Time.deltaTime * 14f); float num = ((!TranslateFromRealTrigger) ? m_curTriggerFloat : m_curRealTriggerFloat); if (m_hasTriggerCycled) { num = m_curRealTriggerFloat / Mathf.Max(m_firedTriggerPeak, 0.01f); } num = Mathf.Max(num, m_hammerTranslate); m_translateLerp = ((!snap) ? Mathf.MoveTowards(m_translateLerp, num, Time.deltaTime * 20f) : num); float num2 = ((!InvertCylinderTranslate) ? m_translateLerp : (1f - m_translateLerp)); Vector3 val = Vector3.Lerp(CylinderBackPos, CylinderFrontPos, num2); if (CylinderTranslateRelative) { val += m_cylinderRestPos; } ((Component)Cylinder).transform.localPosition = val; } } private void UpdateTriggerHammer() { //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) //IL_006a: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Invalid comparison between Unknown and I4 //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Invalid comparison between Unknown and I4 //IL_05ee: 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_043d: Unknown result type (might be due to invalid IL or missing references) if (CanFan && ((FVRInteractiveObject)this).IsHeld && !m_isStateToggled && !m_isHammerLocked && (Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand != (Object)null) { Vector3 velLinearWorld = ((FVRInteractiveObject)this).m_hand.OtherHand.Input.VelLinearWorld; if (Vector3.Distance(((FVRInteractiveObject)this).m_hand.OtherHand.PalmTransform.position, HammerFanDir.position) < 0.15f && Vector3.Angle(velLinearWorld, HammerFanDir.forward) < 60f && ((Vector3)(ref velLinearWorld)).magnitude > 1f) { CockHammer(10f); } } if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !m_isSpinning && !m_isStateToggled && !((FVRPhysicalObject)this).IsAltHeld) { m_tarTriggerFloat = ((FVRInteractiveObject)this).m_hand.Input.TriggerFloat; m_tarRealTriggerFloat = ((FVRInteractiveObject)this).m_hand.Input.TriggerFloat; } else { m_tarTriggerFloat = 0f; m_tarRealTriggerFloat = 0f; } if (m_isHammerLocked) { m_tarTriggerFloat += 0.8f; m_triggerCurrentRot = Mathf.Lerp(Trigger_Rot_Forward, Trigger_Rot_Rearward, m_curTriggerFloat); } else { m_triggerCurrentRot = Mathf.Lerp(Trigger_Rot_Forward, Trigger_Rot_Rearward, m_curTriggerFloat); } m_curTriggerFloat = Mathf.MoveTowards(m_curTriggerFloat, m_tarTriggerFloat, Time.deltaTime * 14f); m_curRealTriggerFloat = Mathf.MoveTowards(m_curRealTriggerFloat, m_tarRealTriggerFloat, Time.deltaTime * 14f); if (m_hasTriggerCycled) { m_firedTriggerPeak = Mathf.Max(m_firedTriggerPeak, m_curRealTriggerFloat); } else { m_firedTriggerPeak = 0f; } if (m_hasTriggerCycled) { m_camFloor = 1f; } else { m_camFloor = Mathf.Min(m_camFloor, m_curTriggerFloat); } UpdateCylinderTranslate(); if (Mathf.Abs(m_triggerCurrentRot - lastTriggerRot) > 0.01f && (Object)(object)Trigger != (Object)null) { Trigger.localEulerAngles = AxisVector(TriggerAxis, (!InvertTriggerRot) ? m_triggerCurrentRot : (0f - m_triggerCurrentRot)); } lastTriggerRot = m_triggerCurrentRot; if (m_shouldRecock) { m_shouldRecock = false; InitiateRecock(); } if (!m_hasTriggerCycled) { if ((!DoesFiringRecock || (int)m_recockingState == 0) && m_curTriggerFloat >= 0.95f && !((FVRInteractiveObject)this).m_hand.Input.TouchpadPressed) { if (!m_isStateToggled) { m_hasTriggerCycled = true; m_isHammerLocked = false; CurChamber++; m_curChamberLerp = 0f; m_tarChamberLerp = 0f; Fire(); if (DoesFiringRecock) { m_shouldRecock = true; } } } else if (m_curTriggerFloat <= 0.14f && !m_isHammerLocked && CanManuallyCockHammer) { bool flag = DoesFiringRecock && (int)m_recockingState != 0; if (!((FVRPhysicalObject)this).IsAltHeld && !flag && !m_isStateToggled) { if (((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode) { if (((FVRInteractiveObject)this).m_hand.Input.AXButtonDown) { CockHammer(5f); } } else if (((FVRInteractiveObject)this).m_hand.Input.TouchpadDown && Vector2.Angle(((FVRInteractiveObject)this).m_hand.Input.TouchpadAxes, Vector2.down) < 45f) { CockHammer(5f); } } } } else if (m_hasTriggerCycled && m_curRealTriggerFloat <= Mathf.Min(TriggerResetThreshold, Mathf.Max(m_firedTriggerPeak - 0.1f, 0.05f))) { m_hasTriggerCycled = false; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)16, 1f); } if (m_isStateToggled) { m_hammerCurrentRot = Hammer_Rot_Halfcocked; } else { m_hammerCurrentRot = (m_hasTriggerCycled ? (m_isHammerLocked ? Mathf.Lerp(m_hammerCurrentRot, Hammer_Rot_Cocked, Time.deltaTime * 10f) : Hammer_Rot_Uncocked) : (m_isHammerLocked ? Mathf.Lerp(m_hammerCurrentRot, Hammer_Rot_Cocked, Time.deltaTime * 10f) : Mathf.Lerp(Hammer_Rot_Uncocked, Hammer_Rot_Cocked, GetCamTrigger()))); } if ((Object)(object)Hammer != (Object)null) { Hammer.localEulerAngles = AxisVector(HammerAxis, (!InvertHammerRot) ? m_hammerCurrentRot : (0f - m_hammerCurrentRot)); } if ((Object)(object)LoadingGate != (Object)null) { float num = ((!m_isStateToggled) ? LoadingGate_Rot_Closed : LoadingGate_Rot_Open); if (InvertLoadingGateRot) { num = 0f - num; } LoadingGate.localEulerAngles = AxisVector(LoadingGateAxis, num); } } private float GetCamTrigger() { return Mathf.Clamp01((m_curTriggerFloat - m_camFloor) / Mathf.Max(1f - m_camFloor, 0.05f)); } private void UpdateCylinderRelease() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (m_isHammerLocked) { m_tarChamberLerp = 1f; } else if (!m_hasTriggerCycled) { m_tarChamberLerp = GetCamTrigger() * 1.4f; } m_curChamberLerp = Mathf.Lerp(m_curChamberLerp, m_tarChamberLerp, Time.deltaTime * 16f); int chamberIndex = (CurChamber + 1) % Cylinder.NumChambers; ((Component)Cylinder).transform.localRotation = Quaternion.Slerp(GetCylinderRotation(CurChamber), GetCylinderRotation(chamberIndex), m_curChamberLerp); } private void AdvanceCylinder() { CurChamber++; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f); } public void EjectPrevCylinder() { if (m_isStateToggled) { int num = PrevChamber; if (IsAccessTwoChambersBack) { num = PrevChamber2; } FVRFireArmChamber chamber = Cylinder.Chambers[num]; m_slide.Clearance = EjectClearance; if (m_slide.Eject(Cylinder, chamber)) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); } } } public override void OnDestroy() { m_slide.Clear(); ((FVRPhysicalObject)this).OnDestroy(); } private void Fire() { //IL_009c: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); if (Cylinder.Chambers[CurChamber].Fire()) { FVRFireArmChamber val = Cylinder.Chambers[CurChamber]; ((FVRFireArm)this).Fire(val, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); FVRFireArmRound round = val.GetRound(); if (round.IsHighPressure) { ((FVRFireArm)this).Recoil(((FVRFireArm)this).IsTwoHandStabilized(), (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null, ((FVRFireArm)this).IsShoulderStabilized(), (FVRFireArmRecoilProfile)null, 1f); } ((FVRFireArm)this).PlayAudioGunShot(round, GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (round.IsCaseless) { val.SetRound((FVRFireArmRound)null, false); } else if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { val.IsSpent = false; val.UpdateProxyDisplay(); } } } private void UpdateCylinderRot() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) if (m_isStateToggled) { int num = PrevChamber; if (IsAccessTwoChambersBack) { num = PrevChamber2; } for (int i = 0; i < Cylinder.Chambers.Length; i++) { Cylinder.Chambers[i].IsAccessible = i == num; } int chamberIndex = (CurChamber + 1) % Cylinder.NumChambers; float num2 = (m_tarChamberLerp = (m_curChamberLerp = ((!doesToggleStateHalfRotatesCylinder) ? 0f : 0.5f))); ((Component)Cylinder).transform.localRotation = ((!(num2 > 0f)) ? GetCylinderRotation(CurChamber) : Quaternion.Slerp(GetCylinderRotation(CurChamber), GetCylinderRotation(chamberIndex), num2)); } else { for (int j = 0; j < Cylinder.Chambers.Length; j++) { Cylinder.Chambers[j].IsAccessible = false; } UpdateCylinderRelease(); } } private void UpdateSpinning() { //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0070: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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) 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.VelLinearLocal; } float num = Mathf.Clamp(Vector3.Dot(((Vector3)(ref val)).normalized, ((Component)this).transform.up), 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, -500f, 500f); xSpinRot += xSpinVel * Time.deltaTime * 5f; PoseSpinHolder.localEulerAngles = AxisVector(SpinAxis, (!InvertSpinRot) ? xSpinRot : (0f - xSpinRot)); xSpinVel = Mathf.Lerp(xSpinVel, 0f, Time.deltaTime * 0.6f); } else { xSpinRot = 0f; xSpinVel = 0f; PoseSpinHolder.localRotation = Quaternion.RotateTowards(PoseSpinHolder.localRotation, Quaternion.identity, Time.deltaTime * 500f); PoseSpinHolder.localEulerAngles = AxisVector(SpinAxis, AxisValue(PoseSpinHolder.localEulerAngles, SpinAxis)); } } private void CockHammer(float speed) { if (!m_isHammerLocked && !m_isStateToggled) { m_isHammerLocked = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); } } private void ToggleState() { //IL_00ad: 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_003b: 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_00eb: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) m_isHammerLocked = false; m_isStateToggled = !m_isStateToggled; if (((FVRPhysicalObject)this).IsAltHeld) { return; } if (!m_isStateToggled) { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Main.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Main.localRotation; } } else { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Toggled.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Toggled.localRotation; } } } public override List GetChamberRoundList() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) bool flag = false; List list = new List(); for (int i = 0; i < Cylinder.Chambers.Length; i++) { if (Cylinder.Chambers[i].IsFull) { list.Add(Cylinder.Chambers[i].GetRound().RoundClass); flag = true; } } return (!flag) ? null : list; } public override void SetLoadedChambers(List rounds) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (rounds.Count <= 0) { return; } for (int i = 0; i < Cylinder.Chambers.Length; i++) { if (i < rounds.Count) { Cylinder.Chambers[i].Autochamber(rounds[i]); } } } } } public class ExplosionLightFade : MonoBehaviour { public Light Light; public float BaseIntensity = 1f; public float Delay; public float Lifetime = 1f; public AnimationCurve IntensityOverLife; public float FlickerMin; public float FlickerMax; public float FlickerSpeed = 1f; private float startTime; private float noiseOffset; private void Awake() { if ((Object)(object)Light == (Object)null) { Light = ((Component)this).GetComponent(); } noiseOffset = Random.value * 1000f; } private void OnEnable() { startTime = Time.time; } private void Update() { if ((Object)(object)Light == (Object)null || Lifetime <= 0f) { return; } float num = (Time.time - startTime - Delay) / Lifetime; if (num < 0f) { Light.intensity = 0f; return; } if (num >= 1f) { ((Behaviour)Light).enabled = false; ((Behaviour)this).enabled = false; return; } float num2 = ((IntensityOverLife == null) ? 1f : Mathf.Max(0f, IntensityOverLife.Evaluate(num))); float num3 = 1f; if (FlickerMax > FlickerMin) { num3 = Mathf.Lerp(FlickerMin, FlickerMax, Mathf.PerlinNoise(Time.time * FlickerSpeed + noiseOffset, 0f)); } Light.intensity = BaseIntensity * num2 * num3; } } 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(); } 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(true); for (int i = 0; i < componentsInChildren.Length; i++) { Component val = (Component)(object)componentsInChildren[i]; ((Object)val.gameObject).name = str; } } } namespace BitWizrd.Revolver.Lemat { public class Lemat : BreakActionWeapon { public enum FireMode { Revolver, Shotgun } [Header("Shotgun Hinge Setup")] public HingeJoint hinge; public float hingeLimit = 45f; public float hingeEjectLimit = 30f; [Header("Lemat Mode (Default Revolver)")] public FireMode CurrentMode = FireMode.Revolver; [Header("Barrels & Chambers")] public Transform RevolverMuzzle; public Transform ShotgunMuzzle; public FVRFireArmChamber ShotgunChamber; [Header("Shotgun Ejection")] public float ShotgunEjectOffset = -0.06f; public float ShotgunEjectSpeed = -2.5f; [Header("Selector Pin")] public Transform FireSelectorPin; public Vector3 RevolverPinRotation = Vector3.zero; public Vector3 ShotgunPinRotation = new Vector3(90f, 0f, 0f); [Header("Revolver Cylinder")] public SingleActionRevolverCylinder Cylinder; [Tooltip("Extra distance (m) past the cylinder's rear face before an ejected revolver round is released. The round slides out of its chamber first (see CylinderSlideEjector).")] public float RevolverEjectClearance = 0.003f; [Tooltip("With the loading gate open, a spent case in the accessible chamber slides out and drops under gravity when the gun is tilted rear-down.")] public bool GravityEject = true; [Tooltip("How far (degrees) the chamber's rear must point below horizontal before a spent case slides out.")] public float GravityEjectMinTilt = 30f; private readonly CylinderSlideEjector m_slide = new CylinderSlideEjector(); [Header("Revolver Mechanics")] public Transform Hammer; public Transform LoadingGate; public Transform Trigger; [Tooltip("Trigger rotates on X-axis.")] public float Trigger_Rot_Forward = 0f; public float Trigger_Rot_Rearward = 25f; private bool hasTriggeredUpSinceBegin = false; [Tooltip("Rotate revolve gate around Z-axis.")] public float LoadingGate_Rot_Closed = 0f; public float LoadingGate_Rot_Open = 40f; [Tooltip("Revolver hammer angles (X-axis).")] public float Hammer_Rot_Uncocked_Revolver = 0f; public float Hammer_Rot_Cocked_Revolver = 30f; [Tooltip("Shotgun hammer angles (X-axis).")] public float Hammer_Rot_Uncocked_Shotgun = 0f; public float Hammer_Rot_Cocked_Shotgun = 30f; [Tooltip("Revolver hammer angle for half-cock (X-axis).")] public float Hammer_Rot_Halfcock_Revolver = 15f; [Tooltip("Trigger threshold to fire.")] public float TriggerThreshold = 0.9f; [Header("Cylinder Mechanics (Classic Single-Action)")] public bool DoesCylinderTranslateForward; public bool DoesHalfCockHalfRotCylinder; public bool HasTransferBarSafety; public bool IsAccessTwoChambersBack; public Vector3 CylinderBackPos; public Vector3 CylinderFrontPos; [Header("Optional Spin Feature (Revolver Only)")] public Transform PoseSpinHolder; public bool CanSpin = true; [Tooltip("Allows revolve gate toggling (half-cock).")] public bool StateToggles = true; [Header("Revolver Muzzle Effects")] public int RevolverMuzzleFireIndex = 0; public int RevolverMuzzleSmokeIndex = 1; public int RevolverGasOutIndex = 2; [Header("Shotgun Muzzle Effects")] public int ShotgunMuzzleFireIndex = 0; public int ShotgunMuzzleSmokeIndex = 1; public int ShotgunGasOutIndex = 2; [Header("Revolver Pose Toggling (like SingleActionRevolver)")] public Transform Pose_Main; public Transform Pose_Toggled; public bool StateTogglesPose = true; [Header("LematMk2-Style Audio / Recoil")] public FVRFireArmRecoilProfile ShotgunRecoilProfile; [Header("Fanning")] public bool CanFan = true; public Transform HammerFanDir; public float FanDistance = 0.15f; public float FanAngle = 60f; public float FanVelocityThreshold = 1f; [Header("Foregrip Reference")] public LematForegrip ForegripRef; [Header("Shotgun Ammo Type")] public FireArmRoundType ShotgunRoundType = (FireArmRoundType)21; private FireArmRoundType m_originalRoundType; private bool m_hasInitializedRoundTypes = false; private bool _inputsBlocked = false; private bool m_isGateOpen; public bool m_isShotgunOpen; public bool foregripLatch; private bool m_isHammerCocked; private bool m_isHammerCocking; private float m_hammerCockLerp; private float m_hammerCockSpeed = 10f; private float Hammer_Rot_Uncocked; private float Hammer_Rot_Cocked; private int m_curChamber; private float m_curChamberLerp; private float m_tarChamberLerp; private float timeSinceColFire = 999f; private bool m_isSpinning; private float xSpinRot; private float xSpinVel; private bool mWasShotgunChamberFull; private bool mToggleDebounce; private Vector3 m_TargetSelectorRotation; private float m_SelectorPinSpeed = 10f; private bool mLemat_HasUnlockedBreak; private bool mLemat_HasEjectedThisOpen; private Vector3 m_HingeStartPos; public bool m_IsLatchHeldOpen; public bool TriggerReset = true; private float prevTriggerFloat = 0f; private bool m_isStateToggled = false; private List m_allChambers = new List(); private bool m_isFilteringChambers = false; private FireArmRoundType? m_lastFilteredType = null; private FireArmRoundType m_savedRoundType; private GameObject m_hingeGO; private Transform m_hingeOriginalParent; private Rigidbody m_hingeRB; private LematForegrip m_lematForegrip; private bool m_weldInitialized; private Vector3 m_weldedLocalPos; private Quaternion m_weldedLocalRot; private bool m_needsPreciseSnap; private float m_cachedMass; private float m_cachedDrag; private float m_cachedAngularDrag; private bool m_cachedUseGravity; private RigidbodyInterpolation m_cachedInterpolation; private CollisionDetectionMode m_cachedCollisionDetection; private RigidbodyConstraints m_cachedConstraints; private Vector3 m_cachedAxis; private Vector3 m_cachedAnchor; private Vector3 m_cachedConnectedAnchor; private Rigidbody m_cachedConnectedBody; private JointLimits m_cachedLimits; private bool m_cachedUseSpring; private JointSpring m_cachedSpring; private bool m_cachedUseMotor; private JointMotor m_cachedMotor; public int CurChamber { get { return m_curChamber; } set { m_curChamber = value % Cylinder.NumChambers; } } public int PrevChamber { get { int num = m_curChamber - 1; return (num >= 0) ? num : (Cylinder.NumChambers - 1); } } public int PrevChamber2 { get { int num = m_curChamber - 2; return (num >= 0) ? num : (Cylinder.NumChambers + num); } } public override void Awake() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) if (!m_hasInitializedRoundTypes) { m_originalRoundType = ((FVRFireArm)this).RoundType; m_hasInitializedRoundTypes = true; } ((BreakActionWeapon)this).Awake(); ((BreakActionWeapon)this).SetHasLatchButton(false); ((FVRFireArm)this).FChambers = new List(); if ((Object)(object)Cylinder != (Object)null && Cylinder.Chambers != null) { FVRFireArmChamber[] chambers = Cylinder.Chambers; foreach (FVRFireArmChamber val in chambers) { if ((Object)(object)val != (Object)null) { val.Firearm = (FVRFireArm)(object)this; ((FVRFireArm)this).FChambers.Add(val); } } } if ((Object)(object)ShotgunChamber != (Object)null) { ShotgunChamber.Firearm = (FVRFireArm)(object)this; ShotgunChamber.RoundType = ShotgunRoundType; if (!((FVRFireArm)this).FChambers.Contains(ShotgunChamber)) { ((FVRFireArm)this).FChambers.Add(ShotgunChamber); } } m_allChambers.Clear(); m_allChambers.AddRange(((FVRFireArm)this).FChambers); CurrentMode = FireMode.Revolver; Hammer_Rot_Uncocked = Hammer_Rot_Uncocked_Revolver; Hammer_Rot_Cocked = Hammer_Rot_Cocked_Revolver; m_TargetSelectorRotation = RevolverPinRotation; if ((Object)(object)FireSelectorPin != (Object)null) { FireSelectorPin.localEulerAngles = RevolverPinRotation; } m_IsLatchHeldOpen = false; m_isShotgunOpen = false; mLemat_HasUnlockedBreak = false; mLemat_HasEjectedThisOpen = false; ((BreakActionWeapon)this).SetIsExternallyUnlatched(false); if ((Object)(object)hinge != (Object)null) { m_HingeStartPos = ((Component)hinge).transform.localPosition; m_hingeGO = ((Component)hinge).gameObject; m_hingeRB = m_hingeGO.GetComponent(); m_hingeOriginalParent = m_hingeGO.transform.parent; m_lematForegrip = m_hingeGO.GetComponentInChildren(true); if ((Object)(object)m_hingeRB != (Object)null) { m_cachedMass = m_hingeRB.mass; m_cachedDrag = m_hingeRB.drag; m_cachedAngularDrag = m_hingeRB.angularDrag; m_cachedUseGravity = m_hingeRB.useGravity; m_cachedInterpolation = m_hingeRB.interpolation; m_cachedCollisionDetection = m_hingeRB.collisionDetectionMode; m_cachedConstraints = m_hingeRB.constraints; } m_cachedAxis = ((Joint)hinge).axis; m_cachedAnchor = ((Joint)hinge).anchor; m_cachedConnectedAnchor = ((Joint)hinge).connectedAnchor; m_cachedConnectedBody = ((Joint)hinge).connectedBody; m_cachedLimits = hinge.limits; m_cachedUseSpring = hinge.useSpring; m_cachedSpring = hinge.spring; m_cachedUseMotor = hinge.useMotor; m_cachedMotor = hinge.motor; m_weldedLocalPos = ((Component)this).transform.InverseTransformPoint(m_hingeGO.transform.position); m_weldedLocalRot = Quaternion.Inverse(((Component)this).transform.rotation) * m_hingeGO.transform.rotation; } } public override void BeginInteraction(FVRViveHand hand) { ((FVRFireArm)this).BeginInteraction(hand); if ((Object)(object)hand != (Object)null && hand.Input.TriggerFloat <= 0.45f) { hasTriggeredUpSinceBegin = true; } else { hasTriggeredUpSinceBegin = false; } } public override Transform GetMuzzle() { return (CurrentMode != FireMode.Revolver) ? ShotgunMuzzle : RevolverMuzzle; } private void FireMuzzleFire(int index) { ((FVRFireArm)this).FireMuzzleSmoke(index); } public void Fire() { if ((CurrentMode == FireMode.Revolver && m_isGateOpen) || (CurrentMode == FireMode.Shotgun && m_isShotgunOpen)) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); } else if (CurrentMode == FireMode.Revolver) { if ((Object)(object)Cylinder == (Object)null || Cylinder.Chambers == null || Cylinder.NumChambers == 0) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); return; } FVRFireArmChamber val = Cylinder.Chambers[m_curChamber]; if ((Object)(object)val == (Object)null || !val.IsFull || val.IsSpent || (Object)(object)val.GetRound() == (Object)null) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); } else if (val.Fire()) { FVRFireArmRound round = val.GetRound(); ((FVRFireArm)this).Fire(val, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); FireMuzzleFire(RevolverMuzzleFireIndex); ((FVRFireArm)this).FireMuzzleSmoke(RevolverMuzzleSmokeIndex); ((FVRFireArm)this).AddGas(RevolverGasOutIndex); ((FVRFireArm)this).Recoil(((FVRFireArm)this).IsTwoHandStabilized(), (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null, ((FVRFireArm)this).IsShoulderStabilized(), (FVRFireArmRecoilProfile)null, 1f); HandleRoundDischarge(val, round); } } else if ((Object)(object)ShotgunChamber == (Object)null || !ShotgunChamber.IsFull || ShotgunChamber.IsSpent || (Object)(object)ShotgunChamber.GetRound() == (Object)null) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); } else if (ShotgunChamber.Fire()) { FVRFireArmRound round2 = ShotgunChamber.GetRound(); ((FVRFireArm)this).Fire(ShotgunChamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); FireMuzzleFire(ShotgunMuzzleFireIndex); ((FVRFireArm)this).FireMuzzleSmoke(ShotgunMuzzleSmokeIndex); ((FVRFireArm)this).AddGas(ShotgunGasOutIndex); ((FVRFireArm)this).Recoil(((FVRFireArm)this).IsTwoHandStabilized(), (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null, ((FVRFireArm)this).IsShoulderStabilized(), ShotgunRecoilProfile, 1f); HandleRoundDischarge(ShotgunChamber, round2); } } private void HandleRoundDischarge(FVRFireArmChamber chamber, FVRFireArmRound round) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)round != (Object)null) { ((FVRFireArm)this).PlayAudioGunShot(round, GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (round.IsCaseless && !chamber.SuppressCaselessDeletion) { chamber.SetRound((FVRFireArmRound)null, false); } } if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { chamber.IsSpent = false; chamber.UpdateProxyDisplay(); } } public override void FVRUpdate() { //IL_002a: 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) if (m_needsPreciseSnap && (Object)(object)m_hingeGO != (Object)null) { m_hingeGO.transform.localPosition = m_weldedLocalPos; m_hingeGO.transform.localRotation = m_weldedLocalRot; m_needsPreciseSnap = false; } ((FVRFireArm)this).FVRUpdate(); m_slide.Tick(); UpdateGravityEject(); UpdateHammerShared(); UpdateFanning(); UpdateSpinning(); UpdateTriggerLogic(); if (CurrentMode == FireMode.Revolver) { UpdateCylinderRot(); } UpdateChamberStateFeedback(); UpdateSelectorPin(); UpdateLoadingGate(); if (StateTogglesPose && CurrentMode == FireMode.Revolver) { ToggleRevolverPose(m_isGateOpen); } CheckQuickBeltSlotsForAmmo(); } private void UpdateSelectorPin() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)FireSelectorPin == (Object)null) && (CurrentMode != FireMode.Revolver || !m_isGateOpen)) { float x = FireSelectorPin.localEulerAngles.x; float x2 = m_TargetSelectorRotation.x; float num = Mathf.LerpAngle(x, x2, Time.deltaTime * m_SelectorPinSpeed); FireSelectorPin.localEulerAngles = new Vector3(num, 0f, 0f); } } private void UpdateLoadingGate() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (m_isShotgunOpen) { if ((Object)(object)LoadingGate != (Object)null) { LoadingGate.localEulerAngles = new Vector3(0f, 0f, LoadingGate_Rot_Closed); } } else if (CurrentMode == FireMode.Revolver && (Object)(object)LoadingGate != (Object)null) { float num = ((!m_isGateOpen) ? LoadingGate_Rot_Closed : LoadingGate_Rot_Open); LoadingGate.localEulerAngles = new Vector3(0f, 0f, num); } else if ((Object)(object)LoadingGate != (Object)null) { LoadingGate.localEulerAngles = new Vector3(0f, 0f, LoadingGate_Rot_Closed); } } public override void FVRFixedUpdate() { if (!m_weldInitialized) { m_weldInitialized = true; if (base.m_isLatched && (Object)(object)hinge != (Object)null) { WeldBarrel(); } } if (base.m_isLatched && (Object)(object)hinge == (Object)null && (Mathf.Abs(base.m_latchRot) > 5f || base.m_isExternallyUnlatched)) { SeparateBarrel(); m_isShotgunOpen = true; } if ((Object)(object)hinge == (Object)null) { base.m_isLatched = true; base.m_latchRot = 0f; base.m_isExternallyUnlatched = false; base.IsLatchHeldOpen = false; } ((BreakActionWeapon)this).FVRFixedUpdate(); timeSinceColFire += Time.deltaTime; if (m_isShotgunOpen && !((BreakActionWeapon)this).IsLatched && (Object)(object)hinge != (Object)null && !mLemat_HasEjectedThisOpen && Mathf.Abs(hinge.angle) >= hingeEjectLimit) { mLemat_HasEjectedThisOpen = true; if (base.m_EjectsOnOpen) { PopOutEmpties(); } } UpdateChamberAccessibility(); } private void UpdateChamberAccessibility() { if (CurrentMode == FireMode.Shotgun && (Object)(object)ShotgunChamber != (Object)null) { ShotgunChamber.IsAccessible = m_isShotgunOpen && !((BreakActionWeapon)this).IsLatched; } } private void UpdateChamberStateFeedback() { if ((Object)(object)ShotgunChamber != (Object)null && ShotgunChamber.IsFull && !mWasShotgunChamberFull) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)20, 1f); } mWasShotgunChamberFull = (Object)(object)ShotgunChamber != (Object)null && ShotgunChamber.IsFull; } public override void UpdateInteraction(FVRViveHand hand) { //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) ((BreakActionWeapon)this).UpdateInteraction(hand); if ((Object)(object)hand == (Object)null) { return; } if (hand.IsInStreamlinedMode) { if (CurrentMode == FireMode.Revolver) { if (hand.Input.BYButtonDown) { ToggleRevolverGate(!m_isGateOpen); } if (hand.Input.AXButtonDown) { if (m_isGateOpen) { AdvanceCylinder(); } else if (!m_isHammerCocked && !m_isHammerCocking) { CockHammerRevolver(5f); } else if (m_isHammerCocked) { ToggleFireMode(); } } } else { if (hand.Input.BYButtonPressed) { m_IsLatchHeldOpen = true; } else { m_IsLatchHeldOpen = false; } if (hand.Input.AXButtonDown) { if (!m_isHammerCocked && !m_isHammerCocking) { CockHammerShotgun(5f); } else if (m_isHammerCocked) { ToggleFireMode(); } } } } else { Vector2 touchpadAxes = hand.Input.TouchpadAxes; if (CurrentMode == FireMode.Revolver) { if (hand.Input.TouchpadDown) { float num = Vector2.Angle(touchpadAxes, Vector2.up); float num2 = Vector2.Angle(touchpadAxes, Vector2.down); float num3 = Vector2.Angle(touchpadAxes, Vector2.left); float num4 = Vector2.Angle(touchpadAxes, Vector2.right); if (num < 45f) { m_isSpinning = true; } else if (num2 < 45f) { if (!m_isHammerCocked && !m_isHammerCocking) { CockHammerRevolver(5f); } else if (m_isHammerCocked) { ToggleFireMode(); } } else if (num3 < 45f) { ToggleRevolverGate(!m_isGateOpen); } else if (num4 < 45f && m_isGateOpen) { AdvanceCylinder(); } } } else if (hand.Input.TouchpadPressed) { if (touchpadAxes.y > 0.1f) { m_IsLatchHeldOpen = true; } else { m_IsLatchHeldOpen = false; } if (hand.Input.TouchpadDown && touchpadAxes.y < -0.1f) { if (!m_isHammerCocked && !m_isHammerCocking) { CockHammerShotgun(5f); } else if (m_isHammerCocked) { ToggleFireMode(); } } } else { m_IsLatchHeldOpen = false; } } m_IsLatchHeldOpen = m_IsLatchHeldOpen || foregripLatch; if (m_IsLatchHeldOpen) { if (!m_isShotgunOpen && !m_isGateOpen) { ((BreakActionWeapon)this).SetIsExternallyUnlatched(true); BreakOpen(); } } else if ((Object)(object)hinge != (Object)null && ((Component)hinge).transform.localEulerAngles.x <= 1f) { BreakClose(); } } public override void EndInteraction(FVRViveHand hand) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) ((BreakActionWeapon)this).EndInteraction(hand); if (m_isSpinning && (Object)(object)PoseSpinHolder != (Object)null && (Object)(object)hand != (Object)null) { ((FVRPhysicalObject)this).RootRigidbody.AddRelativeTorque(new Vector3(xSpinVel, 0f, 0f), (ForceMode)1); } m_isSpinning = false; } private void UpdateTriggerLogic() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) float num = ((!((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)) ? 0f : ((FVRInteractiveObject)this).m_hand.Input.TriggerFloat); if ((Object)(object)Trigger != (Object)null) { Trigger.localEulerAngles = new Vector3(Mathf.Lerp(Trigger_Rot_Forward, Trigger_Rot_Rearward, num), 0f, 0f); } if (num <= 0.45f) { hasTriggeredUpSinceBegin = true; TriggerReset = true; } float num2 = ((!hasTriggeredUpSinceBegin) ? 0f : num); if (!(num2 > TriggerThreshold)) { return; } if (CurrentMode == FireMode.Revolver) { if (m_isGateOpen && !m_isShotgunOpen) { if (TriggerReset) { EjectAccessibleRevolverChamber(); TriggerReset = false; } } else if (!m_isGateOpen && m_isShotgunOpen) { if (m_isHammerCocked && TriggerReset) { ResetHammerState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); TriggerReset = false; } } else if (m_isHammerCocked) { m_isHammerCocked = false; m_isHammerCocking = false; m_hammerCockLerp = 0f; Fire(); } } else { if (CurrentMode != FireMode.Shotgun) { return; } if (m_isShotgunOpen) { if (m_isHammerCocked && TriggerReset) { ResetHammerState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); TriggerReset = false; } } else if (m_isHammerCocked) { ResetHammerState(); Fire(); } } } private void ResetHammerState() { m_isHammerCocked = false; m_isHammerCocking = false; m_hammerCockLerp = 0f; } private void UpdateHammerShared() { //IL_016f: Unknown result type (might be due to invalid IL or missing references) if (m_isHammerCocking) { if (m_hammerCockLerp < 1f) { m_hammerCockLerp += Time.deltaTime * m_hammerCockSpeed; } else { m_hammerCockLerp = 1f; m_isHammerCocking = false; m_isHammerCocked = true; if (CurrentMode == FireMode.Revolver && (Object)(object)Cylinder != (Object)null && Cylinder.Chambers != null) { m_curChamber++; if (m_curChamber >= Cylinder.NumChambers) { m_curChamber = 0; } m_curChamberLerp = 0f; m_tarChamberLerp = 0f; } } } if (CurrentMode == FireMode.Revolver && m_isGateOpen && !m_isHammerCocking && !m_isHammerCocked) { float num = Hammer_Rot_Cocked_Revolver - Hammer_Rot_Uncocked_Revolver; if (Mathf.Abs(num) > 0.001f) { float num2 = (Hammer_Rot_Halfcock_Revolver - Hammer_Rot_Uncocked_Revolver) / num; num2 = Mathf.Clamp01(num2); m_hammerCockLerp = num2; } } if ((Object)(object)Hammer != (Object)null) { float num3 = Mathf.Lerp(Hammer_Rot_Uncocked, Hammer_Rot_Cocked, m_hammerCockLerp); Hammer.localEulerAngles = new Vector3(num3, 0f, 0f); } } private void UpdateFanning() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00d9: Unknown result type (might be due to invalid IL or missing references) if (!CanFan || !((FVRInteractiveObject)this).IsHeld || (Object)(object)((FVRInteractiveObject)this).m_hand == (Object)null || (Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand == (Object)null || (Object)(object)HammerFanDir == (Object)null || m_isHammerCocked || m_isHammerCocking || (CurrentMode == FireMode.Revolver && m_isGateOpen)) { return; } Vector3 velLinearWorld = ((FVRInteractiveObject)this).m_hand.OtherHand.Input.VelLinearWorld; float num = Vector3.Distance(((FVRInteractiveObject)this).m_hand.OtherHand.PalmTransform.position, HammerFanDir.position); if (num < FanDistance && Vector3.Angle(velLinearWorld, HammerFanDir.forward) < FanAngle && ((Vector3)(ref velLinearWorld)).magnitude > FanVelocityThreshold) { if (CurrentMode == FireMode.Revolver) { CockHammerRevolver(10f); } else { CockHammerShotgun(10f); } } } private void UpdateSpinning() { //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (!CanSpin || !((FVRInteractiveObject)this).IsHeld || (Object)(object)PoseSpinHolder == (Object)null) { return; } bool isSpinning = false; if (!m_isGateOpen && (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null && !m_isHammerCocking && !m_isHammerCocked && !((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)this).m_hand.Input.TouchpadPressed) { Vector2 touchpadAxes = ((FVRInteractiveObject)this).m_hand.Input.TouchpadAxes; if (Vector2.Angle(touchpadAxes, Vector2.up) < 45f) { isSpinning = true; } } m_isSpinning = isSpinning; if (m_isSpinning) { Vector3 velLinearLocal = ((FVRInteractiveObject)this).m_hand.Input.VelLinearLocal; float num = Vector3.Dot(((Vector3)(ref velLinearLocal)).normalized, ((Component)this).transform.up); if (Mathf.Abs(xSpinVel) < 90f) { xSpinVel += num * Time.deltaTime * 600f; } else if (Mathf.Sign(num) == Mathf.Sign(xSpinVel)) { xSpinVel += num * Time.deltaTime * 600f; } xSpinVel = Mathf.Clamp(xSpinVel, -500f, 500f); 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.localRotation = Quaternion.RotateTowards(PoseSpinHolder.localRotation, Quaternion.identity, Time.deltaTime * 500f); PoseSpinHolder.localEulerAngles = new Vector3(PoseSpinHolder.localEulerAngles.x, 0f, 0f); } } private void UpdateCylinderRot() { //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) if (m_isShotgunOpen) { for (int i = 0; i < Cylinder.Chambers.Length; i++) { Cylinder.Chambers[i].IsAccessible = false; } } else if (m_isStateToggled || m_isGateOpen) { int num = PrevChamber; if (IsAccessTwoChambersBack) { num = PrevChamber2; } for (int j = 0; j < Cylinder.Chambers.Length; j++) { Cylinder.Chambers[j].IsAccessible = j == num; } if (DoesHalfCockHalfRotCylinder) { int num2 = (CurChamber + 1) % Cylinder.NumChambers; ((Component)Cylinder).transform.localRotation = Quaternion.Slerp(Cylinder.GetLocalRotationFromCylinder(CurChamber), Cylinder.GetLocalRotationFromCylinder(num2), 0.5f); } else { ((Component)Cylinder).transform.localRotation = Cylinder.GetLocalRotationFromCylinder(CurChamber); } if (DoesCylinderTranslateForward) { ((Component)Cylinder).transform.localPosition = CylinderBackPos; } } else { for (int k = 0; k < Cylinder.Chambers.Length; k++) { Cylinder.Chambers[k].IsAccessible = false; } m_tarChamberLerp = ((!m_isHammerCocking) ? 0f : m_hammerCockLerp); m_curChamberLerp = Mathf.Lerp(m_curChamberLerp, m_tarChamberLerp, Time.deltaTime * 16f); int num3 = (CurChamber + 1) % Cylinder.NumChambers; ((Component)Cylinder).transform.localRotation = Quaternion.Slerp(Cylinder.GetLocalRotationFromCylinder(CurChamber), Cylinder.GetLocalRotationFromCylinder(num3), m_curChamberLerp); if (DoesCylinderTranslateForward) { ((Component)Cylinder).transform.localPosition = Vector3.Lerp(CylinderBackPos, CylinderFrontPos, m_hammerCockLerp); } } } private void CockHammerRevolver(float speed) { if (!m_isHammerCocked && !m_isHammerCocking) { m_hammerCockSpeed = speed; m_isHammerCocking = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); } } private void CockHammerShotgun(float speed) { if (!m_isHammerCocked && !m_isHammerCocking) { m_hammerCockSpeed = speed; m_isHammerCocking = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); } } private void ToggleFireMode() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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) if (!m_isGateOpen) { bool isHammerCocked = m_isHammerCocked; bool isHammerCocking = m_isHammerCocking; float hammerCockLerp = m_hammerCockLerp; if (CurrentMode == FireMode.Revolver) { CurrentMode = FireMode.Shotgun; Hammer_Rot_Uncocked = Hammer_Rot_Uncocked_Shotgun; Hammer_Rot_Cocked = Hammer_Rot_Cocked_Shotgun; ((FVRFireArm)this).RoundType = ShotgunRoundType; } else { CurrentMode = FireMode.Revolver; Hammer_Rot_Uncocked = Hammer_Rot_Uncocked_Revolver; Hammer_Rot_Cocked = Hammer_Rot_Cocked_Revolver; ((FVRFireArm)this).RoundType = m_originalRoundType; } m_TargetSelectorRotation = ((CurrentMode != FireMode.Revolver) ? ShotgunPinRotation : RevolverPinRotation); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f); m_isHammerCocked = isHammerCocked; m_isHammerCocking = isHammerCocking; m_hammerCockLerp = hammerCockLerp; } } private void ToggleRevolverPose(bool openGatePose) { //IL_00c4: 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_0052: 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_0102: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Pose_Main == (Object)null || (Object)(object)Pose_Toggled == (Object)null || ((FVRPhysicalObject)this).IsAltHeld || !((FVRInteractiveObject)this).IsHeld) { return; } if (!openGatePose) { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Main.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Main.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Main.localRotation; } } else { ((FVRInteractiveObject)this).PoseOverride.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).PoseOverride.localRotation = Pose_Toggled.localRotation; if ((Object)(object)((FVRInteractiveObject)this).m_grabPointTransform != (Object)null) { ((FVRInteractiveObject)this).m_grabPointTransform.localPosition = Pose_Toggled.localPosition; ((FVRInteractiveObject)this).m_grabPointTransform.localRotation = Pose_Toggled.localRotation; } } } private void ToggleRevolverGate(bool open) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (m_isShotgunOpen || CurrentMode != FireMode.Revolver || m_isGateOpen == open) { return; } m_isGateOpen = open; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)((!open) ? 31 : 30), 1f); if (!open) { ResetHammerState(); if ((Object)(object)Hammer != (Object)null) { Hammer.localEulerAngles = new Vector3(Hammer_Rot_Uncocked, 0f, 0f); } return; } m_isHammerCocking = false; m_isHammerCocked = false; float num = Hammer_Rot_Cocked_Revolver - Hammer_Rot_Uncocked_Revolver; if (Mathf.Abs(num) > 0.001f) { float num2 = (Hammer_Rot_Halfcock_Revolver - Hammer_Rot_Uncocked_Revolver) / num; num2 = Mathf.Clamp01(num2); m_hammerCockLerp = num2; } } private void AdvanceCylinder() { m_curChamber++; if (m_curChamber >= Cylinder.NumChambers) { m_curChamber = 0; } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)0, 1f); } private void EjectAccessibleRevolverChamber() { if ((Object)(object)Cylinder == (Object)null || Cylinder.Chambers == null) { return; } for (int i = 0; i < Cylinder.Chambers.Length; i++) { FVRFireArmChamber val = Cylinder.Chambers[i]; if (val.IsAccessible) { m_slide.Clearance = RevolverEjectClearance; if (m_slide.Eject(Cylinder, val)) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); } break; } } } private void UpdateGravityEject() { if (!GravityEject || (Object)(object)Cylinder == (Object)null || Cylinder.Chambers == null || CurrentMode != FireMode.Revolver || !m_isGateOpen || m_isShotgunOpen) { return; } for (int i = 0; i < Cylinder.Chambers.Length; i++) { FVRFireArmChamber val = Cylinder.Chambers[i]; if ((Object)(object)val != (Object)null && val.IsAccessible) { m_slide.Clearance = RevolverEjectClearance; if (m_slide.TryGravityEject(Cylinder, val, GravityEjectMinTilt)) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); } break; } } } public override void OnDestroy() { m_slide.Clear(); ((FVRPhysicalObject)this).OnDestroy(); } public void PopOutEmpties() { if ((Object)(object)ShotgunChamber != (Object)null && ShotgunChamber.IsFull && ShotgunChamber.IsSpent) { PopOutRound(ShotgunChamber); } } public void PopOutRound(FVRFireArmChamber chamber) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)21, 1f); chamber.EjectRound(((Component)chamber).transform.position + ((Component)chamber).transform.forward * base.EjectOffset, ((Component)chamber).transform.forward * base.EjectSpeed, Vector3.right, false); ((FVRFireArm)this).AddGas(ShotgunGasOutIndex); } private void WeldBarrel() { //IL_0030: 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_00a1: 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) if (!((Object)(object)m_hingeGO == (Object)null)) { if ((Object)(object)m_hingeRB != (Object)null) { m_hingeRB.velocity = Vector3.zero; m_hingeRB.angularVelocity = Vector3.zero; } if ((Object)(object)hinge != (Object)null) { Object.Destroy((Object)(object)hinge); hinge = null; } if ((Object)(object)base.Hinge != (Object)null) { Object.Destroy((Object)(object)base.Hinge); base.Hinge = null; } m_hingeGO.transform.localPosition = base.m_foreStartPos; m_hingeGO.transform.localEulerAngles = Vector3.zero; if ((Object)(object)m_hingeRB != (Object)null) { Object.Destroy((Object)(object)m_hingeRB); m_hingeRB = null; } m_hingeGO.transform.SetParent(((Component)this).transform, true); m_needsPreciseSnap = true; } } private void SeparateBarrel() { //IL_008b: 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_00ad: 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_00cd: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)m_hingeGO == (Object)null)) { m_hingeGO.transform.SetParent(m_hingeOriginalParent, true); m_hingeRB = m_hingeGO.AddComponent(); m_hingeRB.mass = m_cachedMass; m_hingeRB.drag = m_cachedDrag; m_hingeRB.angularDrag = m_cachedAngularDrag; m_hingeRB.useGravity = m_cachedUseGravity; m_hingeRB.interpolation = m_cachedInterpolation; m_hingeRB.collisionDetectionMode = m_cachedCollisionDetection; m_hingeRB.constraints = m_cachedConstraints; m_hingeRB.velocity = Vector3.zero; m_hingeRB.angularVelocity = Vector3.zero; HingeJoint val = m_hingeGO.AddComponent(); ((Joint)val).axis = m_cachedAxis; ((Joint)val).anchor = m_cachedAnchor; ((Joint)val).autoConfigureConnectedAnchor = false; ((Joint)val).connectedAnchor = m_cachedConnectedAnchor; ((Joint)val).connectedBody = m_cachedConnectedBody; val.useLimits = true; JointLimits cachedLimits = m_cachedLimits; ((JointLimits)(ref cachedLimits)).max = hingeLimit; val.limits = cachedLimits; val.useSpring = m_cachedUseSpring; if (m_cachedUseSpring) { val.spring = m_cachedSpring; } val.useMotor = m_cachedUseMotor; if (m_cachedUseMotor) { val.motor = m_cachedMotor; } hinge = val; base.Hinge = val; if ((Object)(object)m_lematForegrip != (Object)null) { m_lematForegrip.Hinge = val; m_lematForegrip.RB = m_hingeRB; } } } public void BreakOpen() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (!m_isShotgunOpen && !m_isGateOpen) { m_isShotgunOpen = true; ((BreakActionWeapon)this).SetIsExternallyUnlatched(true); if (CurrentMode == FireMode.Revolver) { ((FVRFireArm)this).RoundType = ShotgunRoundType; } SeparateBarrel(); if ((Object)(object)ShotgunChamber != (Object)null) { ShotgunChamber.IsAccessible = true; } } } public void BreakClose() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (m_isShotgunOpen) { m_isShotgunOpen = false; mLemat_HasEjectedThisOpen = false; ((BreakActionWeapon)this).SetIsExternallyUnlatched(false); if (CurrentMode == FireMode.Revolver) { ((FVRFireArm)this).RoundType = m_originalRoundType; } WeldBarrel(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f); ShotgunChamber.IsAccessible = false; } } private void CheckQuickBeltSlotsForAmmo() { //IL_00fe: 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_00e1: Unknown result type (might be due to invalid IL or missing references) FVRViveHand val = null; FVRViveHand[] hands = GM.CurrentMovementManager.Hands; foreach (FVRViveHand val2 in hands) { if ((Object)(object)val2.CurrentInteractable == (Object)(object)this) { val = val2; break; } } if ((Object)(object)val == (Object)null) { return; } FVRViveHand val3 = ((!((Object)(object)val == (Object)(object)GM.CurrentMovementManager.Hands[0])) ? GM.CurrentMovementManager.Hands[0] : GM.CurrentMovementManager.Hands[1]); if ((Object)(object)val3.CurrentHoveredQuickbeltSlot != (Object)null && val3.CurrentHoveredQuickbeltSlot.HeldObject is FVRFireArmRound) { FVRInteractiveObject heldObject = val3.CurrentHoveredQuickbeltSlot.HeldObject; FVRFireArmRound val4 = (FVRFireArmRound)(object)((heldObject is FVRFireArmRound) ? heldObject : null); if (m_isFilteringChambers) { FireArmRoundType? lastFilteredType = m_lastFilteredType; if (lastFilteredType.GetValueOrDefault() == val4.RoundType && lastFilteredType.HasValue) { return; } } FilterChambersForRoundType(val4.RoundType); } else if (m_isFilteringChambers) { RestoreAllChambers(); } } private void FilterChambersForRoundType(FireArmRoundType roundType) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0021: 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_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) m_isFilteringChambers = true; m_lastFilteredType = roundType; m_savedRoundType = ((FVRFireArm)this).RoundType; ((FVRFireArm)this).RoundType = roundType; ((FVRFireArm)this).FChambers.Clear(); foreach (FVRFireArmChamber allChamber in m_allChambers) { if (allChamber.RoundType == roundType) { ((FVRFireArm)this).FChambers.Add(allChamber); } } } private void RestoreAllChambers() { //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) ((FVRFireArm)this).RoundType = m_savedRoundType; m_isFilteringChambers = false; m_lastFilteredType = null; ((FVRFireArm)this).FChambers.Clear(); ((FVRFireArm)this).FChambers.AddRange(m_allChambers); } } public class LematForegrip : FVRAlternateGrip { [Header("Shotgun Setup")] public Transform ShotgunBase; public HingeJoint Hinge; private Vector3 localPosStart; [NonSerialized] public Rigidbody RB; private Lemat Wep; private float m_initialDamp = 0.05f; private float m_initialSpring = 0.05f; public override void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) ((FVRAlternateGrip)this).Awake(); localPosStart = ((Component)Hinge).transform.localPosition; RB = ((Component)Hinge).gameObject.GetComponent(); Wep = ((Component)((Joint)Hinge).connectedBody).gameObject.GetComponent(); if ((Object)(object)Wep != (Object)null) { Wep.ForegripRef = this; } JointSpring spring = Hinge.spring; m_initialSpring = spring.spring; m_initialDamp = spring.damper; } public override void FVRUpdate() { //IL_0029: 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_004f: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (!((Object)(object)Hinge == (Object)null) && Vector3.Distance(((Component)Hinge).transform.localPosition, localPosStart) > 0.01f) { ((Component)Hinge).transform.localPosition = localPosStart; } } public override void FVRFixedUpdate() { ((FVRInteractiveObject)this).FVRFixedUpdate(); if (!((Object)(object)RB == (Object)null)) { if (((FVRInteractiveObject)Wep).IsHeld && ((FVRPhysicalObject)Wep).IsAltHeld) { RB.mass = 0.001f; } else { RB.mass = 0.1f; } } } public override bool IsInteractable() { return true; } public override void UpdateInteraction(FVRViveHand hand) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0215: 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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0286: 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) ((FVRAlternateGrip)this).UpdateInteraction(hand); bool flag = ((FVRInteractiveObject)Wep).IsHeld && ((FVRInteractiveObject)this).IsHeld; if (hand.IsInStreamlinedMode) { if (flag) { Wep.m_IsLatchHeldOpen = hand.Input.BYButtonPressed; Wep.foregripLatch = hand.Input.BYButtonPressed; } else { Wep.m_IsLatchHeldOpen = hand.Input.BYButtonPressed; Wep.foregripLatch = hand.Input.BYButtonPressed; } } else { Vector2 touchpadAxes = hand.Input.TouchpadAxes; if (flag) { if (hand.Input.TouchpadPressed && touchpadAxes.y > 0.1f) { Wep.m_IsLatchHeldOpen = true; Wep.foregripLatch = true; } else { Wep.m_IsLatchHeldOpen = false; Wep.foregripLatch = false; } } else if (hand.Input.TouchpadPressed && touchpadAxes.y > 0.1f) { Wep.m_IsLatchHeldOpen = true; Wep.foregripLatch = true; } else { Wep.m_IsLatchHeldOpen = false; Wep.foregripLatch = false; } } if (!((Object)(object)Hinge == (Object)null)) { Vector3 val = ((HandInput)(ref hand.Input)).Pos - ((Component)Hinge).transform.position; Vector3 val2 = Vector3.ProjectOnPlane(val, ShotgunBase.right); if (Vector3.Angle(val2, -ShotgunBase.up) > 90f) { val2 = ShotgunBase.forward; } if (Vector3.Angle(val2, ShotgunBase.forward) > 90f) { val2 = -ShotgunBase.up; } float num = Vector3.Angle(val2, ShotgunBase.forward); JointSpring spring = Hinge.spring; spring.spring = 10f; spring.damper = 0f; JointLimits limits = Hinge.limits; spring.targetPosition = Mathf.Clamp(num, 0f, ((JointLimits)(ref limits)).max); Hinge.spring = spring; ((Component)Hinge).transform.localPosition = localPosStart; } } public override void EndInteraction(FVRViveHand hand) { //IL_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_004b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Hinge != (Object)null) { JointSpring spring = Hinge.spring; spring.spring = m_initialSpring; spring.damper = m_initialDamp; spring.targetPosition = 45f; Hinge.spring = spring; } ((FVRAlternateGrip)this).EndInteraction(hand); } } } [ExecuteInEditMode] 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 ConeParams { public float AngleMin; public float AngleMax; public float Inner; public string SFCurve; public string RandCurve; } [Serializable] public struct CompassEntry { public float PolarBaseDeg; public string PolarCurve; public float AzimuthBaseDeg; public string AzimuthCurve; public float AzimuthOriginDeg; public ConeParams Cone; public float SpeedMin; public float SpeedMax; public string SpeedCurve; public string SpeedRandomCurve; } [Serializable] public struct ConeEntry { public Vector3 Axis; public ConeParams Cone; public float SpeedMin; public float SpeedMax; public string SpeedCurve; public string SpeedRandomCurve; } [Serializable] public struct RadialVelocityEntry { public bool Sphere; public Vector3 Axis; public Vector3 Scale; public float InnerFraction; public float SpeedMin; public float SpeedMax; public string SpeedCurve; } [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; } private sealed class LinearCurve { private readonly float[] t; private readonly float[] v; public LinearCurve(string keys) { string[] array = keys.Split(new char[1] { ';' }); t = new float[array.Length]; v = new float[array.Length]; for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { ',' }); t[i] = float.Parse(array2[0], CultureInfo.InvariantCulture); v[i] = float.Parse(array2[1], CultureInfo.InvariantCulture); } } public float Evaluate(float x) { if (x <= t[0]) { return v[0]; } for (int i = 1; i < t.Length; i++) { if (x <= t[i]) { float num = t[i] - t[i - 1]; float num2 = ((!(num > 1E-06f)) ? 1f : ((x - t[i - 1]) / num)); return Mathf.Lerp(v[i - 1], v[i], num2); } } return v[v.Length - 1]; } } public ParticleSystem Ps; public bool HasBeam; public BeamConfig Beam; public LocationOffsetEntry[] LocationOffsets; public string[] LocationOffsetScaleCurveKeysStrs; [NonSerialized] private AnimationCurve[] _locationOffsetScaleCurves; public VelocityExtraEntry[] VelocityExtras; public CompassEntry[] CompassEntries; public RadialVelocityEntry[] RadialVelocities; public ConeEntry[] ConeEntries; public int SpawnCountHint = 1; public GravityEntry[] GravityEntries; public VortexEntry[] VortexEntries; public bool HasGravityDrag; public float GravityDrag; public bool HasUniformAccel; public Vector3 UniformAccel; public AnimationCurve UniformAccelCurve; private static readonly bool UnityUsesNewVelocityForPosition = true; public bool HasDragCurve; public AnimationCurve DragCurve; public Vector3 DragWind; public bool HasDragRandom; public float DragRandomMin; public float DragRandomMax; public bool HasFacingFade; public bool FreeVelocityOrient; public float FreeTwistMinDeg; public float FreeTwistMaxDeg; public AnimationCurve FacingSizeCurve; public AnimationCurve FacingOpacityCurve; private readonly Dictionary _facingBase = new Dictionary(); private readonly List _facingPrune = new List(); public bool HasPixelClamp; public float PixelSizeMin; public float PixelSizeMax; public bool PixelSizeMaxInfinite; public bool PixelSizeAffectOpacity; public float MaxCameraDistance; [NonSerialized] private ParticleSystemRenderer _cullRenderer; 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; public Quaternion ShapeAimRotation = Quaternion.identity; [NonSerialized] private Quaternion _inverseShapeAim = Quaternion.identity; private Particle[] buffer; private Vector3 beamSourceWorld; private Vector3 beamDestWorld; private Vector3 lastEmitterPos; private Quaternion lastEmitterRot; private HashSet lastFrameSeeds = new HashSet(); private HashSet currentFrameSeeds = new HashSet(); public static readonly List EditInstances = new List(); public ParticleSystem ParentFramePs; public ParticleAffectorCoordinator ParentFrameCoord; public Vector3 ParentAlignAxis; public bool ParentFrameUnique; public bool ParentCollides; public float ParentFrameScatterDeg; [NonSerialized] private int _processedFrame = -1; [NonSerialized] private int _parentLoadFrame = -1; [NonSerialized] private int _parentCount; [NonSerialized] private Particle[] _parentBuf; [NonSerialized] private bool[] _parentTaken; private static Camera s_viewerCamera; [NonSerialized] private int _spawnRank; [NonSerialized] private LinearCurve[] _compassPolar; [NonSerialized] private LinearCurve[] _compassAzimuth; [NonSerialized] private LinearCurve[] _compassSpeed; [NonSerialized] private LinearCurve[] _compassSpeedRand; [NonSerialized] private LinearCurve[] _radialSpeed; [NonSerialized] private LinearCurve[] _compassConeSF; [NonSerialized] private LinearCurve[] _compassConeRand; [NonSerialized] private LinearCurve[] _coneSF; [NonSerialized] private LinearCurve[] _coneRand; [NonSerialized] private LinearCurve[] _coneSpeed; [NonSerialized] private LinearCurve[] _coneSpeedRand; private void OnEnable() { //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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) _spawnRank = 0; _processedFrame = -1; _parentLoadFrame = -1; if (HasMoveRelativeToEmitter) { Transform val = ((!((Object)(object)MoveRelEmitter != (Object)null)) ? ((Component)this).transform : MoveRelEmitter); lastEmitterPos = val.position; lastEmitterRot = val.rotation; } if (!Application.isPlaying && !EditInstances.Contains(this)) { EditInstances.Add(this); } } private void OnDisable() { EditInstances.Remove(this); } public void EditorTick() { if (!Application.isPlaying && !((Object)(object)this == (Object)null)) { Process(); } } private bool TryParentFrame(Vector3 pos, float childAge, out Quaternion q) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01da: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) q = Quaternion.identity; if ((Object)(object)ParentFramePs == (Object)null || ((Vector3)(ref ParentAlignAxis)).sqrMagnitude < 1E-06f) { return false; } if (_parentLoadFrame != CryEditClock.Frame) { _parentLoadFrame = CryEditClock.Frame; MainModule main = ParentFramePs.main; int maxParticles = ((MainModule)(ref main)).maxParticles; if (_parentBuf == null || _parentBuf.Length < maxParticles) { _parentBuf = (Particle[])(object)new Particle[maxParticles]; _parentTaken = new bool[maxParticles]; } _parentCount = ParentFramePs.GetParticles(_parentBuf); Array.Clear(_parentTaken, 0, _parentTaken.Length); } float num = 0.05f + CryEditClock.Dt * 2f; int num2 = -1; float num3 = float.MaxValue; for (int i = 0; i < _parentCount; i++) { if (ParentFrameUnique && _parentTaken[i]) { continue; } Particle val = _parentBuf[i]; if (Mathf.Abs(((Particle)(ref val)).startLifetime - ((Particle)(ref val)).remainingLifetime - childAge) > num) { continue; } Vector3 velocity = ((Particle)(ref val)).velocity; if (!(((Vector3)(ref velocity)).sqrMagnitude < 1E-06f)) { Vector3 val2 = ((Particle)(ref val)).position - pos; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num3) { num3 = sqrMagnitude; num2 = i; } } } if (num2 < 0) { return false; } if (ParentFrameUnique) { _parentTaken[num2] = true; } Vector3 normalized = ((Vector3)(ref ParentAlignAxis)).normalized; Vector3 val3 = ParentDirection(num2); q = Quaternion.FromToRotation(normalized, ((Vector3)(ref val3)).normalized); if (ParentFrameScatterDeg > 0.01f) { Vector3 val4 = q * ((Vector3)(ref ParentAlignAxis)).normalized; Vector3 val5 = Vector3.Cross(val4, Random.onUnitSphere); if (((Vector3)(ref val5)).sqrMagnitude > 1E-06f) { q = Quaternion.AngleAxis(ParentFrameScatterDeg * Mathf.Sqrt(Random.value), ((Vector3)(ref val5)).normalized) * q; } } return true; } private Vector3 ParentDirection(int i) { //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_005b: 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_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) Vector3 velocity = ((Particle)(ref _parentBuf[i])).velocity; if (ParentCollides && velocity.y < 0f && GroundBelow(((Particle)(ref _parentBuf[i])).position, velocity)) { velocity.y = 0f - velocity.y; } return velocity; } private bool GroundBelow(Vector3 pos, Vector3 vel) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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) if (!Application.isPlaying) { return true; } Vector3 val = pos; Vector3 val2 = vel; if ((Object)(object)Ps != (Object)null) { MainModule main = Ps.main; if ((int)((MainModule)(ref main)).simulationSpace != 1) { val = ((Component)this).transform.TransformPoint(pos); val2 = ((Component)this).transform.TransformDirection(vel); } } if (((Vector3)(ref val2)).sqrMagnitude < 1E-08f) { return false; } return Physics.Raycast(val, ((Vector3)(ref val2)).normalized, 6f, -1, (QueryTriggerInteraction)1); } private void Awake() { //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_0070: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: 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_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Ps == (Object)null) { Ps = ((Component)this).GetComponent(); } Quaternion val = ShapeAimRotation; if (val.x == 0f && val.y == 0f && val.z == 0f && val.w == 0f) { val = Quaternion.identity; } _inverseShapeAim = Quaternion.Inverse(val); BuildSpawnVelocityCurves(); 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 val2 = ((!((Object)(object)Beam.SourceTransform != (Object)null)) ? ((Component)this).transform.position : Beam.SourceTransform.position); Vector3 val3 = ((!((Object)(object)Beam.DestTransform != (Object)null)) ? ((Component)this).transform.position : Beam.DestTransform.position); beamSourceWorld = val2 + Beam.SourceOffset; beamDestWorld = val3 + Beam.DestOffset; if (Beam.HasLine && Application.isPlaying) { LineRenderer val4 = ((Component)this).GetComponent(); if ((Object)(object)val4 == (Object)null) { val4 = ((Component)this).gameObject.AddComponent(); } ParticleSystemRenderer component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { ((Renderer)val4).material = ((Renderer)component).sharedMaterial; } val4.useWorldSpace = true; val4.positionCount = 2; val4.SetPosition(0, beamSourceWorld); val4.SetPosition(1, beamDestWorld); } } if (HasMoveRelativeToEmitter) { if ((Object)(object)MoveRelEmitter == (Object)null) { MoveRelEmitter = ((Component)this).transform; } lastEmitterPos = MoveRelEmitter.position; lastEmitterRot = MoveRelEmitter.rotation; } if (HasAlignRotation) { Quaternion val5 = ((!((Object)(object)AlignParentTransform != (Object)null)) ? Quaternion.identity : AlignParentTransform.rotation); Vector3 val6 = val5 * AlignAxisLocal; _alignTargetWorldDir = ((Vector3)(ref val6)).normalized; } } private void LateUpdate() { Process(); } private void Process() { if (_processedFrame != CryEditClock.Frame) { _processedFrame = CryEditClock.Frame; if ((Object)(object)ParentFrameCoord != (Object)null) { ParentFrameCoord.Process(); } ProcessCore(); } } private void ProcessCore() { //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_148f: Unknown result type (might be due to invalid IL or missing references) //IL_1491: Unknown result type (might be due to invalid IL or missing references) //IL_149d: Unknown result type (might be due to invalid IL or missing references) //IL_14a2: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Invalid comparison between Unknown and I4 //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_07f5: Unknown result type (might be due to invalid IL or missing references) //IL_07fa: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: 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_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_0629: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_0a0a: Unknown result type (might be due to invalid IL or missing references) //IL_0a0f: Unknown result type (might be due to invalid IL or missing references) //IL_0888: 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_0892: Unknown result type (might be due to invalid IL or missing references) //IL_0897: Unknown result type (might be due to invalid IL or missing references) //IL_089c: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06b0: Unknown result type (might be due to invalid IL or missing references) //IL_06c4: 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_06f9: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0556: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_08ec: Unknown result type (might be due to invalid IL or missing references) //IL_08dc: Unknown result type (might be due to invalid IL or missing references) //IL_0a65: Unknown result type (might be due to invalid IL or missing references) //IL_0a55: Unknown result type (might be due to invalid IL or missing references) //IL_08f1: Unknown result type (might be due to invalid IL or missing references) //IL_0719: Unknown result type (might be due to invalid IL or missing references) //IL_0732: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_073b: Unknown result type (might be due to invalid IL or missing references) //IL_0740: Unknown result type (might be due to invalid IL or missing references) //IL_0c85: Unknown result type (might be due to invalid IL or missing references) //IL_0c87: Unknown result type (might be due to invalid IL or missing references) //IL_0c89: Unknown result type (might be due to invalid IL or missing references) //IL_0c8b: Unknown result type (might be due to invalid IL or missing references) //IL_0c8d: Unknown result type (might be due to invalid IL or missing references) //IL_0c8f: Unknown result type (might be due to invalid IL or missing references) //IL_0c96: Unknown result type (might be due to invalid IL or missing references) //IL_0c9b: Unknown result type (might be due to invalid IL or missing references) //IL_0ca0: Unknown result type (might be due to invalid IL or missing references) //IL_0a6a: Unknown result type (might be due to invalid IL or missing references) //IL_091a: Unknown result type (might be due to invalid IL or missing references) //IL_0910: 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_0781: Unknown result type (might be due to invalid IL or missing references) //IL_0783: 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_0a93: Unknown result type (might be due to invalid IL or missing references) //IL_0a89: Unknown result type (might be due to invalid IL or missing references) //IL_091f: Unknown result type (might be due to invalid IL or missing references) //IL_0921: Unknown result type (might be due to invalid IL or missing references) //IL_0923: Unknown result type (might be due to invalid IL or missing references) //IL_0925: Unknown result type (might be due to invalid IL or missing references) //IL_092a: Unknown result type (might be due to invalid IL or missing references) //IL_07b5: Unknown result type (might be due to invalid IL or missing references) //IL_07ce: Unknown result type (might be due to invalid IL or missing references) //IL_07d2: 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_07dc: Unknown result type (might be due to invalid IL or missing references) //IL_0d08: Unknown result type (might be due to invalid IL or missing references) //IL_0d0a: Unknown result type (might be due to invalid IL or missing references) //IL_0d11: Unknown result type (might be due to invalid IL or missing references) //IL_0d16: Unknown result type (might be due to invalid IL or missing references) //IL_0d1b: Unknown result type (might be due to invalid IL or missing references) //IL_0a98: Unknown result type (might be due to invalid IL or missing references) //IL_0a9a: Unknown result type (might be due to invalid IL or missing references) //IL_0a9c: Unknown result type (might be due to invalid IL or missing references) //IL_0a9e: Unknown result type (might be due to invalid IL or missing references) //IL_0aa3: Unknown result type (might be due to invalid IL or missing references) //IL_0d59: Unknown result type (might be due to invalid IL or missing references) //IL_0d5b: Unknown result type (might be due to invalid IL or missing references) //IL_0d65: Unknown result type (might be due to invalid IL or missing references) //IL_0d6a: Unknown result type (might be due to invalid IL or missing references) //IL_0d6f: Unknown result type (might be due to invalid IL or missing references) //IL_0d27: Unknown result type (might be due to invalid IL or missing references) //IL_0d29: Unknown result type (might be due to invalid IL or missing references) //IL_0d2b: Unknown result type (might be due to invalid IL or missing references) //IL_0d2d: Unknown result type (might be due to invalid IL or missing references) //IL_0d34: Unknown result type (might be due to invalid IL or missing references) //IL_0d39: Unknown result type (might be due to invalid IL or missing references) //IL_0d43: Unknown result type (might be due to invalid IL or missing references) //IL_0d48: Unknown result type (might be due to invalid IL or missing references) //IL_0d4d: Unknown result type (might be due to invalid IL or missing references) //IL_0d52: Unknown result type (might be due to invalid IL or missing references) //IL_0ad7: Unknown result type (might be due to invalid IL or missing references) //IL_0ad9: Unknown result type (might be due to invalid IL or missing references) //IL_0adb: Unknown result type (might be due to invalid IL or missing references) //IL_0ae0: Unknown result type (might be due to invalid IL or missing references) //IL_0ae2: Unknown result type (might be due to invalid IL or missing references) //IL_0ae4: Unknown result type (might be due to invalid IL or missing references) //IL_0ae6: Unknown result type (might be due to invalid IL or missing references) //IL_0ae8: Unknown result type (might be due to invalid IL or missing references) //IL_0aef: Unknown result type (might be due to invalid IL or missing references) //IL_0af4: Unknown result type (might be due to invalid IL or missing references) //IL_0af9: Unknown result type (might be due to invalid IL or missing references) //IL_0afb: Unknown result type (might be due to invalid IL or missing references) //IL_0b00: Unknown result type (might be due to invalid IL or missing references) //IL_099d: Unknown result type (might be due to invalid IL or missing references) //IL_099f: Unknown result type (might be due to invalid IL or missing references) //IL_09a1: Unknown result type (might be due to invalid IL or missing references) //IL_09a6: Unknown result type (might be due to invalid IL or missing references) //IL_096b: Unknown result type (might be due to invalid IL or missing references) //IL_096d: Unknown result type (might be due to invalid IL or missing references) //IL_096f: Unknown result type (might be due to invalid IL or missing references) //IL_0974: Unknown result type (might be due to invalid IL or missing references) //IL_0976: Unknown result type (might be due to invalid IL or missing references) //IL_0978: Unknown result type (might be due to invalid IL or missing references) //IL_097a: Unknown result type (might be due to invalid IL or missing references) //IL_097c: Unknown result type (might be due to invalid IL or missing references) //IL_0983: Unknown result type (might be due to invalid IL or missing references) //IL_0988: Unknown result type (might be due to invalid IL or missing references) //IL_098d: Unknown result type (might be due to invalid IL or missing references) //IL_098f: Unknown result type (might be due to invalid IL or missing references) //IL_0994: Unknown result type (might be due to invalid IL or missing references) //IL_1192: Unknown result type (might be due to invalid IL or missing references) //IL_11a6: Unknown result type (might be due to invalid IL or missing references) //IL_0da7: Unknown result type (might be due to invalid IL or missing references) //IL_0da9: Unknown result type (might be due to invalid IL or missing references) //IL_0dac: Unknown result type (might be due to invalid IL or missing references) //IL_0db1: Unknown result type (might be due to invalid IL or missing references) //IL_0db6: Unknown result type (might be due to invalid IL or missing references) //IL_0dbb: Unknown result type (might be due to invalid IL or missing references) //IL_0dbd: Unknown result type (might be due to invalid IL or missing references) //IL_0dc2: Unknown result type (might be due to invalid IL or missing references) //IL_0dc4: Unknown result type (might be due to invalid IL or missing references) //IL_0dc6: Unknown result type (might be due to invalid IL or missing references) //IL_0dce: Unknown result type (might be due to invalid IL or missing references) //IL_0dd3: Unknown result type (might be due to invalid IL or missing references) //IL_0b2d: Unknown result type (might be due to invalid IL or missing references) //IL_0b31: Unknown result type (might be due to invalid IL or missing references) //IL_0b36: Unknown result type (might be due to invalid IL or missing references) //IL_0b38: Unknown result type (might be due to invalid IL or missing references) //IL_0b3f: Unknown result type (might be due to invalid IL or missing references) //IL_0b44: Unknown result type (might be due to invalid IL or missing references) //IL_0b49: Unknown result type (might be due to invalid IL or missing references) //IL_0e83: Unknown result type (might be due to invalid IL or missing references) //IL_0e88: Unknown result type (might be due to invalid IL or missing references) //IL_0e9f: Unknown result type (might be due to invalid IL or missing references) //IL_0de7: Unknown result type (might be due to invalid IL or missing references) //IL_0de9: Unknown result type (might be due to invalid IL or missing references) //IL_0deb: Unknown result type (might be due to invalid IL or missing references) //IL_0df0: Unknown result type (might be due to invalid IL or missing references) //IL_0df2: Unknown result type (might be due to invalid IL or missing references) //IL_0df4: Unknown result type (might be due to invalid IL or missing references) //IL_0dfc: Unknown result type (might be due to invalid IL or missing references) //IL_0e01: Unknown result type (might be due to invalid IL or missing references) //IL_09d4: Unknown result type (might be due to invalid IL or missing references) //IL_09d8: Unknown result type (might be due to invalid IL or missing references) //IL_09df: Unknown result type (might be due to invalid IL or missing references) //IL_09e4: Unknown result type (might be due to invalid IL or missing references) //IL_09e9: Unknown result type (might be due to invalid IL or missing references) //IL_1075: Unknown result type (might be due to invalid IL or missing references) //IL_107a: Unknown result type (might be due to invalid IL or missing references) //IL_107e: Unknown result type (might be due to invalid IL or missing references) //IL_1084: Invalid comparison between Unknown and I4 //IL_0ec0: Unknown result type (might be due to invalid IL or missing references) //IL_0eb4: Unknown result type (might be due to invalid IL or missing references) //IL_0eb6: Unknown result type (might be due to invalid IL or missing references) //IL_1096: Unknown result type (might be due to invalid IL or missing references) //IL_1098: Unknown result type (might be due to invalid IL or missing references) //IL_1089: Unknown result type (might be due to invalid IL or missing references) //IL_0ec2: Unknown result type (might be due to invalid IL or missing references) //IL_109d: Unknown result type (might be due to invalid IL or missing references) //IL_10a1: Unknown result type (might be due to invalid IL or missing references) //IL_10a6: Unknown result type (might be due to invalid IL or missing references) //IL_10af: Unknown result type (might be due to invalid IL or missing references) //IL_10b4: Unknown result type (might be due to invalid IL or missing references) //IL_10b9: Unknown result type (might be due to invalid IL or missing references) //IL_10bb: Unknown result type (might be due to invalid IL or missing references) //IL_10bd: Unknown result type (might be due to invalid IL or missing references) //IL_10bf: Unknown result type (might be due to invalid IL or missing references) //IL_10c6: Unknown result type (might be due to invalid IL or missing references) //IL_10c8: Unknown result type (might be due to invalid IL or missing references) //IL_10cd: Unknown result type (might be due to invalid IL or missing references) //IL_10d2: Unknown result type (might be due to invalid IL or missing references) //IL_0edd: Unknown result type (might be due to invalid IL or missing references) //IL_0ed1: Unknown result type (might be due to invalid IL or missing references) //IL_0ed3: Unknown result type (might be due to invalid IL or missing references) //IL_111a: Unknown result type (might be due to invalid IL or missing references) //IL_111c: Unknown result type (might be due to invalid IL or missing references) //IL_111e: Unknown result type (might be due to invalid IL or missing references) //IL_1120: Unknown result type (might be due to invalid IL or missing references) //IL_1125: Unknown result type (might be due to invalid IL or missing references) //IL_112a: Unknown result type (might be due to invalid IL or missing references) //IL_1156: Unknown result type (might be due to invalid IL or missing references) //IL_115a: Unknown result type (might be due to invalid IL or missing references) //IL_115f: Unknown result type (might be due to invalid IL or missing references) //IL_1164: Unknown result type (might be due to invalid IL or missing references) //IL_1169: Unknown result type (might be due to invalid IL or missing references) //IL_117a: Unknown result type (might be due to invalid IL or missing references) //IL_10e5: Unknown result type (might be due to invalid IL or missing references) //IL_0edf: Unknown result type (might be due to invalid IL or missing references) //IL_1107: Unknown result type (might be due to invalid IL or missing references) //IL_10fd: Unknown result type (might be due to invalid IL or missing references) //IL_0efe: Unknown result type (might be due to invalid IL or missing references) //IL_0f07: Unknown result type (might be due to invalid IL or missing references) //IL_0f0c: Unknown result type (might be due to invalid IL or missing references) //IL_0f11: Unknown result type (might be due to invalid IL or missing references) //IL_110c: Unknown result type (might be due to invalid IL or missing references) //IL_1111: Unknown result type (might be due to invalid IL or missing references) //IL_0f29: Unknown result type (might be due to invalid IL or missing references) //IL_0f2d: Unknown result type (might be due to invalid IL or missing references) //IL_0f32: Unknown result type (might be due to invalid IL or missing references) //IL_0f36: Unknown result type (might be due to invalid IL or missing references) //IL_1244: Unknown result type (might be due to invalid IL or missing references) //IL_1238: Unknown result type (might be due to invalid IL or missing references) //IL_123a: Unknown result type (might be due to invalid IL or missing references) //IL_1246: Unknown result type (might be due to invalid IL or missing references) //IL_1248: Unknown result type (might be due to invalid IL or missing references) //IL_1251: Unknown result type (might be due to invalid IL or missing references) //IL_1256: Unknown result type (might be due to invalid IL or missing references) //IL_1262: Unknown result type (might be due to invalid IL or missing references) //IL_1007: Unknown result type (might be due to invalid IL or missing references) //IL_100c: Unknown result type (might be due to invalid IL or missing references) //IL_103d: Unknown result type (might be due to invalid IL or missing references) //IL_1309: Unknown result type (might be due to invalid IL or missing references) //IL_130e: Unknown result type (might be due to invalid IL or missing references) //IL_1348: 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; bool flag5 = CompassEntries != null && CompassEntries.Length > 0; bool flag6 = RadialVelocities != null && RadialVelocities.Length > 0; bool flag7 = ConeEntries != null && ConeEntries.Length > 0; if (MaxCameraDistance > 0f && Application.isPlaying) { UpdateDistanceCull(); } if (!HasBeam && !flag3 && !flag4 && !flag5 && !flag6 && !flag7 && !flag && !flag2 && !HasMoveRelativeToEmitter && !HasAlignRotation && !HasDragCurve && !HasFacingFade && !HasUniformAccel && !HasPixelClamp && !FreeVelocityOrient) { return; } float num = Mathf.Max(CryEditClock.Dt, 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 val3 = ((Component)this).transform.rotation * _inverseShapeAim; Vector3 val4 = ((!HasBeam) ? Vector3.zero : (beamDestWorld - beamSourceWorld)); Camera val5 = ((!HasFacingFade && !HasPixelClamp && !FreeVelocityOrient) ? null : ResolveViewerCamera()); int num2; if (HasFacingFade || HasPixelClamp) { MainModule main = Ps.main; num2 = (((int)((MainModule)(ref main)).simulationSpace != 1) ? 1 : 0); } else { num2 = 0; } bool flag8 = (byte)num2 != 0; bool flag9 = false; float rotation = 0f; Camera val6 = ((!HasAlignRotation) ? null : ResolveViewerCamera()); if ((Object)(object)val6 != (Object)null) { Transform transform = ((Component)val6).transform; Vector3 val7 = _alignTargetWorldDir - Vector3.Dot(_alignTargetWorldDir, transform.forward) * transform.forward; if (((Vector3)(ref val7)).sqrMagnitude > 1E-06f) { float num3 = Vector3.Angle(transform.up, val7); float num4 = Mathf.Sign(Vector3.Dot(transform.forward, Vector3.Cross(transform.up, val7))); rotation = num3 * num4; flag9 = true; } } currentFrameSeeds.Clear(); for (int i = 0; i < particles; i++) { currentFrameSeeds.Add(((Particle)(ref buffer[i])).randomSeed); } int num5 = 0; if (HasBeam) { for (int j = 0; j < particles; j++) { if (!lastFrameSeeds.Contains(((Particle)(ref buffer[j])).randomSeed)) { num5++; } } } int num6 = 0; for (int k = 0; k < particles; k++) { bool flag10 = !lastFrameSeeds.Contains(((Particle)(ref buffer[k])).randomSeed); Vector3 val8 = ((Particle)(ref buffer[k])).position; Vector3 val9 = ((Particle)(ref buffer[k])).velocity; if (HasBeam && flag10) { float num7 = ((num5 <= 1) ? 0.5f : ((float)num6 / (float)(num5 - 1))); val8 = beamSourceWorld + val4 * num7; num6++; } if (flag3 && flag10) { float value = Random.value; for (int l = 0; l < LocationOffsets.Length; l++) { AnimationCurve val10 = ((_locationOffsetScaleCurves == null || l >= _locationOffsetScaleCurves.Length) ? null : _locationOffsetScaleCurves[l]); float num8 = ((val10 == null) ? Mathf.Lerp(LocationOffsets[l].ScaleMin, LocationOffsets[l].ScaleMax, value) : val10.Evaluate(value)); val8 += val3 * LocationOffsets[l].Direction * num8; } } if (flag4 && flag10) { for (int m = 0; m < VelocityExtras.Length; m++) { float value2 = Random.value; float value3 = Random.value; float value4 = Random.value; Vector3 val11 = val3 * RandomDirectionInCone(VelocityExtras[m].Direction, VelocityExtras[m].ConeAngleDeg, value2, value3); float num9 = Mathf.Lerp(VelocityExtras[m].SpeedMin, VelocityExtras[m].SpeedMax, value4); val9 += val11 * num9; } } if ((flag5 || flag6 || flag7) && flag10) { int num10 = Mathf.Max(1, SpawnCountHint); float sf = ((num10 <= 1) ? 0f : Mathf.Clamp01((float)(_spawnRank % num10) / (float)(num10 - 1))); _spawnRank++; Quaternion emitterRot = val3; if ((Object)(object)ParentFramePs != (Object)null && TryParentFrame(val8, ((Particle)(ref buffer[k])).startLifetime - ((Particle)(ref buffer[k])).remainingLifetime, out var q)) { emitterRot = q * val3; } float value5 = Random.value; if (flag5) { for (int n = 0; n < CompassEntries.Length; n++) { val9 += CompassVelocity(CompassEntries[n], n, sf, emitterRot, value5); } } if (flag6) { for (int num11 = 0; num11 < RadialVelocities.Length; num11++) { val9 += RadialVelocity(RadialVelocities[num11], num11, sf, emitterRot); } } if (flag7) { for (int num12 = 0; num12 < ConeEntries.Length; num12++) { val9 += ConeVelocity(ConeEntries[num12], num12, sf, emitterRot, value5); } } } Vector3 val12 = Vector3.zero; if (HasUniformAccel) { float num13 = 1f; if (UniformAccelCurve != null && UniformAccelCurve.length > 0) { float startLifetime = ((Particle)(ref buffer[k])).startLifetime; float num14 = ((!(startLifetime > 0f)) ? 0f : Mathf.Clamp01(1f - ((Particle)(ref buffer[k])).remainingLifetime / startLifetime)); num13 = UniformAccelCurve.Evaluate(num14); } val12 += UniformAccel * num13; } if (flag) { for (int num15 = 0; num15 < GravityEntries.Length; num15++) { GravityEntry gravityEntry = GravityEntries[num15]; Vector3 val13 = ((!((Object)(object)gravityEntry.Target != (Object)null)) ? ((Component)this).transform.position : gravityEntry.Target.position); Vector3 val14 = ((!(((Vector3)(ref gravityEntry.Axis)).sqrMagnitude > 1E-06f)) ? Vector3.up : ((Vector3)(ref gravityEntry.Axis)).normalized); Vector3 val15 = val3 * val14; float num16 = ((!(gravityEntry.Decay > 0f)) ? 0f : (1f / (gravityEntry.Decay * gravityEntry.Decay))); Vector3 val17; if (gravityEntry.UseAxis) { Vector3 val16 = val8 - val13; val17 = val13 + val15 * Vector3.Dot(val15, val16) - val8; } else { val17 = val13 - val8; } float sqrMagnitude = ((Vector3)(ref val17)).sqrMagnitude; if (sqrMagnitude > 1E-08f) { float num17 = gravityEntry.Accel / (1f + num16 * sqrMagnitude); val12 += ((Vector3)(ref val17)).normalized * num17; } } } float num18 = 0f; Vector3 val18 = Vector3.zero; float num19 = 0f; if (flag2) { for (int num20 = 0; num20 < VortexEntries.Length; num20++) { VortexEntry vortexEntry = VortexEntries[num20]; Vector3 val19 = ((!((Object)(object)vortexEntry.Target != (Object)null)) ? ((Component)this).transform.position : vortexEntry.Target.position); Vector3 val20 = ((!(((Vector3)(ref vortexEntry.Axis)).sqrMagnitude > 1E-06f)) ? Vector3.up : ((Vector3)(ref vortexEntry.Axis)).normalized); Vector3 val21 = val3 * val20; float num21 = ((!(vortexEntry.Decay > 0f)) ? 0f : (1f / (vortexEntry.Decay * vortexEntry.Decay))); Vector3 val22 = val8 - val19; Vector3 val23 = val19 + val21 * Vector3.Dot(val21, val22) - val8; float sqrMagnitude2 = ((Vector3)(ref val23)).sqrMagnitude; if (sqrMagnitude2 > 1E-08f) { float num22 = vortexEntry.Speed / (1f + num21 * sqrMagnitude2); val18 += Vector3.Cross(((Vector3)(ref val23)).normalized, val21) * num22; if (vortexEntry.Drag > num19) { num19 = vortexEntry.Drag; } } } } if (HasDragCurve && DragCurve != null) { float startLifetime2 = ((Particle)(ref buffer[k])).startLifetime; float num23 = ((!(startLifetime2 > 0f)) ? 0f : Mathf.Clamp01(1f - ((Particle)(ref buffer[k])).remainingLifetime / startLifetime2)); num18 = DragCurve.Evaluate(num23); if (HasDragRandom && DragRandomMax > DragRandomMin) { num18 *= Mathf.Lerp(DragRandomMin, DragRandomMax, Hash01(((Particle)(ref buffer[k])).randomSeed)); } } else if (flag && HasGravityDrag) { num18 = GravityDrag; } else if (flag2) { num18 = num19; } if (num18 > 0f || ((Vector3)(ref val12)).sqrMagnitude > 0f) { Vector3 val24 = val9; Vector3 val25 = val12 + (val18 - val24) * num18; float num24 = num18 * num; float num26; float num27; if (num24 > 1E-06f) { float num25 = Mathf.Exp(0f - num24); num26 = (1f - num25) / num24; num27 = (num24 - 1f + num25) / (num24 * num24); } else { num26 = 1f - 0.5f * num24; num27 = 0.5f - num24 / 6f; } val9 = val24 + val25 * (num * num26); val8 = ((!UnityUsesNewVelocityForPosition) ? (val8 + val25 * (num * num27 * num)) : (val8 + ((val24 - val9) * num + val25 * (num * num27 * num)))); } if (HasMoveRelativeToEmitter && (Object)(object)MoveRelEmitter != (Object)null && !flag10) { if (MoveRelPositionInherit > 0f) { Vector3 val26 = val2 * (val8 - lastEmitterPos) + val; val8 = Vector3.Lerp(val8, val26, MoveRelPositionInherit); } if (MoveRelVelocityInherit > 0f) { Vector3 val27 = val2 * val9; val9 = Vector3.Lerp(val9, val27, MoveRelVelocityInherit); } } if (flag9) { ((Particle)(ref buffer[k])).rotation = rotation; } if (HasFacingFade && (Object)(object)val5 != (Object)null) { uint randomSeed = ((Particle)(ref buffer[k])).randomSeed; if (!_facingBase.TryGetValue(randomSeed, out var value6)) { ((Vector2)(ref value6))..ctor(((Particle)(ref buffer[k])).startSize, (float)(int)((Particle)(ref buffer[k])).startColor.a); _facingBase[randomSeed] = value6; } Vector3 val28 = ((!flag8) ? val9 : ((Component)this).transform.TransformDirection(val9)); Vector3 val29 = ((!flag8) ? val8 : ((Component)this).transform.TransformPoint(val8)); float magnitude = ((Vector3)(ref val28)).magnitude; float num28 = 1f; if (magnitude > 0.001f) { Vector3 val30 = val29 - ((Component)val5).transform.position; float magnitude2 = ((Vector3)(ref val30)).magnitude; if (magnitude2 > 0.0001f) { float num29 = Mathf.Abs(Vector3.Dot(val28 / magnitude, val30 / magnitude2)); num28 = Mathf.Sqrt(Mathf.Max(0f, 1f - num29 * num29)); } } float num30 = ((FacingSizeCurve == null || FacingSizeCurve.length <= 0) ? 1f : Mathf.Max(0f, FacingSizeCurve.Evaluate(num28))); float num31 = ((FacingOpacityCurve == null || FacingOpacityCurve.length <= 0) ? 1f : Mathf.Clamp01(FacingOpacityCurve.Evaluate(num28))); ((Particle)(ref buffer[k])).startSize = value6.x * num30; Color32 startColor = ((Particle)(ref buffer[k])).startColor; startColor.a = (byte)Mathf.Clamp(Mathf.RoundToInt(value6.y * num31), 0, 255); ((Particle)(ref buffer[k])).startColor = startColor; } if (FreeVelocityOrient && (Object)(object)val5 != (Object)null && ((Vector3)(ref val9)).sqrMagnitude > 1E-06f) { MainModule main2 = Ps.main; Vector3 val31 = (((int)((MainModule)(ref main2)).simulationSpace != 1) ? ((Component)this).transform.TransformDirection(val9) : val9); Vector3 normalized = ((Vector3)(ref val31)).normalized; Vector3 val32 = -((Component)val5).transform.forward; Vector3 val33 = val32 - Vector3.Dot(val32, normalized) * normalized; if (((Vector3)(ref val33)).sqrMagnitude < 1E-06f) { val33 = Vector3.Cross(normalized, (!(Mathf.Abs(normalized.y) < 0.9f)) ? Vector3.right : Vector3.up); } ((Vector3)(ref val33)).Normalize(); Quaternion val34 = Quaternion.LookRotation(val33, Vector3.Cross(val33, normalized)); float num32 = Mathf.Lerp(FreeTwistMinDeg, FreeTwistMaxDeg, Hash01(((Particle)(ref buffer[k])).randomSeed)); val34 *= Quaternion.AngleAxis(num32, Vector3.forward); ((Particle)(ref buffer[k])).rotation3D = ((Quaternion)(ref val34)).eulerAngles; } ((Particle)(ref buffer[k])).position = val8; ((Particle)(ref buffer[k])).velocity = val9; if (!HasPixelClamp || !((Object)(object)val5 != (Object)null)) { continue; } float num33 = ((!(PixelSizeMin > 0f)) ? 4f : PixelSizeMin); float num34 = Screen.height; float num35 = ((!(num34 > 1f)) ? 0f : (val5.fieldOfView * ((float)Math.PI / 180f) / num34 * 0.5f)); if (!(num35 > 1E-09f)) { continue; } Vector3 val35 = ((!flag8) ? val8 : ((Component)this).transform.TransformPoint(val8)); float num36 = Vector3.Dot(val35 - ((Component)val5).transform.position, ((Component)val5).transform.forward); if (num36 > 0.0001f) { float num37 = ((Particle)(ref buffer[k])).startSize / (num36 * num35); float num38 = num37; if (num38 < num33) { num38 = num33; } if (!PixelSizeMaxInfinite && PixelSizeMax > 0f && num38 > PixelSizeMax) { num38 = PixelSizeMax; } ((Particle)(ref buffer[k])).startSize = num38 * num36 * num35; if (PixelSizeAffectOpacity) { Color32 startColor2 = ((Particle)(ref buffer[k])).startColor; startColor2.a = (byte)Mathf.Clamp(Mathf.RoundToInt((float)(int)startColor2.a * Mathf.Clamp01(num37 / num33)), 0, 255); ((Particle)(ref buffer[k])).startColor = startColor2; } } } Ps.SetParticles(buffer, particles); if (HasFacingFade && _facingBase.Count > particles * 2 + 16) { _facingPrune.Clear(); foreach (KeyValuePair item in _facingBase) { if (!currentFrameSeeds.Contains(item.Key)) { _facingPrune.Add(item.Key); } } for (int num39 = 0; num39 < _facingPrune.Count; num39++) { _facingBase.Remove(_facingPrune[num39]); } } HashSet hashSet = lastFrameSeeds; lastFrameSeeds = currentFrameSeeds; currentFrameSeeds = hashSet; } else { lastFrameSeeds.Clear(); } if (HasMoveRelativeToEmitter && (Object)(object)MoveRelEmitter != (Object)null) { lastEmitterPos = val; lastEmitterRot = MoveRelEmitter.rotation; } } private void UpdateDistanceCull() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_cullRenderer == (Object)null) { _cullRenderer = ((Component)this).GetComponent(); } if (!((Object)(object)_cullRenderer == (Object)null)) { Camera val = ResolveViewerCamera(); if (!((Object)(object)val == (Object)null)) { Vector3 val2 = ((Component)val).transform.position - ((Component)this).transform.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; ((Renderer)_cullRenderer).enabled = sqrMagnitude <= MaxCameraDistance * MaxCameraDistance; } } } private static Camera ResolveViewerCamera() { if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled) { return s_viewerCamera; } s_viewerCamera = Camera.main; if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled) { return s_viewerCamera; } s_viewerCamera = Camera.current; if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled) { return s_viewerCamera; } Camera[] allCameras = Camera.allCameras; s_viewerCamera = ((allCameras == null || allCameras.Length <= 0) ? null : allCameras[0]); return s_viewerCamera; } 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 float Hash01(uint seed) { uint num = seed * 2654435761u; num ^= num >> 15; num *= 2246822519u; num ^= num >> 13; return (float)(num & 0xFFFFFF) / 16777216f; } private static LinearCurve ParseLinearCurve(string keys) { return (!string.IsNullOrEmpty(keys)) ? new LinearCurve(keys) : null; } private static float EvalOrOne(LinearCurve c, float x) { return c?.Evaluate(x) ?? 1f; } private void BuildSpawnVelocityCurves() { _spawnRank = 0; if (CompassEntries != null) { _compassPolar = new LinearCurve[CompassEntries.Length]; _compassAzimuth = new LinearCurve[CompassEntries.Length]; _compassSpeed = new LinearCurve[CompassEntries.Length]; _compassSpeedRand = new LinearCurve[CompassEntries.Length]; _compassConeSF = new LinearCurve[CompassEntries.Length]; _compassConeRand = new LinearCurve[CompassEntries.Length]; for (int i = 0; i < CompassEntries.Length; i++) { _compassConeSF[i] = ParseLinearCurve(CompassEntries[i].Cone.SFCurve); _compassConeRand[i] = ParseLinearCurve(CompassEntries[i].Cone.RandCurve); _compassPolar[i] = ParseLinearCurve(CompassEntries[i].PolarCurve); _compassAzimuth[i] = ParseLinearCurve(CompassEntries[i].AzimuthCurve); _compassSpeed[i] = ParseLinearCurve(CompassEntries[i].SpeedCurve); _compassSpeedRand[i] = ParseLinearCurve(CompassEntries[i].SpeedRandomCurve); } } if (ConeEntries != null) { _coneSF = new LinearCurve[ConeEntries.Length]; _coneRand = new LinearCurve[ConeEntries.Length]; _coneSpeed = new LinearCurve[ConeEntries.Length]; _coneSpeedRand = new LinearCurve[ConeEntries.Length]; for (int j = 0; j < ConeEntries.Length; j++) { _coneSF[j] = ParseLinearCurve(ConeEntries[j].Cone.SFCurve); _coneRand[j] = ParseLinearCurve(ConeEntries[j].Cone.RandCurve); _coneSpeed[j] = ParseLinearCurve(ConeEntries[j].SpeedCurve); _coneSpeedRand[j] = ParseLinearCurve(ConeEntries[j].SpeedRandomCurve); } } if (RadialVelocities != null) { _radialSpeed = new LinearCurve[RadialVelocities.Length]; for (int k = 0; k < RadialVelocities.Length; k++) { _radialSpeed[k] = ParseLinearCurve(RadialVelocities[k].SpeedCurve); } } } private Vector3 CompassVelocity(CompassEntry c, int index, float sf, Quaternion emitterRot, float rand01) { //IL_0096: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) float num = c.PolarBaseDeg * EvalOrOne((_compassPolar == null) ? null : _compassPolar[index], sf); float num2 = c.AzimuthBaseDeg * EvalOrOne((_compassAzimuth == null) ? null : _compassAzimuth[index], sf) + c.AzimuthOriginDeg; float num3 = (num + 90f) * ((float)Math.PI / 180f); float num4 = num2 * ((float)Math.PI / 180f); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Mathf.Cos(num4) * Mathf.Cos(num3), Mathf.Sin(num3), Mathf.Sin(num4) * Mathf.Cos(num3)); val = SampleCone(val, c.Cone, (_compassConeSF == null) ? null : _compassConeSF[index], (_compassConeRand == null) ? null : _compassConeRand[index], sf); float num5 = Mathf.Lerp(c.SpeedMin, c.SpeedMax, Random.value) * EvalOrOne((_compassSpeed == null) ? null : _compassSpeed[index], sf) * EvalOrOne((_compassSpeedRand == null) ? null : _compassSpeedRand[index], rand01); return emitterRot * val * num5; } private static Vector3 SampleCone(Vector3 axisWorld, ConeParams cone, LinearCurve sfCurve, LinearCurve randCurve, float sf) { //IL_001e: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_012f: 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_00d7: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) axisWorld = ((!(((Vector3)(ref axisWorld)).sqrMagnitude > 1E-10f)) ? Vector3.up : ((Vector3)(ref axisWorld)).normalized); float num = Mathf.Lerp(cone.AngleMin, cone.AngleMax, Random.value) * EvalOrOne(sfCurve, sf) * EvalOrOne(randCurve, Random.value); if (Mathf.Abs(num) < 0.001f) { return axisWorld; } float num2 = Mathf.Clamp01(cone.Inner); num *= Mathf.Sqrt(Mathf.Lerp(num2 * num2, 1f, Random.value)); float num3 = num * ((float)Math.PI / 180f); float num4 = Random.value * 2f * (float)Math.PI; Vector3 val = Vector3.Cross(axisWorld, (!(Mathf.Abs(axisWorld.y) < 0.9f)) ? Vector3.right : Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = Vector3.Cross(axisWorld, normalized); return axisWorld * Mathf.Cos(num3) + (normalized * Mathf.Cos(num4) + val2 * Mathf.Sin(num4)) * Mathf.Sin(num3); } private Vector3 ConeVelocity(ConeEntry c, int index, float sf, Quaternion emitterRot, float rand01) { //IL_0001: 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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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) Vector3 val = SampleCone(emitterRot * c.Axis, c.Cone, (_coneSF == null) ? null : _coneSF[index], (_coneRand == null) ? null : _coneRand[index], sf); float num = Mathf.Lerp(c.SpeedMin, c.SpeedMax, Random.value) * EvalOrOne((_coneSpeed == null) ? null : _coneSpeed[index], sf) * EvalOrOne((_coneSpeedRand == null) ? null : _coneSpeedRand[index], rand01); return val * num; } private Vector3 RadialVelocity(RadialVelocityEntry r, int index, float sf, Quaternion emitterRot) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00a6: 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_00cb: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(r.InnerFraction); Vector3 val; if (r.Sphere) { float num2 = 1f - 2f * Random.value; float num3 = Mathf.Sqrt(Mathf.Max(0f, 1f - num2 * num2)); float num4 = Random.value * 2f * (float)Math.PI; float num5 = Mathf.Pow(Mathf.Lerp(num * num * num, 1f, Random.value), 1f / 3f); val = new Vector3(num3 * Mathf.Cos(num4), num2, num3 * Mathf.Sin(num4)) * num5; val = Vector3.Scale(val, r.Scale); } else { Vector3 val2 = ((!(((Vector3)(ref r.Axis)).sqrMagnitude > 1E-06f)) ? Vector3.up : ((Vector3)(ref r.Axis)).normalized); Vector3 val3 = Vector3.Cross(val2, (!(Mathf.Abs(val2.y) < 0.9f)) ? Vector3.right : Vector3.up); Vector3 normalized = ((Vector3)(ref val3)).normalized; Vector3 val4 = Vector3.Cross(val2, normalized); float num6 = Mathf.Sqrt(Mathf.Lerp(num * num, 1f, Random.value)); float num7 = Random.value * 2f * (float)Math.PI; val = (normalized * (Mathf.Cos(num7) * r.Scale.x) + val4 * (Mathf.Sin(num7) * r.Scale.y)) * num6; } float num8 = Mathf.Lerp(r.SpeedMin, r.SpeedMax, Random.value) * EvalOrOne((_radialSpeed == null) ? null : _radialSpeed[index], sf); return emitterRot * val * num8; } 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 static class CryEditClock { private static int s_frame; private static float s_dt = 0.016f; private static double s_now; private static double s_last; public static int Frame => (!Application.isPlaying) ? s_frame : Time.frameCount; public static float Dt => (!Application.isPlaying) ? s_dt : Time.deltaTime; public static float Now => (!Application.isPlaying) ? ((float)s_now) : Time.time; public static void Advance(double t) { if (t - s_last > 0.002) { s_frame++; s_dt = Mathf.Clamp((float)(t - s_last), 0.0001f, 0.1f); s_last = t; s_now = t; } } } public class PlayOnEnable : MonoBehaviour { public ParticleSystem Ps; private void Awake() { if ((Object)(object)Ps == (Object)null) { Ps = ((Component)this).GetComponent(); } } private void OnEnable() { if (Application.isPlaying && (Object)(object)Ps != (Object)null) { Ps.Play(); } } } 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.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(); 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); } } } namespace BitWizrd.Revolver.Schofield { public class Schofield : BreakActionWeapon { [Header("Break Action Setup")] public bool foregripLatch; [Tooltip("How far the latch rotates when clicking")] public float LatchClickRot = 15f; private float m_latchClickLerp = 0f; [Header("Ejector Setup")] [Tooltip("Speed at which the ejector moves")] public float EjectorSpeed = 1f; [Tooltip("Minimum velocity required for automatic ejection")] public float MinEjectVelocity = 10f; [Tooltip("Velocity range for force multiplier calculation (relative to min velocity)")] public float EjectForceRange = 40f; [Tooltip("Minimum force multiplier for ejection (at min velocity)")] public float MinEjectForce = 0.05f; [Tooltip("Maximum force multiplier for ejection (at max velocity)")] public float MaxEjectForce = 0.8f; [Tooltip("Angle at which the ejector starts moving up")] public float EjectorStartAngle = 45f; [Tooltip("Angle at which the extractor reaches maximum travel")] public float EjectorMaxAngle = 60f; [Header("Revolver Mechanics")] public Transform RevolverMuzzle; public Transform Hammer; public Transform Trigger; [Header("Revolver Speeds")] [Tooltip("Speed of normal hammer cocking")] public float NormalCockSpeed = 5f; [Tooltip("Speed of hammer cocking when fanning")] public float FanCockSpeed = 10f; [Tooltip("Speed of cylinder rotation after cocking")] public float CylinderRotSpeed = 16f; [Tooltip("Speed of spin recovery")] public float SpinRecoverySpeed = 500f; [Tooltip("Speed of spin damping")] public float SpinDampingSpeed = 0.6f; [Tooltip("Trigger rotates on X-axis.")] public float Trigger_Rot_Forward = 0f; public float Trigger_Rot_Rearward = 25f; private bool hasTriggeredUpSinceBegin = false; private bool hasLatchButtonUpSinceBegin = false; private bool hasForegripUpSinceBegin = false; [Tooltip("Revolver hammer angles (X-axis).")] public float Hammer_Rot_Uncocked = 0f; public float Hammer_Rot_Cocked = 30f; public float Hammer_Rot_Halfcock = 15f; [Tooltip("Trigger threshold to fire.")] public float TriggerThreshold = 0.9f; [Header("Cylinder Mechanics (Classic Single-Action)")] public SingleActionRevolverCylinder Cylinder; public bool DoesHalfCockHalfRotCylinder; public bool HasTransferBarSafety; [Header("Optional Spin Feature")] public Transform PoseSpinHolder; public bool CanSpin = true; [Tooltip("Allows revolve gate toggling (half-cock).")] public bool StateToggles = true; [Header("Fanning")] public bool CanFan = true; public Transform HammerFanDir; public float FanDistance = 0.15f; public float FanAngle = 60f; public float FanVelocityThreshold = 1f; [Header("Foregrip Reference")] public SchofieldForegrip ForegripRef; [Tooltip("Force applied to close the gun when using foregrip")] public float ForegripCloseForce = 5f; private bool _inputsBlocked = false; private bool m_isBreakOpen; private bool m_hasEjectedThisOpen; private bool m_isHammerCocked; private bool m_isHammerCocking; private float m_hammerCockLerp; private float m_hammerCockSpeed = 10f; private int m_curChamber; private float m_curChamberLerp; private float m_tarChamberLerp; private float timeSinceColFire = 999f; private bool m_isSpinning; private float xSpinRot; private float xSpinVel; public bool TriggerReset = true; private float prevTriggerFloat = 0f; private bool m_isStateToggled = false; private bool m_hasPassedSnapPoint = false; private bool m_wasMovingForward = true; private float m_snapAngle = 0f; private GameObject m_hingeGO; private Transform m_hingeOriginalParent; private Rigidbody m_hingeRB; private float m_cachedMass; private float m_cachedDrag; private float m_cachedAngularDrag; private bool m_cachedUseGravity; private RigidbodyInterpolation m_cachedInterpolation; private CollisionDetectionMode m_cachedCollisionDetection; private RigidbodyConstraints m_cachedConstraints; private Vector3 m_cachedAxis; private Vector3 m_cachedAnchor; private Vector3 m_cachedConnectedAnchor; private Rigidbody m_cachedConnectedBody; private JointLimits m_cachedLimits; private bool m_cachedUseSpring; private JointSpring m_cachedSpring; private bool m_cachedUseMotor; private JointMotor m_cachedMotor; private Vector3 m_weldedLocalPos; private Quaternion m_weldedLocalRot; private bool m_needsPreciseSnap; private bool m_initialized; private bool m_isLatchHeldOpen = false; private bool m_prevShouldLatchBeOpen = false; public bool IsBreakOpen => m_isBreakOpen; public int CurChamber { get { return m_curChamber; } set { m_curChamber = value % Cylinder.NumChambers; } } public int PrevChamber { get { int num = m_curChamber - 1; return (num >= 0) ? num : (Cylinder.NumChambers - 1); } } public int PrevChamber2 { get { int num = m_curChamber - 2; return (num >= 0) ? num : (Cylinder.NumChambers + num); } } public override void Awake() { //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) ((BreakActionWeapon)this).Awake(); ((BreakActionWeapon)this).SetHasLatchButton(false); ((BreakActionWeapon)this).SetEjectOnOpen(false); if ((Object)(object)base.Hinge == (Object)null) { Debug.LogError((object)string.Concat(new string[3] { "[Schofield] CRITICAL: HingeJoint is not assigned on ", ((Object)((Component)this).gameObject).name, ". Weapon will not function correctly. Please assign the Hinge field in the Inspector." })); } ((FVRFireArm)this).FChambers = new List(); if ((Object)(object)Cylinder != (Object)null && Cylinder.Chambers != null) { FVRFireArmChamber[] chambers = Cylinder.Chambers; foreach (FVRFireArmChamber val in chambers) { if ((Object)(object)val != (Object)null) { val.Firearm = (FVRFireArm)(object)this; ((FVRFireArm)this).FChambers.Add(val); } } } m_isBreakOpen = false; m_hasEjectedThisOpen = false; ((BreakActionWeapon)this).SetIsExternallyUnlatched(false); if ((Object)(object)base.Hinge != (Object)null) { m_hingeGO = ((Component)base.Hinge).gameObject; m_hingeRB = m_hingeGO.GetComponent(); m_hingeOriginalParent = m_hingeGO.transform.parent; m_cachedMass = m_hingeRB.mass; m_cachedDrag = m_hingeRB.drag; m_cachedAngularDrag = m_hingeRB.angularDrag; m_cachedUseGravity = m_hingeRB.useGravity; m_cachedInterpolation = m_hingeRB.interpolation; m_cachedCollisionDetection = m_hingeRB.collisionDetectionMode; m_cachedConstraints = m_hingeRB.constraints; m_cachedAxis = ((Joint)base.Hinge).axis; m_cachedAnchor = ((Joint)base.Hinge).anchor; m_cachedConnectedAnchor = ((Joint)base.Hinge).connectedAnchor; m_cachedConnectedBody = ((Joint)base.Hinge).connectedBody; m_cachedLimits = base.Hinge.limits; m_cachedUseSpring = base.Hinge.useSpring; m_cachedSpring = base.Hinge.spring; m_cachedUseMotor = base.Hinge.useMotor; m_cachedMotor = base.Hinge.motor; m_weldedLocalPos = ((Component)this).transform.InverseTransformPoint(m_hingeGO.transform.position); m_weldedLocalRot = Quaternion.Inverse(((Component)this).transform.rotation) * m_hingeGO.transform.rotation; } } private void WeldBarrel() { //IL_002f: 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_007b: 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) if (!((Object)(object)m_hingeGO == (Object)null)) { if ((Object)(object)m_hingeRB != (Object)null) { m_hingeRB.velocity = Vector3.zero; m_hingeRB.angularVelocity = Vector3.zero; } if ((Object)(object)base.Hinge != (Object)null) { Object.Destroy((Object)(object)base.Hinge); base.Hinge = null; } m_hingeGO.transform.localPosition = base.m_foreStartPos; m_hingeGO.transform.localEulerAngles = Vector3.zero; if ((Object)(object)m_hingeRB != (Object)null) { Object.Destroy((Object)(object)m_hingeRB); m_hingeRB = null; } m_hingeGO.transform.SetParent(((Component)this).transform, true); m_needsPreciseSnap = true; } } private void SeparateBarrel() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00cc: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)m_hingeGO == (Object)null)) { m_hingeGO.transform.SetParent(m_hingeOriginalParent, true); m_hingeRB = m_hingeGO.AddComponent(); m_hingeRB.mass = m_cachedMass; m_hingeRB.drag = m_cachedDrag; m_hingeRB.angularDrag = m_cachedAngularDrag; m_hingeRB.useGravity = m_cachedUseGravity; m_hingeRB.interpolation = m_cachedInterpolation; m_hingeRB.collisionDetectionMode = m_cachedCollisionDetection; m_hingeRB.constraints = m_cachedConstraints; m_hingeRB.velocity = Vector3.zero; m_hingeRB.angularVelocity = Vector3.zero; HingeJoint val = m_hingeGO.AddComponent(); ((Joint)val).axis = m_cachedAxis; ((Joint)val).anchor = m_cachedAnchor; ((Joint)val).autoConfigureConnectedAnchor = false; ((Joint)val).connectedAnchor = m_cachedConnectedAnchor; ((Joint)val).connectedBody = m_cachedConnectedBody; val.useLimits = true; JointLimits cachedLimits = m_cachedLimits; ((JointLimits)(ref cachedLimits)).max = base.HingeLimit; val.limits = cachedLimits; val.useSpring = m_cachedUseSpring; if (m_cachedUseSpring) { val.spring = m_cachedSpring; } val.useMotor = m_cachedUseMotor; if (m_cachedUseMotor) { val.motor = m_cachedMotor; } base.Hinge = val; if ((Object)(object)ForegripRef != (Object)null) { ForegripRef.RefreshHinge(val); } } } public override void BeginInteraction(FVRViveHand hand) { ((FVRFireArm)this).BeginInteraction(hand); if ((Object)(object)hand != (Object)null) { hasTriggeredUpSinceBegin = hand.Input.TriggerFloat <= 0.45f; hasLatchButtonUpSinceBegin = !hand.Input.TouchpadPressed && !hand.Input.BYButtonPressed; hasForegripUpSinceBegin = !foregripLatch; } else { hasTriggeredUpSinceBegin = false; hasLatchButtonUpSinceBegin = false; hasForegripUpSinceBegin = false; } } public override Transform GetMuzzle() { return RevolverMuzzle; } private void HandleRevolverFire() { //IL_0125: Unknown result type (might be due to invalid IL or missing references) if (m_isBreakOpen) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); return; } if ((Object)(object)Cylinder == (Object)null || Cylinder.Chambers == null || Cylinder.NumChambers == 0) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); return; } FVRFireArmChamber val = Cylinder.Chambers[m_curChamber]; if ((Object)(object)val == (Object)null || !val.IsFull || val.IsSpent || (Object)(object)val.GetRound() == (Object)null) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); return; } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); if (val.Fire()) { ((FVRFireArm)this).Fire(val, ((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(val.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { val.IsSpent = false; val.UpdateProxyDisplay(); } } } private void UpdateTriggerLogic() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) float num = ((!((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)) ? 0f : ((FVRInteractiveObject)this).m_hand.Input.TriggerFloat); if ((Object)(object)Trigger != (Object)null) { Trigger.localEulerAngles = new Vector3(Mathf.Lerp(Trigger_Rot_Forward, Trigger_Rot_Rearward, num), 0f, 0f); } if (num <= 0.45f) { hasTriggeredUpSinceBegin = true; TriggerReset = true; } float num2 = ((!hasTriggeredUpSinceBegin) ? 0f : num); if (num2 > TriggerThreshold && !m_isBreakOpen && m_isHammerCocked) { m_isHammerCocked = false; m_isHammerCocking = false; m_hammerCockLerp = 0f; HandleRevolverFire(); } } public override void OnCollisionEnter(Collision col) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).OnCollisionEnter(col); if (!HasTransferBarSafety && (Object)(object)col.collider.attachedRigidbody == (Object)null && Cylinder.Chambers[m_curChamber].IsFull && !Cylinder.Chambers[m_curChamber].IsSpent && !m_isHammerCocked && !m_isHammerCocking && !m_isStateToggled) { Vector3 relativeVelocity = col.relativeVelocity; if (((Vector3)(ref relativeVelocity)).magnitude > 2f) { HandleRevolverFire(); } } } public override void FVRUpdate() { //IL_002a: 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_00e3: Unknown result type (might be due to invalid IL or missing references) if (m_needsPreciseSnap && (Object)(object)m_hingeGO != (Object)null) { m_hingeGO.transform.localPosition = m_weldedLocalPos; m_hingeGO.transform.localRotation = m_weldedLocalRot; m_needsPreciseSnap = false; } ((FVRFireArm)this).FVRUpdate(); UpdateHammerShared(); UpdateFanning(); UpdateSpinning(); UpdateTriggerLogic(); UpdateCylinderRot(); UpdateEjector(); if (m_latchClickLerp > 0f) { m_latchClickLerp -= Time.deltaTime * 10f; if (m_latchClickLerp < 0f) { m_latchClickLerp = 0f; } float num = Mathf.Sin(m_latchClickLerp * (float)Math.PI) * LatchClickRot; ((FVRPhysicalObject)this).SetAnimatedComponent(base.Latch, num, (InterpStyle)1, base.LatchAxis); } } public override void FVRFixedUpdate() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (!m_initialized) { m_initialized = true; if (!m_isBreakOpen) { WeldBarrel(); } } if (base.m_isLatched && (Object)(object)base.Hinge == (Object)null && (Mathf.Abs(base.m_latchRot) > 5f || base.m_isExternallyUnlatched)) { SeparateBarrel(); m_isBreakOpen = true; } if (m_isBreakOpen && (Object)(object)base.Hinge != (Object)null && Mathf.Abs(((Component)base.Hinge).transform.localEulerAngles.x) <= 5f && !m_isLatchHeldOpen && !base.IsLatchHeldOpen) { ForceGunClosed(); } if ((Object)(object)base.Hinge == (Object)null) { base.m_isLatched = true; base.m_latchRot = 0f; base.m_isExternallyUnlatched = false; base.IsLatchHeldOpen = false; } ((BreakActionWeapon)this).FVRFixedUpdate(); } private void ForceGunClosed() { if (m_isBreakOpen) { BreakClose(); } } public override void UpdateInteraction(FVRViveHand hand) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_019c: 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) if ((Object)(object)hand == (Object)null) { return; } if (hand.Input.TriggerFloat <= 0.45f) { hasTriggeredUpSinceBegin = true; } if (!hand.Input.TouchpadPressed && !hand.Input.BYButtonPressed) { hasLatchButtonUpSinceBegin = true; } if (!foregripLatch) { hasForegripUpSinceBegin = true; } bool isLatchHeldOpen = m_isLatchHeldOpen; Vector2 touchpadAxes = hand.Input.TouchpadAxes; bool flag = false; flag = ((!hand.IsInStreamlinedMode) ? (hand.Input.TouchpadPressed && hasLatchButtonUpSinceBegin && touchpadAxes.y > 0.1f) : (hand.Input.BYButtonPressed && hasLatchButtonUpSinceBegin)); bool flag2 = foregripLatch && hasForegripUpSinceBegin; bool flag3 = flag || flag2; if (flag3 != m_isLatchHeldOpen) { m_isLatchHeldOpen = flag3; ((BreakActionWeapon)this).SetIsExternallyUnlatched(flag3); ((FVRPhysicalObject)this).SetAnimatedComponent(base.Latch, (!flag3) ? 0f : base.MaxRotExtent, (InterpStyle)1, base.LatchAxis); } if (flag3 != m_prevShouldLatchBeOpen) { if (flag3 && !m_isBreakOpen) { BreakOpen(); } else if (!flag3 && m_isBreakOpen && (Object)(object)base.Hinge != (Object)null && ((Component)base.Hinge).transform.localEulerAngles.x <= 1f) { BreakClose(); if (!flag3) { m_latchClickLerp = 1f; } } } m_prevShouldLatchBeOpen = flag3; if (hand.IsInStreamlinedMode) { if (hand.Input.AXButtonDown && !m_isBreakOpen && !m_isHammerCocked && !m_isHammerCocking) { CockHammer(NormalCockSpeed); } return; } if (hand.Input.TouchpadPressed && hasLatchButtonUpSinceBegin && hand.Input.TouchpadDown && touchpadAxes.y < -0.1f && !m_isBreakOpen && !m_isHammerCocked && !m_isHammerCocking) { CockHammer(NormalCockSpeed); } if (hand.Input.TouchpadDown) { float num = Vector2.Angle(touchpadAxes, Vector2.up); if (num < 45f && !m_isBreakOpen) { m_isSpinning = true; } } } public override void EndInteraction(FVRViveHand hand) { //IL_0024: 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) ((BreakActionWeapon)this).EndInteraction(hand); m_isLatchHeldOpen = false; ((BreakActionWeapon)this).SetIsExternallyUnlatched(false); ((FVRPhysicalObject)this).SetAnimatedComponent(base.Latch, 0f, (InterpStyle)1, base.LatchAxis); if (m_isSpinning && (Object)(object)PoseSpinHolder != (Object)null && (Object)(object)hand != (Object)null) { ((FVRPhysicalObject)this).RootRigidbody.AddRelativeTorque(new Vector3(xSpinVel, 0f, 0f), (ForceMode)1); } m_isSpinning = false; } private void UpdateHammerShared() { //IL_0159: Unknown result type (might be due to invalid IL or missing references) if (m_isHammerCocking) { if (m_hammerCockLerp < 1f) { m_hammerCockLerp += Time.deltaTime * m_hammerCockSpeed; } else { m_hammerCockLerp = 1f; m_isHammerCocking = false; m_isHammerCocked = true; if ((Object)(object)Cylinder != (Object)null && Cylinder.Chambers != null) { m_curChamber++; if (m_curChamber >= Cylinder.NumChambers) { m_curChamber = 0; } m_curChamberLerp = 0f; m_tarChamberLerp = 0f; } } } if (m_isBreakOpen && !m_isHammerCocking && !m_isHammerCocked) { float num = Hammer_Rot_Cocked - Hammer_Rot_Uncocked; if (Mathf.Abs(num) > 0.001f) { float num2 = (Hammer_Rot_Halfcock - Hammer_Rot_Uncocked) / num; num2 = Mathf.Clamp01(num2); m_hammerCockLerp = num2; } } if ((Object)(object)Hammer != (Object)null) { float num3 = Mathf.Lerp(Hammer_Rot_Uncocked, Hammer_Rot_Cocked, m_hammerCockLerp); Hammer.localEulerAngles = new Vector3(num3, 0f, 0f); } } private void UpdateFanning() { //IL_008f: 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_00a5: 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_00c7: 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) if (CanFan && ((FVRInteractiveObject)this).IsHeld && !((Object)(object)((FVRInteractiveObject)this).m_hand == (Object)null) && !((Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand == (Object)null) && !((Object)(object)HammerFanDir == (Object)null) && !m_isHammerCocked && !m_isHammerCocking && !m_isBreakOpen) { Vector3 velLinearWorld = ((FVRInteractiveObject)this).m_hand.OtherHand.Input.VelLinearWorld; float num = Vector3.Distance(((FVRInteractiveObject)this).m_hand.OtherHand.PalmTransform.position, HammerFanDir.position); if (num < FanDistance && Vector3.Angle(velLinearWorld, HammerFanDir.forward) < FanAngle && ((Vector3)(ref velLinearWorld)).magnitude > FanVelocityThreshold) { CockHammer(FanCockSpeed); } } } private void UpdateSpinning() { //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (!CanSpin || !((FVRInteractiveObject)this).IsHeld || (Object)(object)PoseSpinHolder == (Object)null) { return; } bool isSpinning = false; if (!m_isBreakOpen && (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null && !m_isHammerCocking && !m_isHammerCocked && !((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)this).m_hand.Input.TouchpadPressed) { Vector2 touchpadAxes = ((FVRInteractiveObject)this).m_hand.Input.TouchpadAxes; if (Vector2.Angle(touchpadAxes, Vector2.up) < 45f) { isSpinning = true; } } m_isSpinning = isSpinning; if (m_isSpinning) { Vector3 velLinearLocal = ((FVRInteractiveObject)this).m_hand.Input.VelLinearLocal; float num = Vector3.Dot(((Vector3)(ref velLinearLocal)).normalized, ((Component)this).transform.up); if (Mathf.Abs(xSpinVel) < 90f) { xSpinVel += num * Time.deltaTime * 600f; } else if (Mathf.Sign(num) == Mathf.Sign(xSpinVel)) { xSpinVel += num * Time.deltaTime * 600f; } xSpinVel = Mathf.Clamp(xSpinVel, -500f, 500f); xSpinRot += xSpinVel * Time.deltaTime * 5f; PoseSpinHolder.localEulerAngles = new Vector3(xSpinRot, 0f, 0f); } else { xSpinRot = 0f; xSpinVel = 0f; PoseSpinHolder.localRotation = Quaternion.RotateTowards(PoseSpinHolder.localRotation, Quaternion.identity, Time.deltaTime * SpinRecoverySpeed); PoseSpinHolder.localEulerAngles = new Vector3(PoseSpinHolder.localEulerAngles.x, 0f, 0f); } xSpinVel = Mathf.Lerp(xSpinVel, 0f, Time.deltaTime * SpinDampingSpeed); } private void UpdateCylinderRot() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) if (m_isBreakOpen) { for (int i = 0; i < Cylinder.Chambers.Length; i++) { Cylinder.Chambers[i].IsAccessible = true; } ((Component)Cylinder).transform.localRotation = Cylinder.GetLocalRotationFromCylinder(CurChamber); } else if (m_isStateToggled) { int prevChamber = PrevChamber; for (int j = 0; j < Cylinder.Chambers.Length; j++) { Cylinder.Chambers[j].IsAccessible = j == prevChamber; } if (DoesHalfCockHalfRotCylinder) { int num = (CurChamber + 1) % Cylinder.NumChambers; ((Component)Cylinder).transform.localRotation = Quaternion.Slerp(Cylinder.GetLocalRotationFromCylinder(CurChamber), Cylinder.GetLocalRotationFromCylinder(num), 0.5f); } else { ((Component)Cylinder).transform.localRotation = Cylinder.GetLocalRotationFromCylinder(CurChamber); } } else { for (int k = 0; k < Cylinder.Chambers.Length; k++) { Cylinder.Chambers[k].IsAccessible = false; } m_tarChamberLerp = ((!m_isHammerCocking) ? 0f : m_hammerCockLerp); m_curChamberLerp = Mathf.Lerp(m_curChamberLerp, m_tarChamberLerp, Time.deltaTime * CylinderRotSpeed); int num2 = (CurChamber + 1) % Cylinder.NumChambers; ((Component)Cylinder).transform.localRotation = Quaternion.Slerp(Cylinder.GetLocalRotationFromCylinder(CurChamber), Cylinder.GetLocalRotationFromCylinder(num2), m_curChamberLerp); } } private void CockHammer(float speed) { if (!m_isHammerCocked && !m_isHammerCocking) { m_hammerCockSpeed = speed; m_isHammerCocking = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); } } private void UpdateEjector() { if (!m_isBreakOpen || !base.m_hasEjector || (Object)(object)base.Ejector == (Object)null || (Object)(object)base.Hinge == (Object)null) { return; } float num = Mathf.Abs(base.Hinge.angle); float velocity = base.Hinge.velocity; bool flag = velocity > 0f; float num2 = velocity; bool flag2 = false; if ((Object)(object)ForegripRef != (Object)null && (Object)(object)((FVRInteractiveObject)ForegripRef).m_hand != (Object)null && ((FVRInteractiveObject)ForegripRef).IsHeld) { float magnitude = ((Vector3)(ref ((FVRInteractiveObject)ForegripRef).m_hand.Input.VelLinearWorld)).magnitude; if (magnitude < velocity) { num2 = magnitude; flag2 = true; } } if (num >= base.HingeEjectLimit && flag && !m_hasPassedSnapPoint) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)8, 1f); if (num2 >= MinEjectVelocity) { float forceMultiplier = Mathf.Lerp(MinEjectForce, MaxEjectForce, Mathf.Clamp01((num2 - MinEjectVelocity) / EjectForceRange)); if ((Object)(object)Cylinder != (Object)null && Cylinder.Chambers != null) { FVRFireArmChamber[] chambers = Cylinder.Chambers; foreach (FVRFireArmChamber val in chambers) { if ((Object)(object)val != (Object)null && val.IsFull) { PopOutRound(val, forceMultiplier); } } } } base.m_ejectorLerp = 0f; ((FVRPhysicalObject)this).SetAnimatedComponent(base.Ejector, base.EjectorRange.x, (InterpStyle)0, (Axis)2); m_hasPassedSnapPoint = true; } else if (num >= EjectorStartAngle && !m_hasPassedSnapPoint) { float ejectorLerp = Mathf.InverseLerp(EjectorStartAngle, base.HingeEjectLimit, num); base.m_ejectorLerp = ejectorLerp; ((FVRPhysicalObject)this).SetAnimatedComponent(base.Ejector, Mathf.Lerp(base.EjectorRange.x, base.EjectorRange.y, base.m_ejectorLerp), (InterpStyle)0, (Axis)2); } else if (num < EjectorStartAngle - 5f) { m_hasPassedSnapPoint = false; base.m_ejectorLerp = 0f; ((FVRPhysicalObject)this).SetAnimatedComponent(base.Ejector, base.EjectorRange.x, (InterpStyle)0, (Axis)2); } } public void PopOutRound(FVRFireArmChamber chamber, float forceMultiplier = 1f) { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_0108: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)21, 1f); Vector3 position = ((Component)chamber).transform.position; Vector3 position2 = ((Component)Cylinder).transform.position; Vector3 val = -((Component)chamber).transform.forward; Vector3 val2 = position - position2; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 forward = ((Component)Cylinder).transform.forward; Vector3 val3 = Vector3.ProjectOnPlane(normalized, forward); normalized = ((Vector3)(ref val3)).normalized; Vector3 val4 = Vector3.Cross(forward, normalized); Vector3 normalized2 = ((Vector3)(ref val4)).normalized; Vector3 val5 = val + normalized + normalized2 * 0.2f; Vector3 normalized3 = ((Vector3)(ref val5)).normalized; Vector3 val6 = normalized3 + new Vector3(0f, 0.05f, 0f); normalized3 = ((Vector3)(ref val6)).normalized; Vector3 val7 = default(Vector3); ((Vector3)(ref val7))..ctor(Random.Range(-0.005f, 0.005f), Random.Range(-0.005f, 0.005f), Random.Range(-0.005f, 0.005f)); Vector3 val8 = position + ((Component)chamber).transform.forward * base.EjectOffset; float num = base.EjectSpeed * Mathf.Lerp(0.05f, 0.8f, forceMultiplier); float num2 = ((!chamber.IsSpent) ? num : (num * 1.1f)); Vector3 val9 = val8 + val7; Vector3 val10 = normalized3 + val7; chamber.EjectRound(val9, ((Vector3)(ref val10)).normalized * num2, Vector3.right, false); } public void BreakOpen() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (m_isBreakOpen) { return; } if ((Object)(object)m_hingeGO != (Object)null && (Object)(object)base.Hinge == (Object)null) { SeparateBarrel(); } m_isBreakOpen = true; ((BreakActionWeapon)this).SetIsExternallyUnlatched(true); if ((Object)(object)base.Hinge != (Object)null) { JointLimits limits = base.Hinge.limits; ((JointLimits)(ref limits)).max = base.HingeLimit; base.Hinge.limits = limits; } if (!((Object)(object)Cylinder != (Object)null) || Cylinder.Chambers == null) { return; } FVRFireArmChamber[] chambers = Cylinder.Chambers; foreach (FVRFireArmChamber val in chambers) { if ((Object)(object)val != (Object)null) { val.IsAccessible = true; } } } public void BreakClose() { if (!m_isBreakOpen) { return; } bool isHammerCocked = m_isHammerCocked; float hammerCockLerp = m_hammerCockLerp; m_isBreakOpen = false; m_hasEjectedThisOpen = false; ((BreakActionWeapon)this).SetIsExternallyUnlatched(false); base.IsLatchHeldOpen = false; m_isLatchHeldOpen = false; hasLatchButtonUpSinceBegin = false; hasForegripUpSinceBegin = false; foregripLatch = false; m_prevShouldLatchBeOpen = false; m_latchClickLerp = 1f; if ((Object)(object)Cylinder != (Object)null && Cylinder.Chambers != null) { FVRFireArmChamber[] chambers = Cylinder.Chambers; foreach (FVRFireArmChamber val in chambers) { if ((Object)(object)val != (Object)null) { val.IsAccessible = false; } } } base.m_isLatched = true; base.m_latchRot = 0f; if (isHammerCocked) { m_isHammerCocked = true; m_hammerCockLerp = 1f; if (base.Barrels != null && base.Barrels.Length > 0) { base.Barrels[0].m_isHammerCocked = true; } } WeldBarrel(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)18, 1f); } } public class SchofieldForegrip : FVRAlternateGrip { [Header("Break Action Setup")] public Transform BreakBase; public HingeJoint Hinge; private Vector3 localPosStart; private Rigidbody RB; private Schofield Wep; private float m_initialDamp = 0.05f; private float m_initialSpring = 0.05f; private float m_initialTargetPos; private bool wasLatchHeldOpen = false; public override void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) ((FVRAlternateGrip)this).Awake(); localPosStart = ((Component)Hinge).transform.localPosition; RB = ((Component)Hinge).gameObject.GetComponent(); Wep = ((Component)((Joint)Hinge).connectedBody).gameObject.GetComponent(); if ((Object)(object)Wep != (Object)null) { Wep.ForegripRef = this; } if ((Object)(object)RB != (Object)null) { RB.mass = 2f; } JointSpring spring = Hinge.spring; m_initialSpring = spring.spring; m_initialDamp = spring.damper; m_initialTargetPos = spring.targetPosition; } public override void FVRUpdate() { //IL_0029: 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_004f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Hinge == (Object)null)) { ((FVRInteractiveObject)this).FVRUpdate(); if (Vector3.Distance(((Component)Hinge).transform.localPosition, localPosStart) > 0.01f) { ((Component)Hinge).transform.localPosition = localPosStart; } } } public override void FVRFixedUpdate() { if (!((Object)(object)RB == (Object)null)) { ((FVRInteractiveObject)this).FVRFixedUpdate(); if (((FVRInteractiveObject)Wep).IsHeld && ((FVRPhysicalObject)Wep).IsAltHeld) { RB.mass = 0.001f; } else { RB.mass = 0.1f; } } } public override bool IsInteractable() { return true; } public override void UpdateInteraction(FVRViveHand hand) { //IL_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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) bool flag = false; if (hand.IsInStreamlinedMode) { flag = hand.Input.BYButtonPressed; } else { Vector2 touchpadAxes = hand.Input.TouchpadAxes; flag = hand.Input.TouchpadPressed && touchpadAxes.y > 0.1f; } Wep.foregripLatch = flag; ((FVRAlternateGrip)this).UpdateInteraction(hand); if ((Object)(object)Hinge == (Object)null) { return; } bool flag2 = ((FVRInteractiveObject)Wep).IsHeld && ((FVRInteractiveObject)this).IsHeld; if (!Wep.IsBreakOpen || (((FVRInteractiveObject)Wep).IsHeld && ((FVRInteractiveObject)this).IsHeld)) { Vector3 val = ((HandInput)(ref hand.Input)).Pos - ((Component)Hinge).transform.position; Vector3 val2 = Vector3.ProjectOnPlane(val, BreakBase.right); if (Vector3.Angle(val2, -BreakBase.up) > 90f) { val2 = BreakBase.forward; } if (Vector3.Angle(val2, BreakBase.forward) > 90f) { val2 = -BreakBase.up; } float num = Vector3.Angle(val2, BreakBase.forward); JointSpring spring = Hinge.spring; spring.spring = 10f; spring.damper = 0f; JointLimits limits = Hinge.limits; spring.targetPosition = Mathf.Clamp(num, 0f, ((JointLimits)(ref limits)).max); Hinge.spring = spring; } else { JointSpring spring2 = Hinge.spring; spring2.spring = 0f; spring2.damper = 0.1f; spring2.targetPosition = Hinge.angle; Hinge.spring = spring2; } ((Component)Hinge).transform.localPosition = localPosStart; } public override void EndInteraction(FVRViveHand hand) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Hinge != (Object)null) { JointSpring spring = Hinge.spring; spring.spring = m_initialSpring; spring.damper = m_initialDamp; spring.targetPosition = m_initialTargetPos; Hinge.spring = spring; } ((FVRAlternateGrip)this).EndInteraction(hand); } public void RefreshHinge(HingeJoint hinge) { Hinge = hinge; RB = ((!((Object)(object)hinge != (Object)null)) ? null : ((Component)hinge).gameObject.GetComponent()); } } } namespace BitWizrd.Revolver.SingleAction { public class SingleActionCylinderAxis : SingleActionRevolver { public enum RotationAxis { X, Y, Z } public RotationAxis cylinderRotationAxis = RotationAxis.Z; private void AdjustCylinderRotation(int chamberIndex) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c4: 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) if ((Object)(object)base.Cylinder == (Object)null) { return; } int numChambers = base.Cylinder.NumChambers; if (numChambers > 0) { Quaternion localRotationFromCylinder = base.Cylinder.GetLocalRotationFromCylinder(chamberIndex); Vector3 eulerAngles = ((Quaternion)(ref localRotationFromCylinder)).eulerAngles; switch (cylinderRotationAxis) { case RotationAxis.X: ((Vector3)(ref eulerAngles))..ctor(eulerAngles.z, 0f, 0f); break; case RotationAxis.Y: ((Vector3)(ref eulerAngles))..ctor(0f, eulerAngles.z, 0f); break; default: ((Vector3)(ref eulerAngles))..ctor(0f, 0f, eulerAngles.z); break; } ((Component)base.Cylinder).transform.localRotation = Quaternion.Euler(eulerAngles); } } public void CustomCockHammer(float speed) { ((SingleActionRevolver)this).CockHammer(speed); AdjustCylinderRotation(((SingleActionRevolver)this).CurChamber); } public void SetChamberAndRotate(int chamberIndex) { base.m_curChamber = chamberIndex; AdjustCylinderRotation(base.m_curChamber); } } public class SingleActionEjectorRodModded : FVRInteractiveObject { public SingleActionRevolverModded Revolver; public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); if ((Object)(object)Revolver != (Object)null) { Revolver.EjectFromRod(); } } } public class SingleActionRevolverBarrelGrip : FVRAlternateGrip { public override void Awake() { if ((Object)(object)base.PrimaryObject == (Object)null) { base.PrimaryObject = (FVRPhysicalObject)(object)((Component)this).GetComponentInParent(); } ((FVRAlternateGrip)this).Awake(); } } public class SingleActionRevolverModded : SingleActionRevolver { [Header("Gate Alignment")] [Tooltip("Add GateOpenCylinderOffset to the cylinder's rotation while the loading gate is open. For conversions whose chamber does not line up with the gate at the stock detent.")] public bool UseGateOpenOffset = false; [Tooltip("Extra rotation in degrees about the cylinder's local Z axis, applied on top of the stock gate-open angle. Gate open only; the closed pose is untouched.")] public float GateOpenCylinderOffset = 0f; [Header("Slide-Out Ejection")] [Tooltip("Extra distance (m) past the cylinder's rear face before the round is released.")] public float EjectClearance = 0.003f; [Tooltip("With the gate open, a spent case in the accessible chamber slides out and drops under gravity when the gun is tilted rear-down.")] public bool GravityEject = true; [Tooltip("How far (degrees) the chamber's rear must point below horizontal before a spent case slides out.")] public float GravityEjectMinTilt = 30f; private readonly CylinderSlideEjector m_slide = new CylinderSlideEjector(); public override void UpdateInteraction(FVRViveHand hand) { if ((Object)(object)hand != (Object)null && !((FVRPhysicalObject)this).IsAltHeld && base.m_isStateToggled && hand.Input.TriggerDown) { BeginEject(); } ((SingleActionRevolver)this).UpdateInteraction(hand); if (((FVRPhysicalObject)this).IsAltHeld && (Object)(object)hand != (Object)null) { HandleAltGripInput(hand); } ApplyGateOpenOffset(); } private void ApplyGateOpenOffset() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (UseGateOpenOffset && base.m_isStateToggled && !((Object)(object)base.Cylinder == (Object)null)) { Transform transform = ((Component)base.Cylinder).transform; transform.localRotation *= Quaternion.Euler(0f, 0f, GateOpenCylinderOffset); } } public override void FVRUpdate() { ((FVRFireArm)this).FVRUpdate(); m_slide.Tick(); if (GravityEject && base.m_isStateToggled && (Object)(object)base.Cylinder != (Object)null) { int num = ((!base.IsAccessTwoChambersBack) ? ((SingleActionRevolver)this).PrevChamber : ((SingleActionRevolver)this).PrevChamber2); m_slide.Clearance = EjectClearance; if (m_slide.TryGravityEject(base.Cylinder, base.Cylinder.Chambers[num], GravityEjectMinTilt)) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); } } } public override void OnDestroy() { m_slide.Clear(); ((FVRPhysicalObject)this).OnDestroy(); } private void HandleAltGripInput(FVRViveHand hand) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonDown && base.StateToggles) { ToggleGate(); } if (base.m_isStateToggled && hand.Input.AXButtonDown) { ((SingleActionRevolver)this).AdvanceCylinder(); } } else if (hand.Input.TouchpadDown) { float num = Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left); float num2 = Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right); if (num < 45f && base.StateToggles) { ToggleGate(); } else if (num2 < 45f && base.m_isStateToggled) { ((SingleActionRevolver)this).AdvanceCylinder(); } } if (base.m_isStateToggled && hand.Input.TriggerDown) { BeginEject(); } } private void ToggleGate() { ((SingleActionRevolver)this).ToggleState(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)((!base.m_isStateToggled) ? 18 : 17), 1f); } public void EjectFromRod() { BeginEject(); } private void BeginEject() { if (base.m_isStateToggled) { int num = ((!base.IsAccessTwoChambersBack) ? ((SingleActionRevolver)this).PrevChamber : ((SingleActionRevolver)this).PrevChamber2); m_slide.Clearance = EjectClearance; if (m_slide.Eject(base.Cylinder, base.Cylinder.Chambers[num])) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); } } } } } public class SpawnDurationRuntime : MonoBehaviour { public float Delay; public float Duration; private ParticleSystem ps; private void Awake() { ps = ((Component)this).GetComponent(); } private void OnEnable() { //IL_0036: 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) if ((Object)(object)ps == (Object)null) { ps = ((Component)this).GetComponent(); } if ((Object)(object)ps != (Object)null) { EmissionModule emission = ps.emission; ((EmissionModule)(ref emission)).enabled = true; } ((MonoBehaviour)this).CancelInvoke(); if (Duration > 0f) { ((MonoBehaviour)this).Invoke("StopEmission", Delay + Duration); } } private void StopEmission() { if ((Object)(object)ps != (Object)null) { ps.Stop(false, (ParticleSystemStopBehavior)1); } } } public class StopDisableWhenDone : MonoBehaviour { public ParticleSystem Ps; public float PollInterval = 0.25f; public float ParkDelay = 2f; private float nextPoll; private bool seenEmission; private bool parking; private float parkAt; private static readonly List s_parkedInstances = new List(); private const int MaxParkedInstances = 8; public static bool EnsureSoftParticles = true; private void Awake() { if ((Object)(object)Ps == (Object)null) { Ps = ((Component)this).GetComponent(); } } private static void RequireDepthFade() { //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) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (EnsureSoftParticles && Application.isPlaying) { Camera main = Camera.main; if ((Object)(object)main != (Object)null && (main.depthTextureMode & 1) == 0) { main.depthTextureMode = (DepthTextureMode)(main.depthTextureMode | 1); } } } private void OnEnable() { RequireDepthFade(); if ((Object)(object)Ps != (Object)null) { Ps.Play(); } seenEmission = false; parking = false; UntrackParked((!((Object)(object)((Component)this).transform.parent != (Object)null)) ? ((Component)this).gameObject : ((Component)((Component)this).transform.parent).gameObject); nextPoll = Time.time + PollInterval; } private void Update() { if (!Application.isPlaying || (Object)(object)Ps == (Object)null || Time.time < nextPoll) { return; } nextPoll = Time.time + PollInterval; if (Ps.particleCount > 0) { seenEmission = true; parking = false; } if (seenEmission && !Ps.IsAlive()) { Ps.Stop(); Transform parent = ((Component)this).transform.parent; if (!((Object)(object)parent != (Object)null) || !((Object)(object)((Component)parent).GetComponent() == (Object)null)) { ((Behaviour)this).enabled = false; } else if (!AllSystemsDone(parent)) { parking = false; } else if (!parking) { parking = true; parkAt = Time.time + ParkDelay; } else if (Time.time >= parkAt) { ParkInstance(((Component)parent).gameObject); } } } private static void ParkInstance(GameObject root) { UntrackParked(root); root.SetActive(false); s_parkedInstances.Add(root); while (s_parkedInstances.Count > 8) { GameObject val = s_parkedInstances[0]; s_parkedInstances.RemoveAt(0); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } } private static void UntrackParked(GameObject root) { for (int num = s_parkedInstances.Count - 1; num >= 0; num--) { GameObject val = s_parkedInstances[num]; if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)root) { s_parkedInstances.RemoveAt(num); } } } private static bool AllSystemsDone(Transform root) { ParticleSystem[] componentsInChildren = ((Component)root).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (!SystemDone(componentsInChildren[i], 0)) { return false; } } CryRibbon[] componentsInChildren2 = ((Component)root).GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren2.Length; j++) { if ((Object)(object)componentsInChildren2[j] != (Object)null && componentsInChildren2[j].IsBusy) { return false; } } AudioSource[] componentsInChildren3 = ((Component)root).GetComponentsInChildren(true); for (int k = 0; k < componentsInChildren3.Length; k++) { if (((Component)componentsInChildren3[k]).gameObject.activeInHierarchy && componentsInChildren3[k].isPlaying) { return false; } } return true; } private static bool SystemDone(ParticleSystem ps, int depth) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) if (depth > 8) { return true; } if ((Object)(object)ps == (Object)null || !((Component)ps).gameObject.activeInHierarchy) { return true; } if (ps.IsAlive()) { return false; } MainModule main = ps.main; if (((MainModule)(ref main)).loop) { return false; } MainModule main2 = ps.main; MinMaxCurve startDelay = ((MainModule)(ref main2)).startDelay; if ((int)((MinMaxCurve)(ref startDelay)).mode != 0) { return false; } float time = ps.time; float constant = ((MinMaxCurve)(ref startDelay)).constant; MainModule main3 = ps.main; if (time >= constant + ((MainModule)(ref main3)).duration - 0.05f) { return true; } if (ps.time > 0.05f) { return false; } Transform parent = ((Component)ps).transform.parent; ParticleSystem val = ((!((Object)(object)parent != (Object)null)) ? null : ((Component)parent).GetComponent()); if ((Object)(object)val == (Object)null) { return false; } return SystemDone(val, depth + 1); } }