Decompiled source of HuntCertainVictory v1.0.5
HuntCertainVictory.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
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.HuntCertainVictory { [BepInPlugin("BitWizrd.HuntCertainVictory", "HuntCertainVictory", "1.0.5")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class HuntCertainVictoryPlugin : 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.HuntCertainVictory"); OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntCertainVictory", "", "certainvictory", "", ""); } } } 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<AudioSource>(); } } 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<ParticleSystem>(true); m_sources = ((Component)this).GetComponentsInChildren<AudioSource>(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<Collider>(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<FireArmRoundClass> GetChamberRoundList() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) bool flag = false; List<FireArmRoundClass> list = new List<FireArmRoundClass>(); 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<FireArmRoundClass> 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<Chain>(); } ((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<Collider> list = new List<Collider>(); List<Vector3> list2 = new List<Vector3>(); Collider[] components = ((Component)transform).GetComponents<Collider>(); 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<FVRFireArm>(); if ((Object)(object)m_firearm != (Object)null) { m_firearmRb = ((Component)m_firearm).GetComponent<Rigidbody>(); } 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<Collider> list = new List<Collider>(); Transform[] chamberModels = ChamberModels; foreach (Transform val in chamberModels) { Collider[] componentsInChildren = ((Component)val).GetComponentsInChildren<Collider>(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)