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 BitWizrd.Rifle; using FistVR; using HarmonyLib; using OtherLoader; using UnityEngine; using UnityEngine.Audio; [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.HuntVetterli71Silencer { [BepInPlugin("BitWizrd.HuntVetterli71Silencer", "HuntVetterli71Silencer", "1.0.6")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class HuntVetterli71SilencerPlugin : 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.HuntVetterli71Silencer"); OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntVetterli71Silencer", "", "vetterli 71 silencer", "", ""); } } } public class AudioStopWhenDone : MonoBehaviour { public AudioSource Src; public float Delay; public float Duration = 1f; private void Awake() { if ((Object)(object)Src == (Object)null) { Src = ((Component)this).GetComponent(); } } private void OnEnable() { ((MonoBehaviour)this).CancelInvoke(); if ((Object)(object)Src != (Object)null && Src.loop && !Src.isPlaying) { Src.Play(); } if (Duration > 0f) { ((MonoBehaviour)this).Invoke("StopLoop", Mathf.Max(0f, Delay) + Duration); } } private void OnDisable() { ((MonoBehaviour)this).CancelInvoke(); } private void StopLoop() { if ((Object)(object)Src != (Object)null && Src.loop) { Src.Stop(); } ((Behaviour)this).enabled = false; } } public class AutoDestructWhenDone : MonoBehaviour { [Tooltip("Seconds between checks.")] public float PollInterval = 0.5f; [Tooltip("Seconds after enabling before the first check, so a delayed start is not mistaken for finished.")] public float StartGrace = 1f; private ParticleSystem[] m_systems; private AudioSource[] m_sources; private float m_nextPoll; private void OnEnable() { m_nextPoll = Time.time + Mathf.Max(StartGrace, PollInterval); } private void Update() { if (!Application.isPlaying || Time.time < m_nextPoll) { return; } m_nextPoll = Time.time + PollInterval; if (m_systems == null) { m_systems = ((Component)this).GetComponentsInChildren(true); m_sources = ((Component)this).GetComponentsInChildren(true); } for (int i = 0; i < m_systems.Length; i++) { ParticleSystem val = m_systems[i]; if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy && val.IsAlive(false)) { return; } } for (int j = 0; j < m_sources.Length; j++) { AudioSource val2 = m_sources[j]; if ((Object)(object)val2 != (Object)null && ((Component)val2).gameObject.activeInHierarchy && val2.isPlaying) { return; } } Object.Destroy((Object)(object)((Component)this).gameObject); } } public class BloodBondSR : MonoBehaviour { private void Awake() { string name = "Ammo_69_CashMoney_D100(Clone)"; ((Object)((Component)this).gameObject).name = name; Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Object)((Component)componentsInChildren[i]).gameObject).name = name; } } } namespace BitWizrd.Rifle { public class BoltAction : FVRFireArm { public enum ZPos { Forward, Middle, Rear } public enum HammerCockType { OnBack, OnUp, OnClose, OnForward } public enum FireSelectorModeType { Safe, Single } [Serializable] public class FireSelectorMode { public float SelectorPosition; public FireSelectorModeType ModeType; public bool IsBoltLocked; } [Header("BoltAction Config")] public FVRFireArmChamber Chamber; public bool HasMagEjectionButton = true; public bool HasFireSelectorButton = true; public BoltAction_Handle BoltHandle; public float BoltLerp; public bool BoltMovingForward; public BoltAction_Handle.BoltActionHandleState CurBoltHandleState; public BoltAction_Handle.BoltActionHandleState LastBoltHandleState; [Header("Hammer Config")] public bool HasVisualHammer; public Transform Hammer; public float HammerUncocked; public float HammerCocked; [NonSerialized] public bool m_isHammerCocked; public HammerCockType CockType; [NonSerialized] public FVRFirearmMovingProxyRound m_proxy; [Header("Loading Config")] [Tooltip("When a magazine is inserted, the chamber cannot be loaded by hand (no +1). Rounds must feed from the magazine.")] public bool PreventManualChamberingWithMagazine = true; private bool m_defaultManuallyChamberable; [Header("Round Positions Config")] public Transform Extraction_MagazinePos; public Transform Extraction_ChamberPos; public Transform Extraction_Ejecting; public Transform EjectionPos; public float UpwardEjectionForce; public float RightwardEjectionForce = 2f; public float YSpinEjectionTorque = 80f; public Transform Muzzle; public GameObject ReloadTriggerWell; [Header("Control Config")] public float TriggerResetThreshold = 0.1f; public float TriggerFiringThreshold = 0.8f; [NonSerialized] public float m_triggerFloat; [NonSerialized] public bool m_hasTriggerCycled; [NonSerialized] public bool m_isMagReleasePressed; public Transform Trigger_Display; public float Trigger_ForwardValue; public float Trigger_RearwardValue; public InterpStyle TriggerInterpStyle = (InterpStyle)1; public Transform Trigger_Display2; public float Trigger_ForwardValue2; public float Trigger_RearwardValue2; public InterpStyle TriggerInterpStyle2 = (InterpStyle)1; public Transform MagReleaseButton_Display; public Axis MagReleaseAxis; public InterpStyle MagReleaseInterpStyle = (InterpStyle)1; public float MagReleasePressedValue; public float MagReleaseUnpressedValue; [NonSerialized] public float m_magReleaseCurValue; [NonSerialized] public float m_magReleaseTarValue; [NonSerialized] public Vector2 TouchPadAxes = Vector2.zero; public Transform FireSelector_Display; public Axis FireSelector_Axis; public InterpStyle FireSelector_InterpStyle = (InterpStyle)1; public FireSelectorMode[] FireSelector_Modes; [NonSerialized] public int m_fireSelectorMode; public bool RequiresHammerUncockedToToggleFireSelector; public bool UsesSecondFireSelectorChange; public Transform FireSelector_Display_Secondary; public Axis FireSelector_Axis_Secondary; public InterpStyle FireSelector_InterpStyle_Secondary = (InterpStyle)1; public FireSelectorMode[] FireSelector_Modes_Secondary; [Header("Special Features")] public bool EjectsMagazineOnEmpty; public bool PlaysExtraTailOnShot; public FVRTailSoundClass ExtraTail = (FVRTailSoundClass)8; [Header("Reciprocating Barrel")] public bool HasReciprocatingBarrel; public G11RecoilingSystem RecoilSystem; [NonSerialized] public bool m_isQuickboltTouching; [NonSerialized] public Vector2 lastTPTouchPoint = Vector2.zero; public bool IsHammerCocked => m_isHammerCocked; public bool HasExtractedRound() { return m_proxy.IsFull; } public override void Awake() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown ((FVRFireArm)this).Awake(); base.FChambers.Add(Chamber); m_defaultManuallyChamberable = Chamber.IsManuallyChamberable; UpdateManualChambering(); if (base.UsesClips && (Object)(object)base.ClipTrigger != (Object)null) { if (CurBoltHandleState == BoltAction_Handle.BoltActionHandleState.Rear) { if (!base.ClipTrigger.activeSelf) { base.ClipTrigger.SetActive(true); } } else if (base.ClipTrigger.activeSelf) { base.ClipTrigger.SetActive(false); } } GameObject val = new GameObject("m_proxyRound"); m_proxy = val.AddComponent(); m_proxy.Init(((Component)this).transform); } private void UpdateManualChambering() { if (!((Object)(object)Chamber == (Object)null)) { Chamber.IsManuallyChamberable = m_defaultManuallyChamberable && (!PreventManualChamberingWithMagazine || !((Object)(object)base.Magazine != (Object)null)); } } public bool CanBoltMove() { if (FireSelector_Modes.Length < 1) { return true; } if (FireSelector_Modes[m_fireSelectorMode].IsBoltLocked) { return false; } return true; } public override int GetTutorialState() { if (FireSelector_Modes[m_fireSelectorMode].ModeType == FireSelectorModeType.Safe) { return 4; } if (Chamber.IsFull) { if (Chamber.IsSpent) { return 0; } if ((Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null) { return 6; } return 5; } if ((Object)(object)base.Magazine != (Object)null && !base.Magazine.HasARound()) { if (CurBoltHandleState == BoltAction_Handle.BoltActionHandleState.Forward || CurBoltHandleState == BoltAction_Handle.BoltActionHandleState.Mid) { return 0; } if ((Object)(object)base.Clip != (Object)null) { return 2; } if (!base.Magazine.IsFull()) { return 1; } return 3; } return 3; } public override void BeginInteraction(FVRViveHand hand) { ((FVRFireArm)this).BeginInteraction(hand); } public override void UpdateInteraction(FVRViveHand hand) { //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_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Invalid comparison between Unknown and I4 //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_036e: 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_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_062f: 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_0556: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_049f: 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_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Unknown result type (might be due to invalid IL or missing references) //IL_05b8: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) TouchPadAxes = hand.Input.TouchpadAxes; if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !((FVRPhysicalObject)this).IsAltHeld) { m_triggerFloat = hand.Input.TriggerFloat; } if (!m_hasTriggerCycled) { if (m_triggerFloat >= TriggerFiringThreshold) { m_hasTriggerCycled = true; } } else if (m_triggerFloat <= TriggerResetThreshold) { m_hasTriggerCycled = false; } m_isMagReleasePressed = false; bool flag = false; bool flag2 = false; bool flag3 = false; if (hand.IsInStreamlinedMode) { if (HasFireSelectorButton && hand.Input.BYButtonDown) { ToggleFireSelector(); } if (HasMagEjectionButton && hand.Input.AXButtonPressed && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin) { m_isMagReleasePressed = true; } if (HasMagEjectionButton && hand.Input.AXButtonDown && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin) { ReleaseMag(); } flag3 = true; if ((Object)(object)((FVRPhysicalObject)this).Bipod != (Object)null && ((FVRPhysicalObject)this).Bipod.IsBipodActive) { flag3 = false; } if (!CanBoltMove()) { flag2 = false; flag3 = false; } if (flag3 && !((FVRPhysicalObject)this).IsAltHeld && (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null && ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hasTriggeredUpSinceBegin && ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).IsHeld && ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.Input.BYButtonDown && BoltHandle.UsesQuickRelease && BoltHandle.HandleState == BoltAction_Handle.BoltActionHandleState.Forward) { flag = true; } } else { if (HasMagEjectionButton && hand.Input.TouchpadPressed && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && ((Vector2)(ref TouchPadAxes)).magnitude > 0.3f && Vector2.Angle(TouchPadAxes, Vector2.down) <= 45f) { m_isMagReleasePressed = true; } if ((int)GM.Options.QuickbeltOptions.BoltActionModeSetting == 0) { flag3 = true; } if ((int)GM.Options.QuickbeltOptions.BoltActionModeSetting == 1) { flag2 = true; } if (GM.Options.ControlOptions.UseGunRigMode2) { flag2 = true; flag3 = true; } if ((Object)(object)((FVRPhysicalObject)this).Bipod != (Object)null && ((FVRPhysicalObject)this).Bipod.IsBipodActive) { flag2 = true; flag3 = false; } if (!CanBoltMove()) { flag2 = false; flag3 = false; } if (IsHammerCocked && BoltHandle.HandleState == BoltAction_Handle.BoltActionHandleState.Forward && BoltHandle.HandleRot == BoltAction_Handle.BoltActionHandleRot.Down) { flag2 = false; } if (!BoltHandle.UsesQuickRelease) { flag2 = false; } if (hand.Input.TouchpadDown && ((Vector2)(ref TouchPadAxes)).magnitude > 0.1f) { if (flag3 && Vector2.Angle(TouchPadAxes, Vector2.right) <= 45f && BoltHandle.UsesQuickRelease && BoltHandle.HandleState == BoltAction_Handle.BoltActionHandleState.Forward) { flag = true; } else if (Vector2.Angle(TouchPadAxes, Vector2.left) <= 45f && HasFireSelectorButton) { ToggleFireSelector(); } else if (Vector2.Angle(TouchPadAxes, Vector2.down) <= 45f && HasMagEjectionButton) { ReleaseMag(); } } } if (m_isMagReleasePressed) { if ((Object)(object)ReloadTriggerWell != (Object)null) { ReloadTriggerWell.SetActive(false); } } else if ((Object)(object)ReloadTriggerWell != (Object)null) { ReloadTriggerWell.SetActive(true); } if (((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin && !flag && flag2) { if (((Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null && !((FVRPhysicalObject)this).IsAltHeld) || GM.Options.ControlOptions.UseGunRigMode2 || ((Object)(object)((FVRPhysicalObject)this).Bipod != (Object)null && ((FVRPhysicalObject)this).Bipod.IsBipodActive)) { if (hand.Input.TouchpadTouched) { Vector2 touchpadAxes = hand.Input.TouchpadAxes; if (((Vector2)(ref touchpadAxes)).magnitude > 0.1f) { bool isQuickboltTouching = m_isQuickboltTouching; if (Vector2.Angle(touchpadAxes, Vector2.right + Vector2.up) < 90f && !m_isQuickboltTouching) { m_isQuickboltTouching = true; } if (m_isQuickboltTouching && isQuickboltTouching) { float sAngle = GetSAngle(touchpadAxes, lastTPTouchPoint, hand.CMode); BoltHandle.DriveBolt((0f - sAngle) / 90f); } lastTPTouchPoint = touchpadAxes; } else { lastTPTouchPoint = Vector2.zero; } } else { lastTPTouchPoint = Vector2.zero; } } if (m_isQuickboltTouching) { Debug.DrawLine(((Component)BoltHandle.BoltActionHandleRoot).transform.position, ((Component)BoltHandle.BoltActionHandleRoot).transform.position + 0.1f * new Vector3(lastTPTouchPoint.x, lastTPTouchPoint.y, 0f), Color.blue); } } if (hand.Input.TouchpadTouchUp) { m_isQuickboltTouching = false; lastTPTouchPoint = Vector2.zero; } FiringSystem(); ((FVRPhysicalObject)this).UpdateInteraction(hand); if (flag && !((FVRPhysicalObject)this).IsAltHeld && (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null) { m_isQuickboltTouching = false; lastTPTouchPoint = Vector2.zero; hand.Buzz(hand.Buzzer.Buzz_BeginInteraction); hand.HandMadeGrabReleaseSound(); hand.EndInteractionIfHeld((FVRInteractiveObject)(object)this); ((FVRInteractiveObject)this).EndInteraction(hand); ((FVRInteractiveObject)BoltHandle).BeginInteraction(hand); hand.ForceSetInteractable((FVRInteractiveObject)(object)BoltHandle); BoltHandle.TPInitiate(); } } public float GetSignedAngle(Vector2 from, Vector2 to) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(from.y, 0f - from.x); Vector2 normalized = ((Vector2)(ref val)).normalized; float num = Mathf.Sign(Vector2.Dot(from, normalized)); float num2 = Vector2.Angle(from, to); return num2 * num; } public float GetSAngle(Vector2 v1, Vector2 v2, ControlMode m) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if ((int)m == 3) { return (v1.y - v2.y) * 130f; } float num = Mathf.Sign(v1.x * v2.y - v1.y * v2.x); return Vector2.Angle(v1, v2) * num; } public override void EndInteraction(FVRViveHand hand) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) m_triggerFloat = 0f; m_hasTriggerCycled = false; m_isMagReleasePressed = false; m_isQuickboltTouching = false; lastTPTouchPoint = Vector2.zero; ((FVRFireArm)this).EndInteraction(hand); } public void SetHasTriggeredUp() { ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin = true; } public void CockHammer() { if (!m_isHammerCocked) { m_isHammerCocked = true; if (HasVisualHammer) { ((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerCocked, (InterpStyle)0, (Axis)2); } } } public void DropHammer() { if (IsHammerCocked) { m_isHammerCocked = false; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); Fire(); if (HasVisualHammer) { ((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerUncocked, (InterpStyle)0, (Axis)2); } } } public virtual void ToggleFireSelector() { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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) if ((RequiresHammerUncockedToToggleFireSelector && IsHammerCocked) || ((FVRInteractiveObject)BoltHandle).IsHeld || CurBoltHandleState != BoltAction_Handle.BoltActionHandleState.Forward || BoltHandle.HandleRot != BoltAction_Handle.BoltActionHandleRot.Down || FireSelector_Modes.Length <= 1) { return; } m_fireSelectorMode++; if (m_fireSelectorMode >= FireSelector_Modes.Length) { m_fireSelectorMode -= FireSelector_Modes.Length; } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f); if ((Object)(object)FireSelector_Display != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(FireSelector_Display, FireSelector_Modes[m_fireSelectorMode].SelectorPosition, FireSelector_InterpStyle, FireSelector_Axis); if (UsesSecondFireSelectorChange) { ((FVRPhysicalObject)this).SetAnimatedComponent(FireSelector_Display_Secondary, FireSelector_Modes_Secondary[m_fireSelectorMode].SelectorPosition, FireSelector_InterpStyle_Secondary, FireSelector_Axis_Secondary); } } } public void ReleaseMag() { if ((Object)(object)base.Magazine != (Object)null) { m_magReleaseCurValue = MagReleasePressedValue; ((FVRFireArm)this).EjectMag(false); } } public FireSelectorMode GetFiringMode() { return FireSelector_Modes[m_fireSelectorMode]; } public virtual void FiringSystem() { if (FireSelector_Modes[m_fireSelectorMode].ModeType != FireSelectorModeType.Safe && !((FVRPhysicalObject)this).IsAltHeld && BoltHandle.HandleState == BoltAction_Handle.BoltActionHandleState.Forward && BoltHandle.HandleRot != BoltAction_Handle.BoltActionHandleRot.Up && m_hasTriggerCycled) { DropHammer(); } } public bool Fire() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00ea: Unknown result type (might be due to invalid IL or missing references) FireSelectorMode fireSelectorMode = FireSelector_Modes[m_fireSelectorMode]; if (!Chamber.Fire()) { return false; } ((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); bool flag = ((FVRFireArm)this).IsTwoHandStabilized(); bool flag2 = ((FVRFireArm)this).IsForegripStabilized(); bool flag3 = ((FVRFireArm)this).IsShoulderStabilized(); ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); FVRSoundEnvironment currentSoundEnvironment = GM.CurrentPlayerBody.GetCurrentSoundEnvironment(); ((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), currentSoundEnvironment, 1f); if (PlaysExtraTailOnShot) { AudioEvent tailSet = SM.GetTailSet(ExtraTail, currentSoundEnvironment); base.m_pool_tail.PlayClipVolumePitchOverride(tailSet, ((Component)this).transform.position, tailSet.VolumeRange * 1f, base.AudioClipSet.TailPitchMod_Main * tailSet.PitchRange.x, (AudioMixerGroup)null); } if (HasReciprocatingBarrel) { RecoilSystem.Recoil(false); } return true; } public override void FVRFixedUpdate() { ((FVRFireArm)this).FVRFixedUpdate(); UpdateComponentDisplay(); UpdateManualChambering(); } public void UpdateComponentDisplay() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Invalid comparison between Unknown and I4 //IL_00db: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Invalid comparison between Unknown and I4 //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Invalid comparison between Unknown and I4 //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Invalid comparison between Unknown and I4 //IL_020f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Trigger_Display != (Object)null) { if ((int)TriggerInterpStyle == 0) { Trigger_Display.localPosition = new Vector3(0f, 0f, Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat)); } else if ((int)TriggerInterpStyle == 1) { Trigger_Display.localEulerAngles = new Vector3(Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat), 0f, 0f); } } if ((Object)(object)Trigger_Display2 != (Object)null) { if ((int)TriggerInterpStyle == 0) { Trigger_Display2.localPosition = new Vector3(0f, 0f, Mathf.Lerp(Trigger_ForwardValue2, Trigger_RearwardValue2, m_triggerFloat)); } else if ((int)TriggerInterpStyle == 1) { Trigger_Display2.localEulerAngles = new Vector3(Mathf.Lerp(Trigger_ForwardValue2, Trigger_RearwardValue2, m_triggerFloat), 0f, 0f); } } if ((Object)(object)MagReleaseButton_Display != (Object)null) { Vector3 zero = Vector3.zero; if (m_isMagReleasePressed) { m_magReleaseTarValue = MagReleasePressedValue; } else { m_magReleaseTarValue = MagReleaseUnpressedValue; } m_magReleaseCurValue = Mathf.Lerp(m_magReleaseCurValue, m_magReleaseTarValue, Time.deltaTime * 4f); float magReleaseCurValue = m_magReleaseCurValue; Axis magReleaseAxis = MagReleaseAxis; if ((int)magReleaseAxis != 0) { if ((int)magReleaseAxis != 1) { if ((int)magReleaseAxis == 2) { zero.z = magReleaseCurValue; } } else { zero.y = magReleaseCurValue; } } else { zero.x = magReleaseCurValue; } InterpStyle magReleaseInterpStyle = MagReleaseInterpStyle; if ((int)magReleaseInterpStyle != 0) { if ((int)magReleaseInterpStyle == 1) { MagReleaseButton_Display.localEulerAngles = zero; } } else { MagReleaseButton_Display.localPosition = zero; } } if (CurBoltHandleState == BoltAction_Handle.BoltActionHandleState.Forward) { base.IsBreachOpenForGasOut = false; } else { base.IsBreachOpenForGasOut = true; } } public FVRFireArmRound UpdateBolt(BoltAction_Handle.BoltActionHandleState State, float lerp, bool isCatchHeld) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_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_0103: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_033b: 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_0361: 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_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) FVRFireArmRound result = null; CurBoltHandleState = State; BoltLerp = lerp; if (base.UsesClips && (Object)(object)base.ClipTrigger != (Object)null) { if (CurBoltHandleState == BoltAction_Handle.BoltActionHandleState.Rear) { if (!base.ClipTrigger.activeSelf) { base.ClipTrigger.SetActive(true); } } else if (base.ClipTrigger.activeSelf) { base.ClipTrigger.SetActive(false); } } if (CurBoltHandleState == BoltAction_Handle.BoltActionHandleState.Rear && LastBoltHandleState != BoltAction_Handle.BoltActionHandleState.Rear) { if (CockType == HammerCockType.OnBack) { CockHammer(); } if (Chamber.IsFull) { FVRFireArmRound val = Chamber.EjectRound(EjectionPos.position, ((Component)this).transform.right * RightwardEjectionForce + ((Component)this).transform.up * UpwardEjectionForce, ((Component)this).transform.up * YSpinEjectionTorque, EjectionPos.position, EjectionPos.rotation, false); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)10, 1f); if (isCatchHeld && (Object)(object)val != (Object)null && !val.IsSpent) { result = val; } } else { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)41, 1f); } BoltMovingForward = true; } else if (CurBoltHandleState == BoltAction_Handle.BoltActionHandleState.Forward && LastBoltHandleState != BoltAction_Handle.BoltActionHandleState.Forward) { if (CockType == HammerCockType.OnForward) { CockHammer(); } if (m_proxy.IsFull && !Chamber.IsFull) { Chamber.SetRound(m_proxy.Round, false); m_proxy.ClearProxy(); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)11, 1f); } else { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)40, 1f); } BoltMovingForward = false; } else if (CurBoltHandleState == BoltAction_Handle.BoltActionHandleState.Mid && LastBoltHandleState == BoltAction_Handle.BoltActionHandleState.Rear && (Object)(object)base.Magazine != (Object)null) { if (!m_proxy.IsFull && base.Magazine.HasARound() && !Chamber.IsFull) { GameObject fromPrefabReference = base.Magazine.RemoveRound(false); m_proxy.SetFromPrefabReference(fromPrefabReference); } if (EjectsMagazineOnEmpty && !base.Magazine.HasARound()) { ((FVRFireArm)this).EjectMag(false); } } if (CurBoltHandleState != BoltAction_Handle.BoltActionHandleState.Forward && !m_proxy.IsFull && !Chamber.IsFull) { Chamber.IsAccessible = true; } else { Chamber.IsAccessible = false; } if (m_proxy.IsFull) { m_proxy.ProxyRound.position = Vector3.Lerp(Extraction_ChamberPos.position, Extraction_MagazinePos.position, BoltLerp); m_proxy.ProxyRound.rotation = Quaternion.Slerp(Extraction_ChamberPos.rotation, Extraction_MagazinePos.rotation, BoltLerp); } if (Chamber.IsFull) { Chamber.ProxyRound.position = Vector3.Lerp(Extraction_ChamberPos.position, Extraction_Ejecting.position, BoltLerp); Chamber.ProxyRound.rotation = Quaternion.Slerp(Extraction_ChamberPos.rotation, Extraction_Ejecting.rotation, BoltLerp); } LastBoltHandleState = CurBoltHandleState; return result; } public override List GetChamberRoundList() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (Chamber.IsFull && !Chamber.IsSpent) { List list = new List(); list.Add(Chamber.GetRound().RoundClass); return list; } return null; } public override void SetLoadedChambers(List rounds) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (rounds.Count > 0) { Chamber.Autochamber(rounds[0]); } } public override void ConfigureFromFlagDic(Dictionary f) { //IL_00c9: 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) string empty = string.Empty; string empty2 = string.Empty; empty = "HammerState"; if (f.ContainsKey(empty)) { empty2 = f[empty]; if (empty2 == "Cocked") { m_isHammerCocked = true; } if (HasVisualHammer) { ((FVRPhysicalObject)this).SetAnimatedComponent(Hammer, HammerCocked, (InterpStyle)0, (Axis)2); } } if (FireSelector_Modes.Length > 1) { empty = "FireSelectorState"; if (f.ContainsKey(empty)) { empty2 = f[empty]; int.TryParse(empty2, out m_fireSelectorMode); } if ((Object)(object)FireSelector_Display != (Object)null) { FireSelectorMode fireSelectorMode = FireSelector_Modes[m_fireSelectorMode]; ((FVRPhysicalObject)this).SetAnimatedComponent(FireSelector_Display, fireSelectorMode.SelectorPosition, FireSelector_InterpStyle, FireSelector_Axis); } } ((FVRFireArm)this).ConfigureFromFlagDic(f); } public override Dictionary GetFlagDic() { Dictionary flagDic = ((FVRFireArm)this).GetFlagDic(); string key = "HammerState"; string value = "Uncocked"; if (m_isHammerCocked) { value = "Cocked"; } flagDic.Add(key, value); if (FireSelector_Modes.Length > 1) { key = "FireSelectorState"; value = m_fireSelectorMode.ToString(); flagDic.Add(key, value); } return flagDic; } } public class BoltAction_Handle : FVRInteractiveObject { public enum BoltActionHandleState { Forward, Mid, Rear } public enum BoltActionHandleRot { Up, Mid, Down } public BoltAction Rifle; public bool UsesQuickRelease; public Transform BoltActionHandleRoot; public Transform BoltActionHandle; public float BaseRotOffset; [NonSerialized] public float rotAngle; public float MinRot; public float MaxRot; public float UnlockThreshold = 70f; public Transform Point_Forward; public Transform Point_Rearward; public Vector3 HandPosOffset = new Vector3(0f, 0f, 0f); [NonSerialized] public bool m_wasTPInitiated; public bool UsesExtraRotationPiece; public Transform ExtraRotationPiece; public BoltActionHandleState HandleState; public BoltActionHandleState LastHandleState; public BoltActionHandleRot HandleRot = BoltActionHandleRot.Down; public BoltActionHandleRot LastHandleRot = BoltActionHandleRot.Down; [NonSerialized] public Vector3 m_localHandPos_BoltDown; [NonSerialized] public Vector3 m_localHandPos_BoltUp; [NonSerialized] public Vector3 m_localHandPos_BoltBack; [NonSerialized] public float fakeBoltDrive; public bool CursedLeftHanded; public override void Awake() { ((FVRInteractiveObject)this).Awake(); CalculateHandPoses(); } public void TPInitiate() { m_wasTPInitiated = true; } public override void EndInteraction(FVRViveHand hand) { m_wasTPInitiated = false; ((FVRInteractiveObject)this).EndInteraction(hand); } public override bool IsInteractable() { if (!Rifle.CanBoltMove()) { return false; } return ((FVRInteractiveObject)this).IsInteractable(); } public void CalculateHandPoses() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) m_localHandPos_BoltDown = ((Component)Rifle).transform.InverseTransformPoint(((Component)this).transform.position); Vector3 val = ((Component)this).transform.position - BoltActionHandleRoot.position; val = Quaternion.AngleAxis(Mathf.Abs(MaxRot - MinRot) + 10f, BoltActionHandleRoot.forward) * val; val += BoltActionHandleRoot.position; m_localHandPos_BoltUp = ((Component)Rifle).transform.InverseTransformPoint(val); Vector3 val2 = val + -BoltActionHandleRoot.forward * (0.005f + Vector3.Distance(Point_Forward.position, Point_Rearward.position)); m_localHandPos_BoltBack = ((Component)Rifle).transform.InverseTransformPoint(val2); } public override void FVRUpdate() { ((FVRInteractiveObject)this).FVRUpdate(); } public void DriveBolt(float amount) { //IL_008a: 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_00a1: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((FVRFireArm)Rifle).Clip != (Object)null) { ((FVRFireArm)Rifle).EjectClip(); return; } fakeBoltDrive += amount; fakeBoltDrive = Mathf.Clamp(fakeBoltDrive, 0f, 1f); Vector3 val = ((fakeBoltDrive < 0.5f) ? Vector3.Slerp(m_localHandPos_BoltDown, m_localHandPos_BoltUp, fakeBoltDrive * 2f) : Vector3.Lerp(m_localHandPos_BoltUp, m_localHandPos_BoltBack, (fakeBoltDrive - 0.5f) * 2f)); val = ((Component)Rifle).transform.TransformPoint(val); ManipulateBoltUsingPosition(val, touchpadDrive: true); float num = Mathf.InverseLerp(Point_Forward.localPosition.z, Point_Rearward.localPosition.z, BoltActionHandleRoot.localPosition.z); if (num < 0.05f) { HandleState = BoltActionHandleState.Forward; } else if (num > 0.95f) { HandleState = BoltActionHandleState.Rear; } else { HandleState = BoltActionHandleState.Mid; } Rifle.UpdateBolt(HandleState, num, isCatchHeld: false); LastHandleState = HandleState; } public bool ManipulateBoltUsingPosition(Vector3 pos, bool touchpadDrive) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028e: 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_029f: 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_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) bool result = false; if (HandleState == BoltActionHandleState.Forward) { Vector3 val = pos - BoltActionHandle.position; Vector3 val2 = Vector3.ProjectOnPlane(val, ((Component)BoltActionHandleRoot).transform.forward); val = ((Vector3)(ref val2)).normalized; Vector3 val3 = ((Component)BoltActionHandleRoot).transform.right; if (CursedLeftHanded) { val3 = -((Component)BoltActionHandleRoot).transform.right; } rotAngle = Mathf.Atan2(Vector3.Dot(BoltActionHandleRoot.forward, Vector3.Cross(val3, val)), Vector3.Dot(val3, val)) * 57.29578f; rotAngle += BaseRotOffset; rotAngle = Mathf.Clamp(rotAngle, MinRot, MaxRot); BoltActionHandle.localEulerAngles = new Vector3(0f, 0f, rotAngle); if (UsesExtraRotationPiece) { ExtraRotationPiece.localEulerAngles = new Vector3(0f, 0f, rotAngle); } if (rotAngle >= UnlockThreshold) { HandleRot = BoltActionHandleRot.Up; } else if (Mathf.Abs(rotAngle - MinRot) < 2f) { HandleRot = BoltActionHandleRot.Down; } else { HandleRot = BoltActionHandleRot.Mid; } if (HandleRot == BoltActionHandleRot.Up && LastHandleRot != BoltActionHandleRot.Up) { ((FVRFireArm)Rifle).PlayAudioEvent((FirearmAudioEventType)12, 1f); if (Rifle.CockType == BoltAction.HammerCockType.OnUp) { Rifle.CockHammer(); } } else if (HandleRot == BoltActionHandleRot.Down && LastHandleRot != BoltActionHandleRot.Down) { ((FVRFireArm)Rifle).PlayAudioEvent((FirearmAudioEventType)13, 1f); if (Rifle.CockType == BoltAction.HammerCockType.OnClose) { Rifle.CockHammer(); } result = true; } LastHandleRot = HandleRot; } if (rotAngle >= UnlockThreshold) { Vector3 val4 = HandPosOffset.x * BoltActionHandleRoot.right + HandPosOffset.y * BoltActionHandleRoot.up + HandPosOffset.z * BoltActionHandleRoot.forward; Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(Point_Forward.position, Point_Rearward.position, pos - val4); BoltActionHandleRoot.position = closestValidPoint; } return result; } public override void UpdateInteraction(FVRViveHand hand) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) bool flag = false; if ((Object)(object)((FVRFireArm)Rifle).Clip != (Object)null) { ((FVRFireArm)Rifle).EjectClip(); return; } flag = ManipulateBoltUsingPosition(((HandInput)(ref hand.Input)).Pos, touchpadDrive: false); bool isCatchHeld = false; float num = Mathf.InverseLerp(Point_Forward.localPosition.z, Point_Rearward.localPosition.z, BoltActionHandleRoot.localPosition.z); if (base.m_hand.IsInStreamlinedMode) { if (base.m_hand.Input.AXButtonPressed) { isCatchHeld = true; } } else if (base.m_hand.Input.TouchpadPressed && Vector3.Angle(Vector2.op_Implicit(base.m_hand.Input.TouchpadAxes), Vector2.op_Implicit(Vector2.down)) < 45f) { isCatchHeld = true; } if (num < 0.025f) { HandleState = BoltActionHandleState.Forward; } else if (num > 0.975f) { HandleState = BoltActionHandleState.Rear; } else { HandleState = BoltActionHandleState.Mid; } if ((HandleState == BoltActionHandleState.Forward && LastHandleState != BoltActionHandleState.Forward) || HandleState != BoltActionHandleState.Rear || LastHandleState != BoltActionHandleState.Rear) { } FVRFireArmRound val = Rifle.UpdateBolt(HandleState, num, isCatchHeld); LastHandleState = HandleState; ((FVRInteractiveObject)this).UpdateInteraction(hand); if ((Object)(object)val == (Object)null && flag && UsesQuickRelease && m_wasTPInitiated && (((FVRPhysicalObject)Rifle).IsAltHeld || !((FVRInteractiveObject)Rifle).IsHeld)) { hand.Buzz(hand.Buzzer.Buzz_BeginInteraction); ((FVRInteractiveObject)this).EndInteraction(hand); ((FVRInteractiveObject)Rifle).BeginInteraction(hand); hand.ForceSetInteractable((FVRInteractiveObject)(object)Rifle); if (!hand.Input.TriggerPressed) { Rifle.SetHasTriggeredUp(); } } if ((Object)(object)val != (Object)null) { hand.Buzz(hand.Buzzer.Buzz_BeginInteraction); ((FVRInteractiveObject)this).EndInteraction(hand); ((FVRInteractiveObject)val).BeginInteraction(hand); hand.ForceSetInteractable((FVRInteractiveObject)(object)val); } } } } public class ComponentActivateRandomRuntime : MonoBehaviour { public float Probability; public int Group; public float SelectionStart; [NonSerialized] private bool rollResolved; [NonSerialized] private float sharedRoll; private void Awake() { if (Probability >= 1f) { return; } bool flag; if (Group != 0) { if (!rollResolved) { ResolveGroupRollsForRoot(); } flag = sharedRoll >= SelectionStart && sharedRoll <= SelectionStart + Probability; } else { flag = Random.value <= Probability; } if (!flag) { ((Component)this).gameObject.SetActive(false); } } private void ResolveGroupRollsForRoot() { ComponentActivateRandomRuntime[] componentsInChildren = ((Component)((Component)this).transform.root).GetComponentsInChildren(true); Dictionary dictionary = new Dictionary(); foreach (ComponentActivateRandomRuntime componentActivateRandomRuntime in componentsInChildren) { if (componentActivateRandomRuntime.Group != 0 && !componentActivateRandomRuntime.rollResolved) { if (!dictionary.TryGetValue(componentActivateRandomRuntime.Group, out var value)) { value = Random.value; dictionary[componentActivateRandomRuntime.Group] = value; } componentActivateRandomRuntime.sharedRoll = value; componentActivateRandomRuntime.rollResolved = true; } } } } public class CooldownSound : MonoBehaviour { public ClosedBoltWeapon weapon; public AudioClip[] audioClips; public float volume = 1f; public int minShots = 5; public int maxShots = 10; public float minDelay = 0.5f; public float maxDelay = 2f; public float resetTime = 1.5f; private AudioSource audioSource; private int shotCounter = 0; private float lastShotTime; private bool lastRoundSpent; private int nextShotThreshold; private bool isPlayingSound = false; private void Start() { if ((Object)(object)weapon == (Object)null) { weapon = ((Component)this).GetComponent(); } if ((Object)(object)weapon == (Object)null) { Debug.LogError((object)"CooldownSound: Weapon reference is missing. Attach this script to a ClosedBoltWeapon."); return; } audioSource = ((Component)weapon).gameObject.GetComponent(); if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)weapon).gameObject.AddComponent(); } audioSource.spatialBlend = 1f; audioSource.playOnAwake = false; audioSource.rolloffMode = (AudioRolloffMode)0; lastRoundSpent = weapon.Chamber.IsSpent; SetNewShotThreshold(); } private void Update() { DetectFiring(); } private void DetectFiring() { if (weapon.Chamber.IsFull && weapon.Chamber.IsSpent && !lastRoundSpent) { OnWeaponFired(); } lastRoundSpent = weapon.Chamber.IsSpent; } private void OnWeaponFired() { float num = Time.time - lastShotTime; if (num > resetTime) { shotCounter = 0; SetNewShotThreshold(); } shotCounter++; lastShotTime = Time.time; if (shotCounter >= nextShotThreshold) { ((MonoBehaviour)this).StartCoroutine(PlaySoundWithDelay()); shotCounter = 0; SetNewShotThreshold(); } } private IEnumerator PlaySoundWithDelay() { if (!isPlayingSound) { isPlayingSound = true; float delay = Random.Range(minDelay, maxDelay); yield return (object)new WaitForSeconds(delay); if (audioClips.Length > 0) { int index = Random.Range(0, audioClips.Length); audioSource.clip = audioClips[index]; audioSource.PlayOneShot(audioSource.clip, volume); yield return (object)new WaitForSeconds(audioSource.clip.length); } isPlayingSound = false; } } private void SetNewShotThreshold() { nextShotThreshold = Random.Range(minShots, maxShots + 1); } } [ExecuteInEditMode] public class CryErosionDriver : MonoBehaviour { private static readonly int ErosionValueId = Shader.PropertyToID("_ErosionValue"); [Range(0f, 1f)] public float Burn = 0f; public Renderer[] Renderers; public bool HideWhenGone = true; private MaterialPropertyBlock _block; private float _burnRate; private float _lastApplied = -1f; public void BurnOver(float seconds) { _burnRate = ((!(seconds > 0.0001f)) ? 0f : ((1f - Burn) / seconds)); if (_burnRate <= 0f) { Burn = 1f; } } public void Restore() { _burnRate = 0f; Burn = 0f; Apply(force: true); } private void LateUpdate() { if (_burnRate > 0f && Application.isPlaying) { Burn = Mathf.Min(1f, Burn + _burnRate * Time.deltaTime); if (Burn >= 1f) { _burnRate = 0f; } } Apply(force: false); } private void OnValidate() { Apply(force: true); } private void Apply(bool force) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown float num = Mathf.Clamp01(Burn); if (!force && Mathf.Approximately(num, _lastApplied)) { return; } _lastApplied = num; if (Renderers == null || Renderers.Length == 0) { Renderers = ((Component)this).GetComponentsInChildren(true); } if (_block == null) { _block = new MaterialPropertyBlock(); } bool flag = HideWhenGone && num >= 1f; for (int i = 0; i < Renderers.Length; i++) { Renderer val = Renderers[i]; if (!((Object)(object)val == (Object)null)) { val.GetPropertyBlock(_block); _block.SetFloat(ErosionValueId, 1f - num); val.SetPropertyBlock(_block); if (HideWhenGone) { val.enabled = !flag; } } } } } [ExecuteInEditMode] public class CryRibbon : MonoBehaviour { private class ParentSlot { public uint Seed; public Vector3 Pos; public Vector3 Vel; public float Age01 = 1f; public bool Dead; } private struct SeedInfo { public int Slot; public float Fraction; } private sealed class AgeComparer : IComparer { public Particle[] Buf; public int Compare(int a, int b) { float num = ((Particle)(ref Buf[a])).startLifetime - ((Particle)(ref Buf[a])).remainingLifetime; float num2 = ((Particle)(ref Buf[b])).startLifetime - ((Particle)(ref Buf[b])).remainingLifetime; if (num > num2) { return -1; } if (num < num2) { return 1; } return 0; } } public ParticleSystem OwnPs; public ParticleSystem ParentSystem; public Transform EffectRoot; public Material RibbonMaterial; public float SizeConstant = 1f; public AnimationCurve SizeOverLife = new AnimationCurve(); public AnimationCurve SizeBySpawnFraction = new AnimationCurve(); public float OpacityConstant = 1f; public AnimationCurve OpacityOverLife = new AnimationCurve(); public AnimationCurve OpacityBySpawnFraction = new AnimationCurve(); public Gradient ColorOverLife = new Gradient(); public bool StreamFromAge; public float TextureFrequency = 1f; public bool FlipU; public bool FlipV; public bool ConnectToParent; public bool SampleParentAlpha; public AnimationCurve ParentOpacityOverLife = null; public AnimationCurve FacingOpacity = null; public int PerParentTotal = 1; public float SpawnDelay; public float SpawnDuration; public bool RateMode; public float SpawnRate; public float CountMin = 1f; public float CountMax = 1f; public float RestartPeriod; public float LifetimeMin = 1f; public float LifetimeMax = 1f; public int VelocityMode; public Vector3 AxisLocal = Vector3.up; public float ConeAngle; public float SpeedMin; public float SpeedMax; public AnimationCurve SpeedBySpawnFraction = new AnimationCurve(); public float Drag; public float GravityScale; public bool LifetimePerInstance; public AnimationCurve DragParentAge = null; public AnimationCurve DragSpawnFraction = null; private readonly List m_parents = new List(); private readonly Dictionary m_parentIndex = new Dictionary(); private readonly Dictionary m_vertSlot = new Dictionary(); private readonly Dictionary m_seedFirstFrame = new Dictionary(); private readonly List m_prune = new List(); private readonly Dictionary m_slotBirthCount = new Dictionary(); private Particle[] m_ownBuf = (Particle[])(object)new Particle[0]; private Particle[] m_parentBuf = (Particle[])(object)new Particle[0]; private readonly HashSet m_liveSeeds = new HashSet(); private readonly List m_seen = new List(); private readonly List m_freeSlots = new List(); private readonly Dictionary m_slotRefs = new Dictionary(); private readonly Dictionary m_groupIndex = new Dictionary(); private readonly List> m_groupLists = new List>(); private readonly List m_groupSlots = new List(); private readonly AgeComparer m_ageComparer = new AgeComparer(); private const int k_slotRecycleThreshold = 32; private Mesh m_mesh; private readonly List m_verts = new List(); private readonly List m_uvs = new List(); private readonly List m_cols = new List(); private readonly List m_norms = new List(); private readonly List m_tans = new List(); private readonly List m_tris = new List(); private readonly Vector3[] m_posBuf = (Vector3[])(object)new Vector3[256]; private readonly float[] m_fracBuf = new float[256]; private readonly float[] m_ageBuf = new float[256]; public static readonly List EditInstances = new List(); private int m_lastFrame = -1; private static Camera s_viewerCamera; public bool IsBusy { get { if (!((Behaviour)this).isActiveAndEnabled) { return false; } if ((Object)(object)OwnPs == (Object)null) { OwnPs = ((Component)this).GetComponent(); } if ((Object)(object)OwnPs != (Object)null && OwnPs.particleCount > 0) { return true; } if ((Object)(object)ParentSystem != (Object)null && ParentSystem.IsAlive(true)) { return true; } return false; } } public int InstanceCount => m_parents.Count; public int TrackCount => m_parents.Count; private void OnEnable() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown if (!Application.isPlaying && !EditInstances.Contains(this)) { EditInstances.Add(this); } m_parents.Clear(); m_parentIndex.Clear(); m_freeSlots.Clear(); m_vertSlot.Clear(); m_seedFirstFrame.Clear(); m_slotBirthCount.Clear(); if ((Object)(object)OwnPs == (Object)null) { OwnPs = ((Component)this).GetComponent(); } if ((Object)(object)m_mesh == (Object)null) { m_mesh = new Mesh(); ((Object)m_mesh).hideFlags = (HideFlags)61; ((Object)m_mesh).name = "CryRibbon"; m_mesh.MarkDynamic(); } } private void OnDisable() { EditInstances.Remove(this); } public void EditorTick() { if (!Application.isPlaying && !((Object)(object)this == (Object)null)) { LateUpdate(); } } private void OnDestroy() { if (!((Object)(object)m_mesh == (Object)null)) { if (Application.isPlaying) { Object.Destroy((Object)(object)m_mesh); } else { Object.DestroyImmediate((Object)(object)m_mesh); } } } private void LateUpdate() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)RibbonMaterial == (Object)null) { return; } int frame = CryEditClock.Frame; if (m_lastFrame == frame) { return; } m_lastFrame = frame; if ((Object)(object)OwnPs == (Object)null) { OwnPs = ((Component)this).GetComponent(); } if (!((Object)(object)OwnPs == (Object)null)) { UpdateParents(); Camera val = ResolveViewerCamera(); if (!((Object)(object)val == (Object)null)) { BuildAndDraw(((Component)val).transform.position); } } } private void UpdateParents() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ParentSystem == (Object)null) { return; } MainModule main = ParentSystem.main; int maxParticles = ((MainModule)(ref main)).maxParticles; if (m_parentBuf.Length < maxParticles) { m_parentBuf = (Particle[])(object)new Particle[maxParticles]; } int particles = ParentSystem.GetParticles(m_parentBuf); RecycleDeadSlots(); m_seen.Clear(); for (int i = 0; i < m_parents.Count; i++) { m_seen.Add(item: false); } for (int j = 0; j < particles; j++) { uint randomSeed = ((Particle)(ref m_parentBuf[j])).randomSeed; if (!m_parentIndex.TryGetValue(randomSeed, out var value)) { if (m_freeSlots.Count > 0) { value = m_freeSlots[m_freeSlots.Count - 1]; m_freeSlots.RemoveAt(m_freeSlots.Count - 1); m_parents[value].Seed = randomSeed; } else { ParentSlot parentSlot = new ParentSlot(); parentSlot.Seed = randomSeed; value = m_parents.Count; m_parents.Add(parentSlot); m_seen.Add(item: false); } m_parentIndex[randomSeed] = value; } ParentSlot parentSlot2 = m_parents[value]; parentSlot2.Pos = ToWorldPoint(ParentSystem, ((Particle)(ref m_parentBuf[j])).position); parentSlot2.Vel = ToWorldVector(ParentSystem, ((Particle)(ref m_parentBuf[j])).velocity); float startLifetime = ((Particle)(ref m_parentBuf[j])).startLifetime; float num = startLifetime - ((Particle)(ref m_parentBuf[j])).remainingLifetime; parentSlot2.Age01 = ((!(startLifetime > 1E-06f)) ? 1f : Mathf.Clamp01(num / startLifetime)); parentSlot2.Dead = false; m_seen[value] = true; } for (int k = 0; k < m_parents.Count; k++) { if (!m_seen[k]) { m_parents[k].Dead = true; } } } private void RecycleDeadSlots() { if (m_parents.Count < 32) { return; } m_slotRefs.Clear(); foreach (KeyValuePair item in m_vertSlot) { m_slotRefs[item.Value.Slot] = 1; } for (int i = 0; i < m_parents.Count; i++) { ParentSlot parentSlot = m_parents[i]; if (parentSlot.Dead && !m_slotRefs.ContainsKey(i) && m_parentIndex.TryGetValue(parentSlot.Seed, out var value) && value == i) { m_parentIndex.Remove(parentSlot.Seed); m_slotBirthCount.Remove(i); m_freeSlots.Add(i); } } } private float ParentAge01(int slot) { if (slot < 0 || slot >= m_parents.Count) { return 1f; } return m_parents[slot].Age01; } private void BuildAndDraw(Vector3 camPos) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_0695: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) m_verts.Clear(); m_uvs.Clear(); m_cols.Clear(); m_norms.Clear(); m_tans.Clear(); m_tris.Clear(); MainModule main = OwnPs.main; int maxParticles = ((MainModule)(ref main)).maxParticles; if (m_ownBuf.Length < maxParticles) { m_ownBuf = (Particle[])(object)new Particle[maxParticles]; } int particles = OwnPs.GetParticles(m_ownBuf); bool flag = m_parents.Count > 0; int frame = CryEditClock.Frame; for (int i = 0; i < particles; i++) { uint randomSeed = ((Particle)(ref m_ownBuf[i])).randomSeed; if (m_vertSlot.ContainsKey(randomSeed)) { continue; } if (!m_seedFirstFrame.ContainsKey(randomSeed)) { m_seedFirstFrame[randomSeed] = frame; } Vector3 val = ToWorldVector(OwnPs, ((Particle)(ref m_ownBuf[i])).velocity); bool flag2 = ((Vector3)(ref val)).sqrMagnitude > 1E-08f; bool flag3 = frame - m_seedFirstFrame[randomSeed] >= 3; if (!flag2 && !flag3 && flag) { continue; } SeedInfo value = new SeedInfo { Slot = 0, Fraction = 0f }; if (flag) { int slot = 0; Vector3 val2 = ToWorldPoint(OwnPs, ((Particle)(ref m_ownBuf[i])).position); float num = float.MaxValue; float num2 = float.MaxValue; for (int j = 0; j < m_parents.Count; j++) { if (!m_parents[j].Dead) { Vector3 val3 = val2 - m_parents[j].Pos; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude < num) { num2 = num; num = sqrMagnitude; slot = j; } else if (sqrMagnitude < num2) { num2 = sqrMagnitude; } } } bool flag4 = num2 > 1E-12f && num <= num2 * 0.25f; if (!flag4 && flag2) { float num3 = -2f; Vector3 normalized = ((Vector3)(ref val)).normalized; for (int k = 0; k < m_parents.Count; k++) { if (m_parents[k].Dead) { continue; } Vector3 vel = m_parents[k].Vel; if (!(((Vector3)(ref vel)).sqrMagnitude < 1E-08f)) { float num4 = Vector3.Dot(normalized, ((Vector3)(ref vel)).normalized); if (num4 > num3) { num3 = num4; slot = k; } } } flag4 = true; } if (!flag4) { continue; } value.Slot = slot; } int value2 = 0; m_slotBirthCount.TryGetValue(value.Slot, out value2); int num5 = Mathf.Max(2, PerParentTotal); value.Fraction = Mathf.Clamp01((float)value2 / (float)(num5 - 1)); m_slotBirthCount[value.Slot] = value2 + 1; m_vertSlot[randomSeed] = value; } m_liveSeeds.Clear(); for (int l = 0; l < particles; l++) { m_liveSeeds.Add(((Particle)(ref m_ownBuf[l])).randomSeed); } m_prune.Clear(); foreach (KeyValuePair item in m_vertSlot) { if (!m_liveSeeds.Contains(item.Key)) { m_prune.Add(item.Key); } } for (int m = 0; m < m_prune.Count; m++) { m_vertSlot.Remove(m_prune[m]); m_seedFirstFrame.Remove(m_prune[m]); } m_groupIndex.Clear(); m_groupSlots.Clear(); for (int n = 0; n < particles; n++) { if (!m_vertSlot.TryGetValue(((Particle)(ref m_ownBuf[n])).randomSeed, out var value3)) { continue; } if (!m_groupIndex.TryGetValue(value3.Slot, out var value4)) { value4 = m_groupSlots.Count; if (value4 == m_groupLists.Count) { m_groupLists.Add(new List()); } else { m_groupLists[value4].Clear(); } m_groupIndex[value3.Slot] = value4; m_groupSlots.Add(value3.Slot); } m_groupLists[value4].Add(n); } m_ageComparer.Buf = m_ownBuf; for (int num6 = 0; num6 < m_groupSlots.Count; num6++) { List list = m_groupLists[num6]; list.Sort(m_ageComparer); BuildStrip(list, m_groupSlots[num6], camPos); if (m_verts.Count >= 500) { break; } } m_mesh.Clear(); if (m_verts.Count >= 4) { m_mesh.SetVertices(m_verts); m_mesh.SetUVs(0, m_uvs); m_mesh.SetColors(m_cols); m_mesh.SetNormals(m_norms); m_mesh.SetTangents(m_tans); m_mesh.SetTriangles(m_tris, 0); m_mesh.RecalculateBounds(); Graphics.DrawMesh(m_mesh, Matrix4x4.identity, RibbonMaterial, ((Component)this).gameObject.layer, (Camera)null, 0, (MaterialPropertyBlock)null, false, false); } } private void BuildStrip(List order, int slot, Vector3 camPos) { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_05e8: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0660: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_06b4: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Unknown result type (might be due to invalid IL or missing references) //IL_06ba: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Unknown result type (might be due to invalid IL or missing references) //IL_06d3: Unknown result type (might be due to invalid IL or missing references) //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_06f0: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) int num = order.Count; bool flag = ConnectToParent && (Object)(object)ParentSystem != (Object)null && slot >= 0 && slot < m_parents.Count && !m_parents[slot].Dead; if (num + (flag ? 1 : 0) < 2) { return; } if (num > m_posBuf.Length) { num = m_posBuf.Length; } int count = m_verts.Count; for (int i = 0; i < num; i++) { int num2 = order[i]; ref Vector3 reference = ref m_posBuf[i]; reference = ToWorldPoint(OwnPs, ((Particle)(ref m_ownBuf[num2])).position); float num3 = 0f; if (m_vertSlot.TryGetValue(((Particle)(ref m_ownBuf[num2])).randomSeed, out var value)) { num3 = value.Fraction; } m_fracBuf[i] = num3; float startLifetime = ((Particle)(ref m_ownBuf[num2])).startLifetime; float num4 = startLifetime - ((Particle)(ref m_ownBuf[num2])).remainingLifetime; m_ageBuf[i] = ((!(startLifetime > 1E-06f)) ? 1f : Mathf.Clamp01(num4 / startLifetime)); } bool flag2 = FacingOpacity != null && FacingOpacity.length > 0; Vector3 val = Vector3.right; float num5 = 0f; Color32 item = default(Color32); ((Color32)(ref item))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0); float num6 = 0f; Vector3 val2 = Vector3.forward; Vector4 item2 = default(Vector4); for (int j = 0; j < num; j++) { float num7 = m_ageBuf[j]; Vector3 val3 = m_posBuf[Mathf.Min(j + 1, num - 1)] - m_posBuf[Mathf.Max(j - 1, 0)]; Vector3 val4 = m_posBuf[j] - camPos; Vector3 val5 = Vector3.Cross(val3, val4); if (((Vector3)(ref val5)).sqrMagnitude < 1E-12f) { val5 = val; } else { ((Vector3)(ref val5)).Normalize(); } val = val5; float num8 = ((SizeOverLife == null || SizeOverLife.length <= 0) ? SizeConstant : SizeOverLife.Evaluate(num7)); if (SizeBySpawnFraction != null && SizeBySpawnFraction.length > 0) { num8 *= SizeBySpawnFraction.Evaluate(m_fracBuf[j]); } float num9 = Mathf.Max(num8, 0f); float num10 = ((OpacityOverLife == null || OpacityOverLife.length <= 0) ? OpacityConstant : OpacityOverLife.Evaluate(num7)); if (OpacityBySpawnFraction != null && OpacityBySpawnFraction.length > 0) { num10 *= OpacityBySpawnFraction.Evaluate(m_fracBuf[j]); } if (SampleParentAlpha) { num10 *= EvaluateParentAlpha(ParentAge01(slot)); } if (flag2) { float magnitude = ((Vector3)(ref val3)).magnitude; if (magnitude > 1E-06f) { num10 *= FacingOpacity.Evaluate(Mathf.Clamp01(Mathf.Abs(Vector3.Dot(val3 / magnitude, ((Vector3)(ref val4)).normalized)))); } } Color val6 = ((ColorOverLife == null) ? Color.white : ColorOverLife.Evaluate(num7)); num10 *= 1f - Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((num7 - 0.85f) / 0.15f)); val6.a = Mathf.Clamp01(num10); Color32 val7 = Color32.op_Implicit(val6); float num11 = 1f - ((!StreamFromAge) ? m_fracBuf[j] : num7) * TextureFrequency; num11 -= Mathf.Floor(num11); if (FlipV) { num11 = 1f - num11; } float num12 = ((!FlipU) ? 0f : 1f); float num13 = ((!FlipU) ? 1f : 0f); Vector3 val8 = -((Vector3)(ref val4)).normalized; ((Vector4)(ref item2))..ctor(val5.x, val5.y, val5.z, -1f); m_verts.Add(m_posBuf[j] - val5 * num9); m_uvs.Add(new Vector2(num12, num11)); m_cols.Add(val7); m_norms.Add(val8); m_tans.Add(item2); m_verts.Add(m_posBuf[j] + val5 * num9); m_uvs.Add(new Vector2(num13, num11)); m_cols.Add(val7); m_norms.Add(val8); m_tans.Add(item2); num5 = num9; item = val7; num6 = num11; val2 = val8; } int num14 = num - 1; if (flag) { Vector3 pos = m_parents[slot].Pos; Vector3 item3 = pos - camPos; item3 = ((!(((Vector3)(ref item3)).sqrMagnitude < 1E-12f)) ? (-((Vector3)(ref item3)).normalized) : val2); Vector4 item4 = default(Vector4); ((Vector4)(ref item4))..ctor(val.x, val.y, val.z, -1f); float num15 = ((!FlipU) ? 0f : 1f); float num16 = ((!FlipU) ? 1f : 0f); m_verts.Add(pos - val * num5); m_uvs.Add(new Vector2(num15, num6)); m_cols.Add(item); m_norms.Add(item3); m_tans.Add(item4); m_verts.Add(pos + val * num5); m_uvs.Add(new Vector2(num16, num6)); m_cols.Add(item); m_norms.Add(item3); m_tans.Add(item4); num14 = num; } for (int k = 0; k < num14; k++) { int num17 = count + k * 2; m_tris.Add(num17); m_tris.Add(num17 + 2); m_tris.Add(num17 + 1); m_tris.Add(num17 + 1); m_tris.Add(num17 + 2); m_tris.Add(num17 + 3); m_tris.Add(num17); m_tris.Add(num17 + 1); m_tris.Add(num17 + 2); m_tris.Add(num17 + 1); m_tris.Add(num17 + 3); m_tris.Add(num17 + 2); } } private float EvaluateParentAlpha(float parentAge01) { if (ParentOpacityOverLife == null || ParentOpacityOverLife.length == 0) { return 1f; } return Mathf.Clamp01(ParentOpacityOverLife.Evaluate(Mathf.Clamp01(parentAge01))); } private static Vector3 ToWorldPoint(ParticleSystem ps, Vector3 p) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) MainModule main = ps.main; return ((int)((MainModule)(ref main)).simulationSpace != 1) ? ((Component)ps).transform.TransformPoint(p) : p; } private static Vector3 ToWorldVector(ParticleSystem ps, Vector3 v) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) MainModule main = ps.main; return ((int)((MainModule)(ref main)).simulationSpace != 1) ? ((Component)ps).transform.TransformVector(v) : v; } private static Camera ResolveViewerCamera() { if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled) { return s_viewerCamera; } s_viewerCamera = Camera.main; if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled) { return s_viewerCamera; } s_viewerCamera = Camera.current; if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled) { return s_viewerCamera; } Camera[] allCameras = Camera.allCameras; s_viewerCamera = ((allCameras == null || allCameras.Length <= 0) ? null : allCameras[0]); return s_viewerCamera; } } public class CustomWaggleJoint : MonoBehaviour { public float distanceLimit = 0.25f; public float angleLimitLeft = 45f; public float angleLimitRight = 45f; public float gravityScale = 1f; public bool useSpring; public float springApproachRate = 0.95f; public float damping; public Transform hingeGraphic; public Vector3 hingeGraphicRotationOffset; public bool invertWaggleAxis; public bool ManualExecution; public float onHitLimitCooldown = 0.05f; public Vector3 waggleAxis = Vector3.up; public Vector3 rotationAxis = Vector3.up; [Header("Gizmo Options")] public bool debugGizmos = false; public bool showRotationExtremes = false; public bool showRotationDirectionArrows = false; private Vector3 particlePos; private Vector3 particleVel; private bool leftCatchState; private bool rightCatchState; private float lastTouchTime = float.MinValue; private Vector3 EffectiveWaggleDir() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.TransformDirection((!invertWaggleAxis) ? waggleAxis : (-waggleAxis)); } private void GetEffectiveAngleLimits(out float effectiveAngleMin, out float effectiveAngleMax) { if (invertWaggleAxis) { effectiveAngleMin = 0f - angleLimitLeft; effectiveAngleMax = angleLimitRight; } else { effectiveAngleMin = 0f - angleLimitRight; effectiveAngleMax = angleLimitLeft; } } public void ResetParticlePos() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) particlePos = ((Component)this).transform.position + EffectiveWaggleDir() * distanceLimit; particleVel = Vector3.zero; } private void OnHitLimit(float angularVelocity) { } public void Execute() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) float deltaTime = Time.deltaTime; Transform transform = ((Component)this).transform; Vector3 val = Physics.gravity * gravityScale; Vector3 val2 = particlePos; Vector3 val3 = particleVel * Mathf.Pow(1f - damping, deltaTime) + val * deltaTime; Vector3 val4 = val2 + val3 * deltaTime; Vector3 val5 = transform.TransformDirection(((Vector3)(ref rotationAxis)).normalized); Vector3 val6 = EffectiveWaggleDir(); Vector3 position = transform.position; if (useSpring) { val4 = Vector3.Lerp(val4, position + val6 * distanceLimit, 1f - Mathf.Pow(1f - springApproachRate, deltaTime)); } GetEffectiveAngleLimits(out var effectiveAngleMin, out var effectiveAngleMax); particlePos = ProjectOnHinge(val4, position, val5, val6, distanceLimit, effectiveAngleMin, effectiveAngleMax); particleVel = (particlePos - val2) / deltaTime; if ((Object)(object)hingeGraphic != (Object)null) { hingeGraphic.rotation = Quaternion.LookRotation(particlePos - transform.position, val5) * Quaternion.Euler(hingeGraphicRotationOffset); } } private Vector3 ProjectOnHinge(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection, float distanceLimit, float angleMin, float angleMax) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) float num = ToHingeAngle(point, hingePivot, hingeAxis, hingeDirection); num = Mathf.Clamp(num, angleMin, angleMax); Vector3 val = Quaternion.AngleAxis(num, hingeAxis) * hingeDirection; return val * distanceLimit + hingePivot; } private float ToHingeAngle(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = point - hingePivot; Vector3 val2 = Vector3.ProjectOnPlane(val, hingeAxis); Vector3 normalized = ((Vector3)(ref val2)).normalized; return SignedAngle(hingeDirection, normalized, hingeAxis); } private float SignedAngle(Vector3 from, Vector3 to, Vector3 axis) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Angle(from, to); return num * Mathf.Sign(Vector3.Dot(axis, Vector3.Cross(from, to))); } private void Start() { ResetParticlePos(); } private void Update() { if (!ManualExecution) { Execute(); } } } public class DecalLayFlat : MonoBehaviour { private void Awake() { Flatten(); } private void OnEnable() { if (Application.isPlaying) { Flatten(); } } private void Flatten() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Quaternion rotation = ((Component)this).transform.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; ((Component)this).transform.rotation = Quaternion.Euler(90f, y, 0f); } } public class ExplosionLightFade : MonoBehaviour { public Light Light; public float BaseIntensity = 1f; public float Delay; public float Lifetime = 1f; public AnimationCurve IntensityOverLife; public float FlickerMin; public float FlickerMax; public float FlickerSpeed = 1f; private float startTime; private float noiseOffset; private void Awake() { if ((Object)(object)Light == (Object)null) { Light = ((Component)this).GetComponent(); } noiseOffset = Random.value * 1000f; } private void OnEnable() { startTime = Time.time; } private void Update() { if ((Object)(object)Light == (Object)null || Lifetime <= 0f) { return; } float num = (Time.time - startTime - Delay) / Lifetime; if (num < 0f) { Light.intensity = 0f; return; } if (num >= 1f) { ((Behaviour)Light).enabled = false; ((Behaviour)this).enabled = false; return; } float num2 = ((IntensityOverLife == null) ? 1f : Mathf.Max(0f, IntensityOverLife.Evaluate(num))); float num3 = 1f; if (FlickerMax > FlickerMin) { num3 = Mathf.Lerp(FlickerMin, FlickerMax, Mathf.PerlinNoise(Time.time * FlickerSpeed + noiseOffset, 0f)); } Light.intensity = BaseIntensity * num2 * num3; } } public class FireLightFlicker : MonoBehaviour { public Light Light; public float BaseIntensity = 1f; public float FlickerMin = 1f; public float FlickerMax = 1f; public float FlickerSpeed = 1f; private float noiseOffset; private void Awake() { if ((Object)(object)Light == (Object)null) { Light = ((Component)this).GetComponent(); } noiseOffset = Random.value * 1000f; } private void Update() { if (!((Object)(object)Light == (Object)null)) { float num = Mathf.PerlinNoise(Time.time * FlickerSpeed + noiseOffset, 0f); Light.intensity = BaseIntensity * Mathf.Lerp(FlickerMin, FlickerMax, num); } } } public class GunStockLace : MonoBehaviour { public float length = 0.5f; public float gravity = 9.81f; public float damping = 0.05f; public float maxDeviationAngle = 45f; public LayerMask collisionMask; public bool showGizmos = false; private Vector3 pendulumDirection; private Vector3 angularVelocity; private Quaternion baseRotation; private Vector3 restDirection; private Vector3 previousPosition; private void Start() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) baseRotation = ((Component)this).transform.rotation; restDirection = baseRotation * -Vector3.up; pendulumDirection = restDirection; previousPosition = ((Component)this).transform.position; } private void FixedUpdate() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position - previousPosition; previousPosition = ((Component)this).transform.position; float fixedDeltaTime = Time.fixedDeltaTime; Vector3 val2 = Vector3.Cross(((Vector3)(ref pendulumDirection)).normalized, Vector3.down) * gravity / length; Vector3 val3 = val * 10f / fixedDeltaTime; angularVelocity += (val2 + val3) * fixedDeltaTime; angularVelocity *= Mathf.Clamp01(1f - damping * fixedDeltaTime); Quaternion val4 = Quaternion.Euler(angularVelocity * fixedDeltaTime * 57.29578f); pendulumDirection = val4 * pendulumDirection; HandleCollisionLimits(); ClampToMaxAngle(); ((Component)this).transform.rotation = Quaternion.FromToRotation(-Vector3.up, pendulumDirection) * baseRotation; } private void HandleCollisionLimits() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)this).transform.position, pendulumDirection, ref val, length, LayerMask.op_Implicit(collisionMask))) { Vector3 normal = ((RaycastHit)(ref val)).normal; Vector3 val2 = Vector3.ProjectOnPlane(pendulumDirection, normal); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = Vector3.Angle(pendulumDirection, normalized); pendulumDirection = Vector3.RotateTowards(pendulumDirection, normalized, num * ((float)Math.PI / 180f), 0f); angularVelocity = Vector3.ProjectOnPlane(angularVelocity, normal); } } private void ClampToMaxAngle() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Angle(restDirection, pendulumDirection); if (num > maxDeviationAngle) { pendulumDirection = Vector3.RotateTowards(restDirection, pendulumDirection, maxDeviationAngle * ((float)Math.PI / 180f), 0f); angularVelocity *= 0.5f; } } private void OnDrawGizmos() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (showGizmos) { Gizmos.color = Color.yellow; Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + pendulumDirection * length); Gizmos.color = Color.red; Gizmos.DrawWireSphere(((Component)this).transform.position + pendulumDirection * length, 0.02f); } } } public class HuntDollarSR : MonoBehaviour { private IEnumerator Start() { yield return (object)new WaitForSeconds(3f); string str = "CharcoalBriquette(Clone)"; ((Object)((Component)this).gameObject).name = str; Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { Component val = (Component)(object)componentsInChildren[i]; ((Object)val.gameObject).name = str; } } } namespace BitWizrd.Rifle.Maynard { public class MaynardRifle : FVRFireArm { private enum HammerState { Uncocked, Cocked } [Header("Cartridge Chamber")] public FVRFireArmChamber Chamber; [Header("Lever / Breech")] [Tooltip("Support-hand grip point used to rack the lever open/closed, same as LeverShotgun's ForeGrip.")] public FVRAlternateGrip ForeGrip; public Transform Lever; [Tooltip("x = fully open, y = fully closed (0).")] public Vector2 LeverAngleRange = new Vector2(-68f, 0f); [Header("Barrel Cant (breech exposure)")] [Tooltip("Barrel pivots on this transform; canted downward when the lever is open to expose the chamber.")] public Transform Barrel; [Tooltip("Degrees the barrel tips down at full lever-open. Simple angle, tune by eye.")] public float BarrelCantAngle = 25f; [Header("Lever Link (connecting link between lever and barrel)")] [Tooltip("The link/bar that visually bridges the lever and the barrel underlug, rotating in tandem with both as the lever is worked.")] public Transform LeverLink; [Tooltip("x = fully open (lever open / barrel canted), y = fully closed (0). Tune by eye alongside BarrelCantAngle.")] public Vector2 LeverLinkAngleRange = new Vector2(-25f, 0f); [Header("Lever Feel Tuning")] [Tooltip("Degrees of tolerance for when the lever's current rotation counts as fully open or fully closed.")] public float LeverPositionTolerance = 1f; [Tooltip("How far apart (in meters) the player's hands need to move to fully cycle the lever from closed to open.")] public float RackingDistanceForFullPull = 0.04f; [Tooltip("Fraction (0-1) of Racking Distance For Full Pull the hands must move before the lever starts rotating at all.")] [Range(0f, 1f)] public float RackingDeadzoneFraction = 0.125f; [Tooltip("Fraction (0-1) of Racking Distance For Full Pull after which the lever snaps the rest of the way.")] [Range(0f, 1f)] public float RackingSnapFraction = 0.875f; [Tooltip("Seconds for the lever to swing fully open<->closed. Fixed duration rather than a fixed degrees/sec speed, so a wider LeverAngleRange doesn't slow the swing down.")] public float LeverSwingDuration = 0.12f; [Header("Hammer")] public Transform Hammer; public Vector2 HammerRots; [Header("Hammer Swipe-Cock (support hand thumbs the hammer back)")] public bool UseHammerSwipeToCock = true; public float HammerSwipeDistance = 0.15f; public float HammerSwipeAngle = 60f; public float HammerSwipeVelocity = 1f; [Header("Primer Flick-Eject (support hand knocks a spent cap off the nipple)")] public bool UsePrimerFlickEject = true; public float PrimerFlickDistance = 0.1f; public float PrimerFlickVelocity = 1f; [Tooltip("Blocks flick for this long after the hammer swipe-cocks, so the same swipe that pulls the hammer back can't also register as flicking the cap off in the same motion.")] public float PrimerFlickCooldownAfterCock = 0.25f; [Header("Trigger")] public Transform Trigger; public Vector2 TriggerRots; [Header("Percussion Nipple Chamber")] public FVRFireArmChamber NippleChamber; public ParticleSystem PrimerSparks; [Header("Debug")] [Tooltip("Bypasses the primer requirement so chamber/firing can be tested before the percussion cap system is built. Disable before shipping.")] public bool DebugSkipPrimer; private HammerState m_hammerState; private float m_triggerVal; private float m_curLeverRot; private float m_tarLeverRot; private bool m_isLeverClosed = true; private float m_curDistanceBetweenGrips = 1f; private float m_lastDistanceBetweenGrips = -1f; private float m_rackingDisplacement; private bool m_nippleWasFull; private bool m_chamberWasFull; private float m_hammerCockedAtTime = -999f; private List m_allChambers = new List(); private bool m_isFilteringChambers; private FireArmRoundType? m_lastFilteredType; private FireArmRoundType m_savedRoundType; public override void Awake() { //IL_00b4: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).Awake(); base.FChambers.Add(Chamber); base.FChambers.Add(NippleChamber); m_allChambers.Clear(); m_allChambers.AddRange(base.FChambers); Chamber.IsManuallyChamberable = true; Chamber.IsManuallyExtractable = true; NippleChamber.IsManuallyChamberable = true; NippleChamber.IsManuallyExtractable = true; Chamber.Firearm = (FVRFireArm)(object)this; m_hammerState = HammerState.Uncocked; if ((Object)(object)Hammer != (Object)null) { Hammer.localEulerAngles = new Vector3(HammerRots.x, 0f, 0f); } m_curLeverRot = LeverAngleRange.y; m_tarLeverRot = LeverAngleRange.y; if ((Object)(object)Lever != (Object)null) { Lever.localEulerAngles = new Vector3(m_curLeverRot, 0f, 0f); } if ((Object)(object)Barrel != (Object)null) { Barrel.localEulerAngles = Vector3.zero; } if ((Object)(object)LeverLink != (Object)null) { LeverLink.localEulerAngles = new Vector3(LeverLinkAngleRange.y, 0f, 0f); } } public override void EndInteraction(FVRViveHand hand) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).EndInteraction(hand); m_triggerVal = 0f; if ((Object)(object)Trigger != (Object)null) { Trigger.localEulerAngles = new Vector3(TriggerRots.x, 0f, 0f); } } public override void UpdateInteraction(FVRViveHand hand) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); UpdateLever(); m_triggerVal = hand.Input.TriggerFloat; if ((Object)(object)Trigger != (Object)null) { Trigger.localEulerAngles = new Vector3(Mathf.Lerp(TriggerRots.x, TriggerRots.y, m_triggerVal), 0f, 0f); } if (m_isLeverClosed && m_hammerState == HammerState.Cocked && !((FVRPhysicalObject)this).IsAltHeld && hand.Input.TriggerDown && ((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin) { DropHammer(); } HandleCockButtonInput(hand); HandleHammerSwipeCock(hand); HandlePrimerFlickEject(hand); } public override void FVRFixedUpdate() { //IL_007a: 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_011f: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).FVRFixedUpdate(); float num = Mathf.Abs(LeverAngleRange.x - LeverAngleRange.y) / Mathf.Max(LeverSwingDuration, 0.001f); m_curLeverRot = Mathf.MoveTowards(m_curLeverRot, m_tarLeverRot, num * Time.deltaTime); if ((Object)(object)Lever != (Object)null) { Lever.localEulerAngles = new Vector3(m_curLeverRot, 0f, 0f); } float num2 = Mathf.InverseLerp(LeverAngleRange.y, LeverAngleRange.x, m_curLeverRot); if ((Object)(object)Barrel != (Object)null) { Barrel.localEulerAngles = new Vector3(Mathf.Lerp(0f, BarrelCantAngle, num2), 0f, 0f); } if ((Object)(object)LeverLink != (Object)null) { LeverLink.localEulerAngles = new Vector3(Mathf.Lerp(LeverLinkAngleRange.y, LeverLinkAngleRange.x, num2), 0f, 0f); } if ((Object)(object)NippleChamber != (Object)null) { NippleChamber.IsAccessible = m_hammerState == HammerState.Cocked; } bool flag = (Object)(object)NippleChamber != (Object)null && NippleChamber.IsFull; bool flag2 = flag && !m_nippleWasFull; m_nippleWasFull = flag; if (flag2) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)52, 1f); } bool flag3 = (Object)(object)Chamber != (Object)null && Chamber.IsFull; bool flag4 = !flag3 && m_chamberWasFull; m_chamberWasFull = flag3; if (flag4) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)53, 1f); } } public override void FVRUpdate() { ((FVRFireArm)this).FVRUpdate(); CheckQuickBeltSlotsForAmmo(); } private void CheckQuickBeltSlotsForAmmo() { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) FVRViveHand val = null; FVRViveHand[] hands = GM.CurrentMovementManager.Hands; foreach (FVRViveHand val2 in hands) { if ((Object)(object)val2.CurrentInteractable == (Object)(object)this) { val = val2; break; } } if ((Object)(object)val == (Object)null) { return; } FVRViveHand val3 = ((!((Object)(object)val == (Object)(object)GM.CurrentMovementManager.Hands[0])) ? GM.CurrentMovementManager.Hands[0] : GM.CurrentMovementManager.Hands[1]); if ((Object)(object)val3.CurrentHoveredQuickbeltSlot != (Object)null && val3.CurrentHoveredQuickbeltSlot.HeldObject is FVRFireArmRound) { FVRInteractiveObject heldObject = val3.CurrentHoveredQuickbeltSlot.HeldObject; FVRFireArmRound val4 = (FVRFireArmRound)(object)((heldObject is FVRFireArmRound) ? heldObject : null); if (m_isFilteringChambers) { FireArmRoundType? lastFilteredType = m_lastFilteredType; if (lastFilteredType.GetValueOrDefault() == val4.RoundType && lastFilteredType.HasValue) { return; } } FilterChambersForRoundType(val4.RoundType); } else if (m_isFilteringChambers) { RestoreAllChambers(); } } private void FilterChambersForRoundType(FireArmRoundType roundType) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) m_isFilteringChambers = true; m_lastFilteredType = roundType; m_savedRoundType = base.RoundType; base.RoundType = roundType; base.FChambers.Clear(); foreach (FVRFireArmChamber allChamber in m_allChambers) { if (allChamber.RoundType == roundType) { base.FChambers.Add(allChamber); } } } private void RestoreAllChambers() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) base.RoundType = m_savedRoundType; m_isFilteringChambers = false; m_lastFilteredType = null; base.FChambers.Clear(); base.FChambers.AddRange(m_allChambers); } private void UpdateLever() { //IL_0045: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (!((FVRPhysicalObject)this).IsAltHeld && (Object)(object)ForeGrip != (Object)null && (Object)(object)((FVRInteractiveObject)ForeGrip).m_hand != (Object)null) { m_curDistanceBetweenGrips = Vector3.Distance(((FVRInteractiveObject)this).m_hand.PalmTransform.position, ((FVRInteractiveObject)ForeGrip).m_hand.PalmTransform.position); if (m_lastDistanceBetweenGrips < 0f) { m_lastDistanceBetweenGrips = m_curDistanceBetweenGrips; } Vector3 val = ((FVRInteractiveObject)this).m_hand.Input.VelLinearWorld - ((FVRInteractiveObject)ForeGrip).m_hand.Input.VelLinearWorld; float num = ((Vector3)(ref val)).magnitude * Time.deltaTime * 2f; float num2 = Mathf.Clamp(m_lastDistanceBetweenGrips - m_curDistanceBetweenGrips, 0f - num, num); if ((Object)(object)Chamber != (Object)null && Chamber.IsFull && !Chamber.IsSpent) { bool flag = ((!((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode) ? ((FVRInteractiveObject)this).m_hand.Input.TouchpadPressed : ((FVRInteractiveObject)this).m_hand.Input.BYButtonPressed); if (num2 > 0f && !flag) { num2 = 0f; } } m_rackingDisplacement += num2; m_rackingDisplacement = Mathf.Clamp(m_rackingDisplacement, 0f, RackingDistanceForFullPull); if (m_rackingDisplacement < RackingDeadzoneFraction * RackingDistanceForFullPull) { m_rackingDisplacement = 0f; } if (m_rackingDisplacement > RackingSnapFraction * RackingDistanceForFullPull) { m_rackingDisplacement = RackingDistanceForFullPull; } m_tarLeverRot = Mathf.Lerp(LeverAngleRange.y, LeverAngleRange.x, m_rackingDisplacement / RackingDistanceForFullPull); m_lastDistanceBetweenGrips = m_curDistanceBetweenGrips; } else { m_lastDistanceBetweenGrips = -1f; } bool isLeverClosed = m_isLeverClosed; m_isLeverClosed = Mathf.Abs(m_curLeverRot - LeverAngleRange.y) < LeverPositionTolerance; if (m_isLeverClosed != isLeverClosed) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)((!m_isLeverClosed) ? 17 : 18), 1f); } Chamber.IsAccessible = !m_isLeverClosed; base.IsBreachOpenForGasOut = !m_isLeverClosed && !Chamber.IsFull; } private void HandleCockButtonInput(FVRViveHand hand) { if (hand.IsInStreamlinedMode) { if (hand.Input.AXButtonDown) { HandleDownwardAction(); } if (hand.Input.BYButtonDown) { HandleUpwardAction(); } } else if (hand.Input.TouchpadDown) { if (hand.Input.TouchpadAxes.y > 0f) { HandleUpwardAction(); } else { HandleDownwardAction(); } } } private void HandleDownwardAction() { if (m_hammerState == HammerState.Uncocked) { CockHammer(); } else if (m_isLeverClosed) { m_rackingDisplacement = RackingDistanceForFullPull; m_tarLeverRot = LeverAngleRange.x; } } private void HandleUpwardAction() { if (!m_isLeverClosed) { m_rackingDisplacement = 0f; m_tarLeverRot = LeverAngleRange.y; } else { DecockHammer(); } } private void HandleHammerSwipeCock(FVRViveHand hand) { //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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if (UseHammerSwipeToCock && !((Object)(object)Hammer == (Object)null) && m_hammerState != HammerState.Cocked && ((FVRInteractiveObject)this).IsHeld && !((Object)(object)hand.OtherHand == (Object)null) && !((Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null) && !((FVRFireArm)this).IsTwoHandStabilized()) { FVRViveHand otherHand = hand.OtherHand; Vector3 velLinearWorld = otherHand.Input.VelLinearWorld; float num = Vector3.Distance(otherHand.PalmTransform.position, Hammer.position); if (!(num > HammerSwipeDistance) && !(((Vector3)(ref velLinearWorld)).magnitude <= HammerSwipeVelocity) && Vector3.Angle(velLinearWorld, -((Component)this).transform.forward) < HammerSwipeAngle) { CockHammer(); } } } private void HandlePrimerFlickEject(FVRViveHand hand) { if (UsePrimerFlickEject && !((Object)(object)NippleChamber == (Object)null) && NippleChamber.IsFull && NippleChamber.IsSpent && NippleChamber.IsAccessible && !(Time.time - m_hammerCockedAtTime < PrimerFlickCooldownAfterCock) && ((FVRInteractiveObject)this).IsHeld && !((Object)(object)hand.OtherHand == (Object)null) && !((Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null) && !((FVRFireArm)this).IsTwoHandStabilized()) { TryFlickWithHand(hand.OtherHand); } } private void TryFlickWithHand(FVRViveHand h) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_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_0068: Unknown result type (might be due to invalid IL or missing references) Vector3 velLinearWorld = h.Input.VelLinearWorld; float num = Vector3.Distance(h.PalmTransform.position, ((Component)NippleChamber).transform.position); if (!(num > PrimerFlickDistance) && !(((Vector3)(ref velLinearWorld)).magnitude <= PrimerFlickVelocity)) { NippleChamber.EjectRound(((Component)NippleChamber).transform.position, velLinearWorld, Vector3.zero, false); ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)50, 1f); } } private void CockHammer() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (m_hammerState != HammerState.Cocked) { m_hammerState = HammerState.Cocked; m_hammerCockedAtTime = Time.time; if ((Object)(object)Hammer != (Object)null) { Hammer.localEulerAngles = new Vector3(HammerRots.y, 0f, 0f); } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); } } private void DecockHammer() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (m_hammerState != HammerState.Uncocked) { m_hammerState = HammerState.Uncocked; if ((Object)(object)Hammer != (Object)null) { Hammer.localEulerAngles = new Vector3(HammerRots.x, 0f, 0f); } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); } } private void DropHammer() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) m_hammerState = HammerState.Uncocked; if ((Object)(object)Hammer != (Object)null) { Hammer.localEulerAngles = new Vector3(HammerRots.x, 0f, 0f); } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); if (!DebugSkipPrimer) { if ((Object)(object)NippleChamber == (Object)null || !NippleChamber.IsFull || NippleChamber.IsSpent) { return; } NippleChamber.Fire(); FVRFireArmRound round = NippleChamber.GetRound(); if ((Object)(object)round != (Object)null) { round.Fire(); } if ((Object)(object)PrimerSparks != (Object)null) { PrimerSparks.Emit(12); } if (!((Object)(object)Chamber != (Object)null) || !Chamber.IsFull || Chamber.IsSpent) { ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)51, 1f); } } if ((Object)(object)Chamber != (Object)null && Chamber.IsFull && !Chamber.IsSpent) { Fire(); } } private void Fire() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (Chamber.Fire()) { ((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); ((FVRFireArm)this).Recoil(((FVRFireArm)this).IsTwoHandStabilized(), (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null, ((FVRFireArm)this).IsShoulderStabilized(), (FVRFireArmRecoilProfile)null, 1f); ((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); } } public override List GetChamberRoundList() { //IL_0044: 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) List list = new List(); if ((Object)(object)Chamber != (Object)null && Chamber.IsFull && !Chamber.IsSpent) { list.Add(Chamber.GetRound().RoundClass); } if ((Object)(object)NippleChamber != (Object)null && NippleChamber.IsFull && !NippleChamber.IsSpent) { list.Add(NippleChamber.GetRound().RoundClass); } return (list.Count <= 0) ? null : list; } public override void SetLoadedChambers(List rounds) { //IL_0015: 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) if (rounds.Count > 0) { Chamber.Autochamber(rounds[0]); } if (rounds.Count > 1) { NippleChamber.Autochamber(rounds[1]); } } public override void ConfigureFromFlagDic(Dictionary f) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (f.TryGetValue("HammerState", out var value) && value == "Cocked") { m_hammerState = HammerState.Cocked; if ((Object)(object)Hammer != (Object)null) { Hammer.localEulerAngles = new Vector3(HammerRots.y, 0f, 0f); } } ((FVRFireArm)this).ConfigureFromFlagDic(f); } public override Dictionary GetFlagDic() { Dictionary flagDic = ((FVRFireArm)this).GetFlagDic(); flagDic.Add("HammerState", (m_hammerState != HammerState.Cocked) ? "Uncocked" : "Cocked"); return flagDic; } } } [ExecuteInEditMode] public class ParticleAffectorCoordinator : MonoBehaviour { [Serializable] public struct BeamConfig { public Transform SourceTransform; public Vector3 SourceOffset; public Transform DestTransform; public Vector3 DestOffset; public bool HasLine; } [Serializable] public struct LocationOffsetEntry { public Vector3 Direction; public float ScaleMin; public float ScaleMax; } [Serializable] public struct VelocityExtraEntry { public Vector3 Direction; public float ConeAngleDeg; public float SpeedMin; public float SpeedMax; } [Serializable] public struct ConeParams { public float AngleMin; public float AngleMax; public float Inner; public string SFCurve; public string RandCurve; } [Serializable] public struct CompassEntry { public float PolarBaseDeg; public string PolarCurve; public float AzimuthBaseDeg; public string AzimuthCurve; public float AzimuthOriginDeg; public ConeParams Cone; public float SpeedMin; public float SpeedMax; public string SpeedCurve; public string SpeedRandomCurve; } [Serializable] public struct ConeEntry { public Vector3 Axis; public ConeParams Cone; public float SpeedMin; public float SpeedMax; public string SpeedCurve; public string SpeedRandomCurve; } [Serializable] public struct RadialVelocityEntry { public bool Sphere; public Vector3 Axis; public Vector3 Scale; public float InnerFraction; public float SpeedMin; public float SpeedMax; public string SpeedCurve; } [Serializable] public struct GravityEntry { public bool UseAxis; public float Accel; public float Decay; public Vector3 Axis; public Transform Target; } [Serializable] public struct VortexEntry { public float Speed; public float Decay; public Vector3 Axis; public Transform Target; public float Drag; } private sealed class LinearCurve { private readonly float[] t; private readonly float[] v; public LinearCurve(string keys) { string[] array = keys.Split(new char[1] { ';' }); t = new float[array.Length]; v = new float[array.Length]; for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { ',' }); t[i] = float.Parse(array2[0], CultureInfo.InvariantCulture); v[i] = float.Parse(array2[1], CultureInfo.InvariantCulture); } } public float Evaluate(float x) { if (x <= t[0]) { return v[0]; } for (int i = 1; i < t.Length; i++) { if (x <= t[i]) { float num = t[i] - t[i - 1]; float num2 = ((!(num > 1E-06f)) ? 1f : ((x - t[i - 1]) / num)); return Mathf.Lerp(v[i - 1], v[i], num2); } } return v[v.Length - 1]; } } public ParticleSystem Ps; public bool HasBeam; public BeamConfig Beam; public LocationOffsetEntry[] LocationOffsets; public string[] LocationOffsetScaleCurveKeysStrs; [NonSerialized] private AnimationCurve[] _locationOffsetScaleCurves; public VelocityExtraEntry[] VelocityExtras; public CompassEntry[] CompassEntries; public RadialVelocityEntry[] RadialVelocities; public ConeEntry[] ConeEntries; public int SpawnCountHint = 1; public GravityEntry[] GravityEntries; public VortexEntry[] VortexEntries; public bool HasGravityDrag; public float GravityDrag; public bool HasUniformAccel; public Vector3 UniformAccel; public AnimationCurve UniformAccelCurve; private static readonly bool UnityUsesNewVelocityForPosition = true; public bool HasDragCurve; public AnimationCurve DragCurve; public Vector3 DragWind; public bool HasDragRandom; public float DragRandomMin; public float DragRandomMax; public bool HasFacingFade; public bool FreeVelocityOrient; public float FreeTwistMinDeg; public float FreeTwistMaxDeg; public AnimationCurve FacingSizeCurve; public AnimationCurve FacingOpacityCurve; private readonly Dictionary _facingBase = new Dictionary(); private readonly List _facingPrune = new List(); public bool HasPixelClamp; public float PixelSizeMin; public float PixelSizeMax; public bool PixelSizeMaxInfinite; public bool PixelSizeAffectOpacity; public float MaxCameraDistance; [NonSerialized] private ParticleSystemRenderer _cullRenderer; public bool HasMoveRelativeToEmitter; public Transform MoveRelEmitter; public float MoveRelPositionInherit; public float MoveRelVelocityInherit; public bool HasAlignRotation; public Transform AlignParentTransform; public Vector3 AlignAxisLocal; [NonSerialized] private Vector3 _alignTargetWorldDir; public Quaternion ShapeAimRotation = Quaternion.identity; [NonSerialized] private Quaternion _inverseShapeAim = Quaternion.identity; private Particle[] buffer; private Vector3 beamSourceWorld; private Vector3 beamDestWorld; private Vector3 lastEmitterPos; private Quaternion lastEmitterRot; private HashSet lastFrameSeeds = new HashSet(); private HashSet currentFrameSeeds = new HashSet(); public static readonly List EditInstances = new List(); public ParticleSystem ParentFramePs; public ParticleAffectorCoordinator ParentFrameCoord; public Vector3 ParentAlignAxis; public bool ParentFrameUnique; public bool ParentCollides; public float ParentFrameScatterDeg; [NonSerialized] private int _processedFrame = -1; [NonSerialized] private int _parentLoadFrame = -1; [NonSerialized] private int _parentCount; [NonSerialized] private Particle[] _parentBuf; [NonSerialized] private bool[] _parentTaken; private static Camera s_viewerCamera; [NonSerialized] private int _spawnRank; [NonSerialized] private LinearCurve[] _compassPolar; [NonSerialized] private LinearCurve[] _compassAzimuth; [NonSerialized] private LinearCurve[] _compassSpeed; [NonSerialized] private LinearCurve[] _compassSpeedRand; [NonSerialized] private LinearCurve[] _radialSpeed; [NonSerialized] private LinearCurve[] _compassConeSF; [NonSerialized] private LinearCurve[] _compassConeRand; [NonSerialized] private LinearCurve[] _coneSF; [NonSerialized] private LinearCurve[] _coneRand; [NonSerialized] private LinearCurve[] _coneSpeed; [NonSerialized] private LinearCurve[] _coneSpeedRand; private void OnEnable() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) _spawnRank = 0; _processedFrame = -1; _parentLoadFrame = -1; if (HasMoveRelativeToEmitter) { Transform val = ((!((Object)(object)MoveRelEmitter != (Object)null)) ? ((Component)this).transform : MoveRelEmitter); lastEmitterPos = val.position; lastEmitterRot = val.rotation; } if (!Application.isPlaying && !EditInstances.Contains(this)) { EditInstances.Add(this); } } private void OnDisable() { EditInstances.Remove(this); } public void EditorTick() { if (!Application.isPlaying && !((Object)(object)this == (Object)null)) { Process(); } } private bool TryParentFrame(Vector3 pos, float childAge, out Quaternion q) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) q = Quaternion.identity; if ((Object)(object)ParentFramePs == (Object)null || ((Vector3)(ref ParentAlignAxis)).sqrMagnitude < 1E-06f) { return false; } if (_parentLoadFrame != CryEditClock.Frame) { _parentLoadFrame = CryEditClock.Frame; MainModule main = ParentFramePs.main; int maxParticles = ((MainModule)(ref main)).maxParticles; if (_parentBuf == null || _parentBuf.Length < maxParticles) { _parentBuf = (Particle[])(object)new Particle[maxParticles]; _parentTaken = new bool[maxParticles]; } _parentCount = ParentFramePs.GetParticles(_parentBuf); Array.Clear(_parentTaken, 0, _parentTaken.Length); } float num = 0.05f + CryEditClock.Dt * 2f; int num2 = -1; float num3 = float.MaxValue; for (int i = 0; i < _parentCount; i++) { if (ParentFrameUnique && _parentTaken[i]) { continue; } Particle val = _parentBuf[i]; if (Mathf.Abs(((Particle)(ref val)).startLifetime - ((Particle)(ref val)).remainingLifetime - childAge) > num) { continue; } Vector3 velocity = ((Particle)(ref val)).velocity; if (!(((Vector3)(ref velocity)).sqrMagnitude < 1E-06f)) { Vector3 val2 = ((Particle)(ref val)).position - pos; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num3) { num3 = sqrMagnitude; num2 = i; } } } if (num2 < 0) { return false; } if (ParentFrameUnique) { _parentTaken[num2] = true; } Vector3 normalized = ((Vector3)(ref ParentAlignAxis)).normalized; Vector3 val3 = ParentDirection(num2); q = Quaternion.FromToRotation(normalized, ((Vector3)(ref val3)).normalized); if (ParentFrameScatterDeg > 0.01f) { Vector3 val4 = q * ((Vector3)(ref ParentAlignAxis)).normalized; Vector3 val5 = Vector3.Cross(val4, Random.onUnitSphere); if (((Vector3)(ref val5)).sqrMagnitude > 1E-06f) { q = Quaternion.AngleAxis(ParentFrameScatterDeg * Mathf.Sqrt(Random.value), ((Vector3)(ref val5)).normalized) * q; } } return true; } private Vector3 ParentDirection(int i) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) Vector3 velocity = ((Particle)(ref _parentBuf[i])).velocity; if (ParentCollides && velocity.y < 0f && GroundBelow(((Particle)(ref _parentBuf[i])).position, velocity)) { velocity.y = 0f - velocity.y; } return velocity; } private bool GroundBelow(Vector3 pos, Vector3 vel) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!Application.isPlaying) { return true; } Vector3 val = pos; Vector3 val2 = vel; if ((Object)(object)Ps != (Object)null) { MainModule main = Ps.main; if ((int)((MainModule)(ref main)).simulationSpace != 1) { val = ((Component)this).transform.TransformPoint(pos); val2 = ((Component)this).transform.TransformDirection(vel); } } if (((Vector3)(ref val2)).sqrMagnitude < 1E-08f) { return false; } return Physics.Raycast(val, ((Vector3)(ref val2)).normalized, 6f, -1, (QueryTriggerInteraction)1); } private void Awake() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Ps == (Object)null) { Ps = ((Component)this).GetComponent(); } Quaternion val = ShapeAimRotation; if (val.x == 0f && val.y == 0f && val.z == 0f && val.w == 0f) { val = Quaternion.identity; } _inverseShapeAim = Quaternion.Inverse(val); BuildSpawnVelocityCurves(); if (LocationOffsetScaleCurveKeysStrs != null && LocationOffsetScaleCurveKeysStrs.Length > 0) { _locationOffsetScaleCurves = (AnimationCurve[])(object)new AnimationCurve[LocationOffsetScaleCurveKeysStrs.Length]; for (int i = 0; i < LocationOffsetScaleCurveKeysStrs.Length; i++) { _locationOffsetScaleCurves[i] = ParseScaleCurveKeysStr(LocationOffsetScaleCurveKeysStrs[i]); } } if (HasBeam) { Vector3 val2 = ((!((Object)(object)Beam.SourceTransform != (Object)null)) ? ((Component)this).transform.position : Beam.SourceTransform.position); Vector3 val3 = ((!((Object)(object)Beam.DestTransform != (Object)null)) ? ((Component)this).transform.position : Beam.DestTransform.position); beamSourceWorld = val2 + Beam.SourceOffset; beamDestWorld = val3 + Beam.DestOffset; if (Beam.HasLine && Application.isPlaying) { LineRenderer val4 = ((Component)this).GetComponent(); if ((Object)(object)val4 == (Object)null) { val4 = ((Component)this).gameObject.AddComponent(); } ParticleSystemRenderer component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { ((Renderer)val4).material = ((Renderer)component).sharedMaterial; } val4.useWorldSpace = true; val4.positionCount = 2; val4.SetPosition(0, beamSourceWorld); val4.SetPosition(1, beamDestWorld); } } if (HasMoveRelativeToEmitter) { if ((Object)(object)MoveRelEmitter == (Object)null) { MoveRelEmitter = ((Component)this).transform; } lastEmitterPos = MoveRelEmitter.position; lastEmitterRot = MoveRelEmitter.rotation; } if (HasAlignRotation) { Quaternion val5 = ((!((Object)(object)AlignParentTransform != (Object)null)) ? Quaternion.identity : AlignParentTransform.rotation); Vector3 val6 = val5 * AlignAxisLocal; _alignTargetWorldDir = ((Vector3)(ref val6)).normalized; } } private void LateUpdate() { Process(); } private void Process() { if (_processedFrame != CryEditClock.Frame) { _processedFrame = CryEditClock.Frame; if ((Object)(object)ParentFrameCoord != (Object)null) { ParentFrameCoord.Process(); } ProcessCore(); } } private void ProcessCore() { //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_148f: Unknown result type (might be due to invalid IL or missing references) //IL_1491: Unknown result type (might be due to invalid IL or missing references) //IL_149d: Unknown result type (might be due to invalid IL or missing references) //IL_14a2: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Invalid comparison between Unknown and I4 //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_07f5: Unknown result type (might be due to invalid IL or missing references) //IL_07fa: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_0629: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_0a0a: Unknown result type (might be due to invalid IL or missing references) //IL_0a0f: Unknown result type (might be due to invalid IL or missing references) //IL_0888: Unknown result type (might be due to invalid IL or missing references) //IL_088b: Unknown result type (might be due to invalid IL or missing references) //IL_0892: Unknown result type (might be due to invalid IL or missing references) //IL_0897: Unknown result type (might be due to invalid IL or missing references) //IL_089c: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06b0: Unknown result type (might be due to invalid IL or missing references) //IL_06c4: Unknown result type (might be due to invalid IL or missing references) //IL_06f7: Unknown result type (might be due to invalid IL or missing references) //IL_06f9: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0556: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_08ec: Unknown result type (might be due to invalid IL or missing references) //IL_08dc: Unknown result type (might be due to invalid IL or missing references) //IL_0a65: Unknown result type (might be due to invalid IL or missing references) //IL_0a55: Unknown result type (might be due to invalid IL or missing references) //IL_08f1: Unknown result type (might be due to invalid IL or missing references) //IL_0719: Unknown result type (might be due to invalid IL or missing references) //IL_0732: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_073b: Unknown result type (might be due to invalid IL or missing references) //IL_0740: Unknown result type (might be due to invalid IL or missing references) //IL_0c85: Unknown result type (might be due to invalid IL or missing references) //IL_0c87: Unknown result type (might be due to invalid IL or missing references) //IL_0c89: Unknown result type (might be due to invalid IL or missing references) //IL_0c8b: Unknown result type (might be due to invalid IL or missing references) //IL_0c8d: Unknown result type (might be due to invalid IL or missing references) //IL_0c8f: Unknown result type (might be due to invalid IL or missing references) //IL_0c96: Unknown result type (might be due to invalid IL or missing references) //IL_0c9b: Unknown result type (might be due to invalid IL or missing references) //IL_0ca0: Unknown result type (might be due to invalid IL or missing references) //IL_0a6a: Unknown result type (might be due to invalid IL or missing references) //IL_091a: Unknown result type (might be due to invalid IL or missing references) //IL_0910: Unknown result type (might be due to invalid IL or missing references) //IL_0768: Unknown result type (might be due to invalid IL or missing references) //IL_0781: Unknown result type (might be due to invalid IL or missing references) //IL_0783: Unknown result type (might be due to invalid IL or missing references) //IL_0788: Unknown result type (might be due to invalid IL or missing references) //IL_078d: Unknown result type (might be due to invalid IL or missing references) //IL_0a93: Unknown result type (might be due to invalid IL or missing references) //IL_0a89: Unknown result type (might be due to invalid IL or missing references) //IL_091f: Unknown result type (might be due to invalid IL or missing references) //IL_0921: Unknown result type (might be due to invalid IL or missing references) //IL_0923: Unknown result type (might be due to invalid IL or missing references) //IL_0925: Unknown result type (might be due to invalid IL or missing references) //IL_092a: Unknown result type (might be due to invalid IL or missing references) //IL_07b5: Unknown result type (might be due to invalid IL or missing references) //IL_07ce: Unknown result type (might be due to invalid IL or missing references) //IL_07d2: Unknown result type (might be due to invalid IL or missing references) //IL_07d7: Unknown result type (might be due to invalid IL or missing references) //IL_07dc: Unknown result type (might be due to invalid IL or missing references) //IL_0d08: Unknown result type (might be due to invalid IL or missing references) //IL_0d0a: Unknown result type (might be due to invalid IL or missing references) //IL_0d11: Unknown result type (might be due to invalid IL or missing references) //IL_0d16: Unknown result type (might be due to invalid IL or missing references) //IL_0d1b: Unknown result type (might be due to invalid IL or missing references) //IL_0a98: Unknown result type (might be due to invalid IL or missing references) //IL_0a9a: Unknown result type (might be due to invalid IL or missing references) //IL_0a9c: Unknown result type (might be due to invalid IL or missing references) //IL_0a9e: Unknown result type (might be due to invalid IL or missing references) //IL_0aa3: Unknown result type (might be due to invalid IL or missing references) //IL_0d59: Unknown result type (might be due to invalid IL or missing references) //IL_0d5b: Unknown result type (might be due to invalid IL or missing references) //IL_0d65: Unknown result type (might be due to invalid IL or missing references) //IL_0d6a: Unknown result type (might be due to invalid IL or missing references) //IL_0d6f: Unknown result type (might be due to invalid IL or missing references) //IL_0d27: Unknown result type (might be due to invalid IL or missing references) //IL_0d29: Unknown result type (might be due to invalid IL or missing references) //IL_0d2b: Unknown result type (might be due to invalid IL or missing references) //IL_0d2d: Unknown result type (might be due to invalid IL or missing references) //IL_0d34: Unknown result type (might be due to invalid IL or missing references) //IL_0d39: Unknown result type (might be due to invalid IL or missing references) //IL_0d43: Unknown result type (might be due to invalid IL or missing references) //IL_0d48: Unknown result type (might be due to invalid IL or missing references) //IL_0d4d: Unknown result type (might be due to invalid IL or missing references) //IL_0d52: Unknown result type (might be due to invalid IL or missing references) //IL_0ad7: Unknown result type (might be due to invalid IL or missing references) //IL_0ad9: Unknown result type (might be due to invalid IL or missing references) //IL_0adb: Unknown result type (might be due to invalid IL or missing references) //IL_0ae0: Unknown result type (might be due to invalid IL or missing references) //IL_0ae2: Unknown result type (might be due to invalid IL or missing references) //IL_0ae4: Unknown result type (might be due to invalid IL or missing references) //IL_0ae6: Unknown result type (might be due to invalid IL or missing references) //IL_0ae8: Unknown result type (might be due to invalid IL or missing references) //IL_0aef: Unknown result type (might be due to invalid IL or missing references) //IL_0af4: Unknown result type (might be due to invalid IL or missing references) //IL_0af9: Unknown result type (might be due to invalid IL or missing references) //IL_0afb: Unknown result type (might be due to invalid IL or missing references) //IL_0b00: Unknown result type (might be due to invalid IL or missing references) //IL_099d: Unknown result type (might be due to invalid IL or missing references) //IL_099f: Unknown result type (might be due to invalid IL or missing references) //IL_09a1: Unknown result type (might be due to invalid IL or missing references) //IL_09a6: Unknown result type (might be due to invalid IL or missing references) //IL_096b: Unknown result type (might be due to invalid IL or missing references) //IL_096d: Unknown result type (might be due to invalid IL or missing references) //IL_096f: Unknown result type (might be due to invalid IL or missing references) //IL_0974: Unknown result type (might be due to invalid IL or missing references) //IL_0976: Unknown result type (might be due to invalid IL or missing references) //IL_0978: Unknown result type (might be due to invalid IL or missing references) //IL_097a: Unknown result type (might be due to invalid IL or missing references) //IL_097c: Unknown result type (might be due to invalid IL or missing references) //IL_0983: Unknown result type (might be due to invalid IL or missing references) //IL_0988: Unknown result type (might be due to invalid IL or missing references) //IL_098d: Unknown result type (might be due to invalid IL or missing references) //IL_098f: Unknown result type (might be due to invalid IL or missing references) //IL_0994: Unknown result type (might be due to invalid IL or missing references) //IL_1192: Unknown result type (might be due to invalid IL or missing references) //IL_11a6: Unknown result type (might be due to invalid IL or missing references) //IL_0da7: Unknown result type (might be due to invalid IL or missing references) //IL_0da9: Unknown result type (might be due to invalid IL or missing references) //IL_0dac: Unknown result type (might be due to invalid IL or missing references) //IL_0db1: Unknown result type (might be due to invalid IL or missing references) //IL_0db6: Unknown result type (might be due to invalid IL or missing references) //IL_0dbb: Unknown result type (might be due to invalid IL or missing references) //IL_0dbd: Unknown result type (might be due to invalid IL or missing references) //IL_0dc2: Unknown result type (might be due to invalid IL or missing references) //IL_0dc4: Unknown result type (might be due to invalid IL or missing references) //IL_0dc6: Unknown result type (might be due to invalid IL or missing references) //IL_0dce: Unknown result type (might be due to invalid IL or missing references) //IL_0dd3: Unknown result type (might be due to invalid IL or missing references) //IL_0b2d: Unknown result type (might be due to invalid IL or missing references) //IL_0b31: Unknown result type (might be due to invalid IL or missing references) //IL_0b36: Unknown result type (might be due to invalid IL or missing references) //IL_0b38: Unknown result type (might be due to invalid IL or missing references) //IL_0b3f: Unknown result type (might be due to invalid IL or missing references) //IL_0b44: Unknown result type (might be due to invalid IL or missing references) //IL_0b49: Unknown result type (might be due to invalid IL or missing references) //IL_0e83: Unknown result type (might be due to invalid IL or missing references) //IL_0e88: Unknown result type (might be due to invalid IL or missing references) //IL_0e9f: Unknown result type (might be due to invalid IL or missing references) //IL_0de7: Unknown result type (might be due to invalid IL or missing references) //IL_0de9: Unknown result type (might be due to invalid IL or missing references) //IL_0deb: Unknown result type (might be due to invalid IL or missing references) //IL_0df0: Unknown result type (might be due to invalid IL or missing references) //IL_0df2: Unknown result type (might be due to invalid IL or missing references) //IL_0df4: Unknown result type (might be due to invalid IL or missing references) //IL_0dfc: Unknown result type (might be due to invalid IL or missing references) //IL_0e01: Unknown result type (might be due to invalid IL or missing references) //IL_09d4: Unknown result type (might be due to invalid IL or missing references) //IL_09d8: Unknown result type (might be due to invalid IL or missing references) //IL_09df: Unknown result type (might be due to invalid IL or missing references) //IL_09e4: Unknown result type (might be due to invalid IL or missing references) //IL_09e9: Unknown result type (might be due to invalid IL or missing references) //IL_1075: Unknown result type (might be due to invalid IL or missing references) //IL_107a: Unknown result type (might be due to invalid IL or missing references) //IL_107e: Unknown result type (might be due to invalid IL or missing references) //IL_1084: Invalid comparison between Unknown and I4 //IL_0ec0: Unknown result type (might be due to invalid IL or missing references) //IL_0eb4: Unknown result type (might be due to invalid IL or missing references) //IL_0eb6: Unknown result type (might be due to invalid IL or missing references) //IL_1096: Unknown result type (might be due to invalid IL or missing references) //IL_1098: Unknown result type (might be due to invalid IL or missing references) //IL_1089: Unknown result type (might be due to invalid IL or missing references) //IL_0ec2: Unknown result type (might be due to invalid IL or missing references) //IL_109d: Unknown result type (might be due to invalid IL or missing references) //IL_10a1: Unknown result type (might be due to invalid IL or missing references) //IL_10a6: Unknown result type (might be due to invalid IL or missing references) //IL_10af: Unknown result type (might be due to invalid IL or missing references) //IL_10b4: Unknown result type (might be due to invalid IL or missing references) //IL_10b9: Unknown result type (might be due to invalid IL or missing references) //IL_10bb: Unknown result type (might be due to invalid IL or missing references) //IL_10bd: Unknown result type (might be due to invalid IL or missing references) //IL_10bf: Unknown result type (might be due to invalid IL or missing references) //IL_10c6: Unknown result type (might be due to invalid IL or missing references) //IL_10c8: Unknown result type (might be due to invalid IL or missing references) //IL_10cd: Unknown result type (might be due to invalid IL or missing references) //IL_10d2: Unknown result type (might be due to invalid IL or missing references) //IL_0edd: Unknown result type (might be due to invalid IL or missing references) //IL_0ed1: Unknown result type (might be due to invalid IL or missing references) //IL_0ed3: Unknown result type (might be due to invalid IL or missing references) //IL_111a: Unknown result type (might be due to invalid IL or missing references) //IL_111c: Unknown result type (might be due to invalid IL or missing references) //IL_111e: Unknown result type (might be due to invalid IL or missing references) //IL_1120: Unknown result type (might be due to invalid IL or missing references) //IL_1125: Unknown result type (might be due to invalid IL or missing references) //IL_112a: Unknown result type (might be due to invalid IL or missing references) //IL_1156: Unknown result type (might be due to invalid IL or missing references) //IL_115a: Unknown result type (might be due to invalid IL or missing references) //IL_115f: Unknown result type (might be due to invalid IL or missing references) //IL_1164: Unknown result type (might be due to invalid IL or missing references) //IL_1169: Unknown result type (might be due to invalid IL or missing references) //IL_117a: Unknown result type (might be due to invalid IL or missing references) //IL_10e5: Unknown result type (might be due to invalid IL or missing references) //IL_0edf: Unknown result type (might be due to invalid IL or missing references) //IL_1107: Unknown result type (might be due to invalid IL or missing references) //IL_10fd: Unknown result type (might be due to invalid IL or missing references) //IL_0efe: Unknown result type (might be due to invalid IL or missing references) //IL_0f07: Unknown result type (might be due to invalid IL or missing references) //IL_0f0c: Unknown result type (might be due to invalid IL or missing references) //IL_0f11: Unknown result type (might be due to invalid IL or missing references) //IL_110c: Unknown result type (might be due to invalid IL or missing references) //IL_1111: Unknown result type (might be due to invalid IL or missing references) //IL_0f29: Unknown result type (might be due to invalid IL or missing references) //IL_0f2d: Unknown result type (might be due to invalid IL or missing references) //IL_0f32: Unknown result type (might be due to invalid IL or missing references) //IL_0f36: Unknown result type (might be due to invalid IL or missing references) //IL_1244: Unknown result type (might be due to invalid IL or missing references) //IL_1238: Unknown result type (might be due to invalid IL or missing references) //IL_123a: Unknown result type (might be due to invalid IL or missing references) //IL_1246: Unknown result type (might be due to invalid IL or missing references) //IL_1248: Unknown result type (might be due to invalid IL or missing references) //IL_1251: Unknown result type (might be due to invalid IL or missing references) //IL_1256: Unknown result type (might be due to invalid IL or missing references) //IL_1262: Unknown result type (might be due to invalid IL or missing references) //IL_1007: Unknown result type (might be due to invalid IL or missing references) //IL_100c: Unknown result type (might be due to invalid IL or missing references) //IL_103d: Unknown result type (might be due to invalid IL or missing references) //IL_1309: Unknown result type (might be due to invalid IL or missing references) //IL_130e: Unknown result type (might be due to invalid IL or missing references) //IL_1348: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Ps == (Object)null) { return; } bool flag = GravityEntries != null && GravityEntries.Length > 0; bool flag2 = VortexEntries != null && VortexEntries.Length > 0; bool flag3 = LocationOffsets != null && LocationOffsets.Length > 0; bool flag4 = VelocityExtras != null && VelocityExtras.Length > 0; bool flag5 = CompassEntries != null && CompassEntries.Length > 0; bool flag6 = RadialVelocities != null && RadialVelocities.Length > 0; bool flag7 = ConeEntries != null && ConeEntries.Length > 0; if (MaxCameraDistance > 0f && Application.isPlaying) { UpdateDistanceCull(); } if (!HasBeam && !flag3 && !flag4 && !flag5 && !flag6 && !flag7 && !flag && !flag2 && !HasMoveRelativeToEmitter && !HasAlignRotation && !HasDragCurve && !HasFacingFade && !HasUniformAccel && !HasPixelClamp && !FreeVelocityOrient) { return; } float num = Mathf.Max(CryEditClock.Dt, 0.0001f); Vector3 val = Vector3.zero; Quaternion val2 = Quaternion.identity; if (HasMoveRelativeToEmitter && (Object)(object)MoveRelEmitter != (Object)null) { val = MoveRelEmitter.position; val2 = MoveRelEmitter.rotation * Quaternion.Inverse(lastEmitterRot); } int particleCount = Ps.particleCount; if (particleCount > 0) { if (buffer == null || buffer.Length < particleCount) { buffer = (Particle[])(object)new Particle[Mathf.Max(particleCount, 64)]; } int particles = Ps.GetParticles(buffer); Quaternion val3 = ((Component)this).transform.rotation * _inverseShapeAim; Vector3 val4 = ((!HasBeam) ? Vector3.zero : (beamDestWorld - beamSourceWorld)); Camera val5 = ((!HasFacingFade && !HasPixelClamp && !FreeVelocityOrient) ? null : ResolveViewerCamera()); int num2; if (HasFacingFade || HasPixelClamp) { MainModule main = Ps.main; num2 = (((int)((MainModule)(ref main)).simulationSpace != 1) ? 1 : 0); } else { num2 = 0; } bool flag8 = (byte)num2 != 0; bool flag9 = false; float rotation = 0f; Camera val6 = ((!HasAlignRotation) ? null : ResolveViewerCamera()); if ((Object)(object)val6 != (Object)null) { Transform transform = ((Component)val6).transform; Vector3 val7 = _alignTargetWorldDir - Vector3.Dot(_alignTargetWorldDir, transform.forward) * transform.forward; if (((Vector3)(ref val7)).sqrMagnitude > 1E-06f) { float num3 = Vector3.Angle(transform.up, val7); float num4 = Mathf.Sign(Vector3.Dot(transform.forward, Vector3.Cross(transform.up, val7))); rotation = num3 * num4; flag9 = true; } } currentFrameSeeds.Clear(); for (int i = 0; i < particles; i++) { currentFrameSeeds.Add(((Particle)(ref buffer[i])).randomSeed); } int num5 = 0; if (HasBeam) { for (int j = 0; j < particles; j++) { if (!lastFrameSeeds.Contains(((Particle)(ref buffer[j])).randomSeed)) { num5++; } } } int num6 = 0; for (int k = 0; k < particles; k++) { bool flag10 = !lastFrameSeeds.Contains(((Particle)(ref buffer[k])).randomSeed); Vector3 val8 = ((Particle)(ref buffer[k])).position; Vector3 val9 = ((Particle)(ref buffer[k])).velocity; if (HasBeam && flag10) { float num7 = ((num5 <= 1) ? 0.5f : ((float)num6 / (float)(num5 - 1))); val8 = beamSourceWorld + val4 * num7; num6++; } if (flag3 && flag10) { float value = Random.value; for (int l = 0; l < LocationOffsets.Length; l++) { AnimationCurve val10 = ((_locationOffsetScaleCurves == null || l >= _locationOffsetScaleCurves.Length) ? null : _locationOffsetScaleCurves[l]); float num8 = ((val10 == null) ? Mathf.Lerp(LocationOffsets[l].ScaleMin, LocationOffsets[l].ScaleMax, value) : val10.Evaluate(value)); val8 += val3 * LocationOffsets[l].Direction * num8; } } if (flag4 && flag10) { for (int m = 0; m < VelocityExtras.Length; m++) { float value2 = Random.value; float value3 = Random.value; float value4 = Random.value; Vector3 val11 = val3 * RandomDirectionInCone(VelocityExtras[m].Direction, VelocityExtras[m].ConeAngleDeg, value2, value3); float num9 = Mathf.Lerp(VelocityExtras[m].SpeedMin, VelocityExtras[m].SpeedMax, value4); val9 += val11 * num9; } } if ((flag5 || flag6 || flag7) && flag10) { int num10 = Mathf.Max(1, SpawnCountHint); float sf = ((num10 <= 1) ? 0f : Mathf.Clamp01((float)(_spawnRank % num10) / (float)(num10 - 1))); _spawnRank++; Quaternion emitterRot = val3; if ((Object)(object)ParentFramePs != (Object)null && TryParentFrame(val8, ((Particle)(ref buffer[k])).startLifetime - ((Particle)(ref buffer[k])).remainingLifetime, out var q)) { emitterRot = q * val3; } float value5 = Random.value; if (flag5) { for (int n = 0; n < CompassEntries.Length; n++) { val9 += CompassVelocity(CompassEntries[n], n, sf, emitterRot, value5); } } if (flag6) { for (int num11 = 0; num11 < RadialVelocities.Length; num11++) { val9 += RadialVelocity(RadialVelocities[num11], num11, sf, emitterRot); } } if (flag7) { for (int num12 = 0; num12 < ConeEntries.Length; num12++) { val9 += ConeVelocity(ConeEntries[num12], num12, sf, emitterRot, value5); } } } Vector3 val12 = Vector3.zero; if (HasUniformAccel) { float num13 = 1f; if (UniformAccelCurve != null && UniformAccelCurve.length > 0) { float startLifetime = ((Particle)(ref buffer[k])).startLifetime; float num14 = ((!(startLifetime > 0f)) ? 0f : Mathf.Clamp01(1f - ((Particle)(ref buffer[k])).remainingLifetime / startLifetime)); num13 = UniformAccelCurve.Evaluate(num14); } val12 += UniformAccel * num13; } if (flag) { for (int num15 = 0; num15 < GravityEntries.Length; num15++) { GravityEntry gravityEntry = GravityEntries[num15]; Vector3 val13 = ((!((Object)(object)gravityEntry.Target != (Object)null)) ? ((Component)this).transform.position : gravityEntry.Target.position); Vector3 val14 = ((!(((Vector3)(ref gravityEntry.Axis)).sqrMagnitude > 1E-06f)) ? Vector3.up : ((Vector3)(ref gravityEntry.Axis)).normalized); Vector3 val15 = val3 * val14; float num16 = ((!(gravityEntry.Decay > 0f)) ? 0f : (1f / (gravityEntry.Decay * gravityEntry.Decay))); Vector3 val17; if (gravityEntry.UseAxis) { Vector3 val16 = val8 - val13; val17 = val13 + val15 * Vector3.Dot(val15, val16) - val8; } else { val17 = val13 - val8; } float sqrMagnitude = ((Vector3)(ref val17)).sqrMagnitude; if (sqrMagnitude > 1E-08f) { float num17 = gravityEntry.Accel / (1f + num16 * sqrMagnitude); val12 += ((Vector3)(ref val17)).normalized * num17; } } } float num18 = 0f; Vector3 val18 = Vector3.zero; float num19 = 0f; if (flag2) { for (int num20 = 0; num20 < VortexEntries.Length; num20++) { VortexEntry vortexEntry = VortexEntries[num20]; Vector3 val19 = ((!((Object)(object)vortexEntry.Target != (Object)null)) ? ((Component)this).transform.position : vortexEntry.Target.position); Vector3 val20 = ((!(((Vector3)(ref vortexEntry.Axis)).sqrMagnitude > 1E-06f)) ? Vector3.up : ((Vector3)(ref vortexEntry.Axis)).normalized); Vector3 val21 = val3 * val20; float num21 = ((!(vortexEntry.Decay > 0f)) ? 0f : (1f / (vortexEntry.Decay * vortexEntry.Decay))); Vector3 val22 = val8 - val19; Vector3 val23 = val19 + val21 * Vector3.Dot(val21, val22) - val8; float sqrMagnitude2 = ((Vector3)(ref val23)).sqrMagnitude; if (sqrMagnitude2 > 1E-08f) { float num22 = vortexEntry.Speed / (1f + num21 * sqrMagnitude2); val18 += Vector3.Cross(((Vector3)(ref val23)).normalized, val21) * num22; if (vortexEntry.Drag > num19) { num19 = vortexEntry.Drag; } } } } if (HasDragCurve && DragCurve != null) { float startLifetime2 = ((Particle)(ref buffer[k])).startLifetime; float num23 = ((!(startLifetime2 > 0f)) ? 0f : Mathf.Clamp01(1f - ((Particle)(ref buffer[k])).remainingLifetime / startLifetime2)); num18 = DragCurve.Evaluate(num23); if (HasDragRandom && DragRandomMax > DragRandomMin) { num18 *= Mathf.Lerp(DragRandomMin, DragRandomMax, Hash01(((Particle)(ref buffer[k])).randomSeed)); } } else if (flag && HasGravityDrag) { num18 = GravityDrag; } else if (flag2) { num18 = num19; } if (num18 > 0f || ((Vector3)(ref val12)).sqrMagnitude > 0f) { Vector3 val24 = val9; Vector3 val25 = val12 + (val18 - val24) * num18; float num24 = num18 * num; float num26; float num27; if (num24 > 1E-06f) { float num25 = Mathf.Exp(0f - num24); num26 = (1f - num25) / num24; num27 = (num24 - 1f + num25) / (num24 * num24); } else { num26 = 1f - 0.5f * num24; num27 = 0.5f - num24 / 6f; } val9 = val24 + val25 * (num * num26); val8 = ((!UnityUsesNewVelocityForPosition) ? (val8 + val25 * (num * num27 * num)) : (val8 + ((val24 - val9) * num + val25 * (num * num27 * num)))); } if (HasMoveRelativeToEmitter && (Object)(object)MoveRelEmitter != (Object)null && !flag10) { if (MoveRelPositionInherit > 0f) { Vector3 val26 = val2 * (val8 - lastEmitterPos) + val; val8 = Vector3.Lerp(val8, val26, MoveRelPositionInherit); } if (MoveRelVelocityInherit > 0f) { Vector3 val27 = val2 * val9; val9 = Vector3.Lerp(val9, val27, MoveRelVelocityInherit); } } if (flag9) { ((Particle)(ref buffer[k])).rotation = rotation; } if (HasFacingFade && (Object)(object)val5 != (Object)null) { uint randomSeed = ((Particle)(ref buffer[k])).randomSeed; if (!_facingBase.TryGetValue(randomSeed, out var value6)) { ((Vector2)(ref value6))..ctor(((Particle)(ref buffer[k])).startSize, (float)(int)((Particle)(ref buffer[k])).startColor.a); _facingBase[randomSeed] = value6; } Vector3 val28 = ((!flag8) ? val9 : ((Component)this).transform.TransformDirection(val9)); Vector3 val29 = ((!flag8) ? val8 : ((Component)this).transform.TransformPoint(val8)); float magnitude = ((Vector3)(ref val28)).magnitude; float num28 = 1f; if (magnitude > 0.001f) { Vector3 val30 = val29 - ((Component)val5).transform.position; float magnitude2 = ((Vector3)(ref val30)).magnitude; if (magnitude2 > 0.0001f) { float num29 = Mathf.Abs(Vector3.Dot(val28 / magnitude, val30 / magnitude2)); num28 = Mathf.Sqrt(Mathf.Max(0f, 1f - num29 * num29)); } } float num30 = ((FacingSizeCurve == null || FacingSizeCurve.length <= 0) ? 1f : Mathf.Max(0f, FacingSizeCurve.Evaluate(num28))); float num31 = ((FacingOpacityCurve == null || FacingOpacityCurve.length <= 0) ? 1f : Mathf.Clamp01(FacingOpacityCurve.Evaluate(num28))); ((Particle)(ref buffer[k])).startSize = value6.x * num30; Color32 startColor = ((Particle)(ref buffer[k])).startColor; startColor.a = (byte)Mathf.Clamp(Mathf.RoundToInt(value6.y * num31), 0, 255); ((Particle)(ref buffer[k])).startColor = startColor; } if (FreeVelocityOrient && (Object)(object)val5 != (Object)null && ((Vector3)(ref val9)).sqrMagnitude > 1E-06f) { MainModule main2 = Ps.main; Vector3 val31 = (((int)((MainModule)(ref main2)).simulationSpace != 1) ? ((Component)this).transform.TransformDirection(val9) : val9); Vector3 normalized = ((Vector3)(ref val31)).normalized; Vector3 val32 = -((Component)val5).transform.forward; Vector3 val33 = val32 - Vector3.Dot(val32, normalized) * normalized; if (((Vector3)(ref val33)).sqrMagnitude < 1E-06f) { val33 = Vector3.Cross(normalized, (!(Mathf.Abs(normalized.y) < 0.9f)) ? Vector3.right : Vector3.up); } ((Vector3)(ref val33)).Normalize(); Quaternion val34 = Quaternion.LookRotation(val33, Vector3.Cross(val33, normalized)); float num32 = Mathf.Lerp(FreeTwistMinDeg, FreeTwistMaxDeg, Hash01(((Particle)(ref buffer[k])).randomSeed)); val34 *= Quaternion.AngleAxis(num32, Vector3.forward); ((Particle)(ref buffer[k])).rotation3D = ((Quaternion)(ref val34)).eulerAngles; } ((Particle)(ref buffer[k])).position = val8; ((Particle)(ref buffer[k])).velocity = val9; if (!HasPixelClamp || !((Object)(object)val5 != (Object)null)) { continue; } float num33 = ((!(PixelSizeMin > 0f)) ? 4f : PixelSizeMin); float num34 = Screen.height; float num35 = ((!(num34 > 1f)) ? 0f : (val5.fieldOfView * ((float)Math.PI / 180f) / num34 * 0.5f)); if (!(num35 > 1E-09f)) { continue; } Vector3 val35 = ((!flag8) ? val8 : ((Component)this).transform.TransformPoint(val8)); float num36 = Vector3.Dot(val35 - ((Component)val5).transform.position, ((Component)val5).transform.forward); if (num36 > 0.0001f) { float num37 = ((Particle)(ref buffer[k])).startSize / (num36 * num35); float num38 = num37; if (num38 < num33) { num38 = num33; } if (!PixelSizeMaxInfinite && PixelSizeMax > 0f && num38 > PixelSizeMax) { num38 = PixelSizeMax; } ((Particle)(ref buffer[k])).startSize = num38 * num36 * num35; if (PixelSizeAffectOpacity) { Color32 startColor2 = ((Particle)(ref buffer[k])).startColor; startColor2.a = (byte)Mathf.Clamp(Mathf.RoundToInt((float)(int)startColor2.a * Mathf.Clamp01(num37 / num33)), 0, 255); ((Particle)(ref buffer[k])).startColor = startColor2; } } } Ps.SetParticles(buffer, particles); if (HasFacingFade && _facingBase.Count > particles * 2 + 16) { _facingPrune.Clear(); foreach (KeyValuePair item in _facingBase) { if (!currentFrameSeeds.Contains(item.Key)) { _facingPrune.Add(item.Key); } } for (int num39 = 0; num39 < _facingPrune.Count; num39++) { _facingBase.Remove(_facingPrune[num39]); } } HashSet hashSet = lastFrameSeeds; lastFrameSeeds = currentFrameSeeds; currentFrameSeeds = hashSet; } else { lastFrameSeeds.Clear(); } if (HasMoveRelativeToEmitter && (Object)(object)MoveRelEmitter != (Object)null) { lastEmitterPos = val; lastEmitterRot = MoveRelEmitter.rotation; } } private void UpdateDistanceCull() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_cullRenderer == (Object)null) { _cullRenderer = ((Component)this).GetComponent(); } if (!((Object)(object)_cullRenderer == (Object)null)) { Camera val = ResolveViewerCamera(); if (!((Object)(object)val == (Object)null)) { Vector3 val2 = ((Component)val).transform.position - ((Component)this).transform.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; ((Renderer)_cullRenderer).enabled = sqrMagnitude <= MaxCameraDistance * MaxCameraDistance; } } } private static Camera ResolveViewerCamera() { if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled) { return s_viewerCamera; } s_viewerCamera = Camera.main; if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled) { return s_viewerCamera; } s_viewerCamera = Camera.current; if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled) { return s_viewerCamera; } Camera[] allCameras = Camera.allCameras; s_viewerCamera = ((allCameras == null || allCameras.Length <= 0) ? null : allCameras[0]); return s_viewerCamera; } private static AnimationCurve ParseScaleCurveKeysStr(string keysStr) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown if (string.IsNullOrEmpty(keysStr)) { return null; } string[] array = keysStr.Split(new char[1] { ';' }); Keyframe[] array2 = (Keyframe[])(object)new Keyframe[array.Length]; for (int i = 0; i < array.Length; i++) { string[] array3 = array[i].Split(new char[1] { ',' }); float num = float.Parse(array3[0], CultureInfo.InvariantCulture); float num2 = float.Parse(array3[1], CultureInfo.InvariantCulture); ref Keyframe reference = ref array2[i]; reference = new Keyframe(num, num2, 0f, 0f); } return new AnimationCurve(array2); } private static float Hash01(uint seed) { uint num = seed * 2654435761u; num ^= num >> 15; num *= 2246822519u; num ^= num >> 13; return (float)(num & 0xFFFFFF) / 16777216f; } private static LinearCurve ParseLinearCurve(string keys) { return (!string.IsNullOrEmpty(keys)) ? new LinearCurve(keys) : null; } private static float EvalOrOne(LinearCurve c, float x) { return c?.Evaluate(x) ?? 1f; } private void BuildSpawnVelocityCurves() { _spawnRank = 0; if (CompassEntries != null) { _compassPolar = new LinearCurve[CompassEntries.Length]; _compassAzimuth = new LinearCurve[CompassEntries.Length]; _compassSpeed = new LinearCurve[CompassEntries.Length]; _compassSpeedRand = new LinearCurve[CompassEntries.Length]; _compassConeSF = new LinearCurve[CompassEntries.Length]; _compassConeRand = new LinearCurve[CompassEntries.Length]; for (int i = 0; i < CompassEntries.Length; i++) { _compassConeSF[i] = ParseLinearCurve(CompassEntries[i].Cone.SFCurve); _compassConeRand[i] = ParseLinearCurve(CompassEntries[i].Cone.RandCurve); _compassPolar[i] = ParseLinearCurve(CompassEntries[i].PolarCurve); _compassAzimuth[i] = ParseLinearCurve(CompassEntries[i].AzimuthCurve); _compassSpeed[i] = ParseLinearCurve(CompassEntries[i].SpeedCurve); _compassSpeedRand[i] = ParseLinearCurve(CompassEntries[i].SpeedRandomCurve); } } if (ConeEntries != null) { _coneSF = new LinearCurve[ConeEntries.Length]; _coneRand = new LinearCurve[ConeEntries.Length]; _coneSpeed = new LinearCurve[ConeEntries.Length]; _coneSpeedRand = new LinearCurve[ConeEntries.Length]; for (int j = 0; j < ConeEntries.Length; j++) { _coneSF[j] = ParseLinearCurve(ConeEntries[j].Cone.SFCurve); _coneRand[j] = ParseLinearCurve(ConeEntries[j].Cone.RandCurve); _coneSpeed[j] = ParseLinearCurve(ConeEntries[j].SpeedCurve); _coneSpeedRand[j] = ParseLinearCurve(ConeEntries[j].SpeedRandomCurve); } } if (RadialVelocities != null) { _radialSpeed = new LinearCurve[RadialVelocities.Length]; for (int k = 0; k < RadialVelocities.Length; k++) { _radialSpeed[k] = ParseLinearCurve(RadialVelocities[k].SpeedCurve); } } } private Vector3 CompassVelocity(CompassEntry c, int index, float sf, Quaternion emitterRot, float rand01) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) float num = c.PolarBaseDeg * EvalOrOne((_compassPolar == null) ? null : _compassPolar[index], sf); float num2 = c.AzimuthBaseDeg * EvalOrOne((_compassAzimuth == null) ? null : _compassAzimuth[index], sf) + c.AzimuthOriginDeg; float num3 = (num + 90f) * ((float)Math.PI / 180f); float num4 = num2 * ((float)Math.PI / 180f); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Mathf.Cos(num4) * Mathf.Cos(num3), Mathf.Sin(num3), Mathf.Sin(num4) * Mathf.Cos(num3)); val = SampleCone(val, c.Cone, (_compassConeSF == null) ? null : _compassConeSF[index], (_compassConeRand == null) ? null : _compassConeRand[index], sf); float num5 = Mathf.Lerp(c.SpeedMin, c.SpeedMax, Random.value) * EvalOrOne((_compassSpeed == null) ? null : _compassSpeed[index], sf) * EvalOrOne((_compassSpeedRand == null) ? null : _compassSpeedRand[index], rand01); return emitterRot * val * num5; } private static Vector3 SampleCone(Vector3 axisWorld, ConeParams cone, LinearCurve sfCurve, LinearCurve randCurve, float sf) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) axisWorld = ((!(((Vector3)(ref axisWorld)).sqrMagnitude > 1E-10f)) ? Vector3.up : ((Vector3)(ref axisWorld)).normalized); float num = Mathf.Lerp(cone.AngleMin, cone.AngleMax, Random.value) * EvalOrOne(sfCurve, sf) * EvalOrOne(randCurve, Random.value); if (Mathf.Abs(num) < 0.001f) { return axisWorld; } float num2 = Mathf.Clamp01(cone.Inner); num *= Mathf.Sqrt(Mathf.Lerp(num2 * num2, 1f, Random.value)); float num3 = num * ((float)Math.PI / 180f); float num4 = Random.value * 2f * (float)Math.PI; Vector3 val = Vector3.Cross(axisWorld, (!(Mathf.Abs(axisWorld.y) < 0.9f)) ? Vector3.right : Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = Vector3.Cross(axisWorld, normalized); return axisWorld * Mathf.Cos(num3) + (normalized * Mathf.Cos(num4) + val2 * Mathf.Sin(num4)) * Mathf.Sin(num3); } private Vector3 ConeVelocity(ConeEntry c, int index, float sf, Quaternion emitterRot, float rand01) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) Vector3 val = SampleCone(emitterRot * c.Axis, c.Cone, (_coneSF == null) ? null : _coneSF[index], (_coneRand == null) ? null : _coneRand[index], sf); float num = Mathf.Lerp(c.SpeedMin, c.SpeedMax, Random.value) * EvalOrOne((_coneSpeed == null) ? null : _coneSpeed[index], sf) * EvalOrOne((_coneSpeedRand == null) ? null : _coneSpeedRand[index], rand01); return val * num; } private Vector3 RadialVelocity(RadialVelocityEntry r, int index, float sf, Quaternion emitterRot) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(r.InnerFraction); Vector3 val; if (r.Sphere) { float num2 = 1f - 2f * Random.value; float num3 = Mathf.Sqrt(Mathf.Max(0f, 1f - num2 * num2)); float num4 = Random.value * 2f * (float)Math.PI; float num5 = Mathf.Pow(Mathf.Lerp(num * num * num, 1f, Random.value), 1f / 3f); val = new Vector3(num3 * Mathf.Cos(num4), num2, num3 * Mathf.Sin(num4)) * num5; val = Vector3.Scale(val, r.Scale); } else { Vector3 val2 = ((!(((Vector3)(ref r.Axis)).sqrMagnitude > 1E-06f)) ? Vector3.up : ((Vector3)(ref r.Axis)).normalized); Vector3 val3 = Vector3.Cross(val2, (!(Mathf.Abs(val2.y) < 0.9f)) ? Vector3.right : Vector3.up); Vector3 normalized = ((Vector3)(ref val3)).normalized; Vector3 val4 = Vector3.Cross(val2, normalized); float num6 = Mathf.Sqrt(Mathf.Lerp(num * num, 1f, Random.value)); float num7 = Random.value * 2f * (float)Math.PI; val = (normalized * (Mathf.Cos(num7) * r.Scale.x) + val4 * (Mathf.Sin(num7) * r.Scale.y)) * num6; } float num8 = Mathf.Lerp(r.SpeedMin, r.SpeedMax, Random.value) * EvalOrOne((_radialSpeed == null) ? null : _radialSpeed[index], sf); return emitterRot * val * num8; } private static Vector3 RandomDirectionInCone(Vector3 axis, float halfAngleDeg, float u1, float u2) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) if (halfAngleDeg >= 179.9f || ((Vector3)(ref axis)).sqrMagnitude < 1E-08f) { float num = 1f - 2f * u1; float num2 = Mathf.Sqrt(Mathf.Max(0f, 1f - num * num)); float num3 = u2 * 2f * (float)Math.PI; return new Vector3(num2 * Mathf.Cos(num3), num2 * Mathf.Sin(num3), num); } float num4 = halfAngleDeg * ((float)Math.PI / 180f); float num5 = Mathf.Lerp(Mathf.Cos(num4), 1f, u1); float num6 = Mathf.Sqrt(Mathf.Max(0f, 1f - num5 * num5)); float num7 = u2 * 2f * (float)Math.PI; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num6 * Mathf.Cos(num7), num6 * Mathf.Sin(num7), num5); Quaternion val2 = Quaternion.FromToRotation(Vector3.forward, ((Vector3)(ref axis)).normalized); return val2 * val; } } public static class CryEditClock { private static int s_frame; private static float s_dt = 0.016f; private static double s_now; private static double s_last; public static int Frame => (!Application.isPlaying) ? s_frame : Time.frameCount; public static float Dt => (!Application.isPlaying) ? s_dt : Time.deltaTime; public static float Now => (!Application.isPlaying) ? ((float)s_now) : Time.time; public static void Advance(double t) { if (t - s_last > 0.002) { s_frame++; s_dt = Mathf.Clamp((float)(t - s_last), 0.0001f, 0.1f); s_last = t; s_now = t; } } } public class PlayOnEnable : MonoBehaviour { public ParticleSystem Ps; private void Awake() { if ((Object)(object)Ps == (Object)null) { Ps = ((Component)this).GetComponent(); } } private void OnEnable() { if (Application.isPlaying && (Object)(object)Ps != (Object)null) { Ps.Play(); } } } public class PlayRandomSoundOnSpawn : MonoBehaviour { public AudioClip[] spawnSounds; public float volume = 1f; [Header("Pitch Settings")] public float minPitch = 0.9f; public float maxPitch = 1.1f; private AudioSource audioSource; private void Start() { if (spawnSounds.Length > 0) { audioSource = ((Component)this).gameObject.AddComponent(); audioSource.playOnAwake = false; audioSource.spatialBlend = 1f; audioSource.volume = volume; AudioClip val = spawnSounds[Random.Range(0, spawnSounds.Length)]; audioSource.pitch = Random.Range(minPitch, maxPitch); audioSource.PlayOneShot(val); } } } public class RandomSpinOnSpawn : MonoBehaviour { public float spinForce = 0.5f; public Vector3 torqueAxis = new Vector3(1f, 0f, 0f); private Rigidbody rb; private void Start() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) rb = ((Component)this).GetComponent(); if ((Object)(object)rb != (Object)null) { ((Component)this).transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); rb.AddTorque(((Vector3)(ref torqueAxis)).normalized * spinForce, (ForceMode)1); } } } namespace BitWizrd.Rifle { public class RollingBlockModded : RollingBlock { [Header("Extraction")] [Tooltip("How far (m) the round slides rearward out of the chamber when the breech opens.")] public float ExtractDistance = 0.01f; [Tooltip("Optional. Its forward is the direction the round extracts along. Empty = the chamber's rearward axis.")] public Transform ExtractAxis; [Header("Tipping (spent cases only)")] public bool GravityEject = true; [Tooltip("How far (degrees) the chamber's rear must point below horizontal before a spent case slides out.")] public float GravityEjectMinTilt = 30f; [Tooltip("Extra distance (m) beyond the case's own length before it is released. The case length is measured from its mesh.")] public float GravityEjectClearance = 0.005f; private bool m_extracted; private float m_extra; private float m_slideSpeed; private Vector3 ExtractDir() { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ExtractAxis != (Object)null) { return ExtractAxis.forward; } return -((Component)base.Chamber).transform.forward; } private float BlockProgress() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 if (Mathf.Approximately(base.BreachBlockRots.x, base.BreachBlockRots.y)) { return ((int)base.m_state != 2) ? 0f : 1f; } return Mathf.Clamp01(Mathf.InverseLerp(base.BreachBlockRots.x, base.BreachBlockRots.y, base.m_curBreachRot)); } public override void UpdateInteraction(FVRViveHand hand) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 if ((Object)(object)hand != (Object)null && (int)base.m_state == 1 && ((!hand.IsInStreamlinedMode) ? (hand.Input.TouchpadDown && hand.Input.TouchpadAxes.y <= 0f) : hand.Input.AXButtonDown)) { OpenBreachModded(); } ((RollingBlock)this).UpdateInteraction(hand); } private void OpenBreachModded() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) base.m_tarBreachRot = base.BreachBlockRots.y; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)17, 1f); base.m_state = (RollingBlockState)2; base.Chamber.IsAccessible = true; m_extracted = base.Chamber.IsFull; m_extra = 0f; m_slideSpeed = 0f; } public override void FVRUpdate() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 ((RollingBlock)this).FVRUpdate(); UpdateExtraction(); ((FVRFireArm)this).IsBreachOpenForGasOut = (int)base.m_state == 2 && (!((Object)(object)base.Chamber != (Object)null) || !base.Chamber.IsFull || !base.Chamber.IsSpent); } private void UpdateExtraction() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Invalid comparison between Unknown and I4 //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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: 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_0132: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.Chamber == (Object)null || (Object)(object)base.Chamber.ProxyRound == (Object)null) { return; } bool flag = (int)base.m_state == 2; if (!base.Chamber.IsFull) { m_extracted = false; m_extra = 0f; m_slideSpeed = 0f; return; } if (!m_extracted) { if (!flag) { return; } m_extracted = true; m_extra = 0f; m_slideSpeed = 0f; } float num = BlockProgress(); Vector3 val = ExtractDir(); Vector3 normalized = ((Vector3)(ref val)).normalized; if (!flag) { m_slideSpeed = 0f; if (num <= 0.001f) { ResetProxy(); m_extracted = false; m_extra = 0f; } else { ApplyProxy(normalized, (ExtractDistance + m_extra) * num); } return; } if (GravityEject && base.Chamber.IsSpent && num >= 0.95f) { float num2 = Vector3.Dot(normalized, Physics.gravity); float num3 = Mathf.Sin(Mathf.Clamp(GravityEjectMinTilt, 1f, 89f) * ((float)Math.PI / 180f)); Vector3 gravity = Physics.gravity; if (Vector3.Dot(normalized, ((Vector3)(ref gravity)).normalized) >= num3 || m_slideSpeed > 0f) { m_slideSpeed = Mathf.Max(0f, m_slideSpeed + num2 * Time.deltaTime); m_extra += m_slideSpeed * Time.deltaTime; if (ExtractDistance + m_extra >= ClearDistance()) { ReleaseCase(normalized); return; } } } ApplyProxy(normalized, (ExtractDistance + m_extra) * num); } private void ApplyProxy(Vector3 dir, float offset) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) base.Chamber.ProxyRound.position = ((Component)base.Chamber).transform.position + dir * offset; base.Chamber.ProxyRound.rotation = ((Component)base.Chamber).transform.rotation; } private void ResetProxy() { //IL_000c: 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) base.Chamber.ProxyRound.localPosition = Vector3.zero; base.Chamber.ProxyRound.localEulerAngles = Vector3.zero; } private float ClearDistance() { //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_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_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) float num = 0.05f; if ((Object)(object)base.Chamber.ProxyMesh != (Object)null && (Object)(object)base.Chamber.ProxyMesh.sharedMesh != (Object)null) { Bounds bounds = base.Chamber.ProxyMesh.sharedMesh.bounds; Vector3 size = ((Bounds)(ref bounds)).size; Vector3 lossyScale = base.Chamber.ProxyRound.lossyScale; num = Mathf.Max(size.x * Mathf.Abs(lossyScale.x), Mathf.Max(size.y * Mathf.Abs(lossyScale.y), size.z * Mathf.Abs(lossyScale.z))); } return num + GravityEjectClearance; } private void ReleaseCase(Vector3 dir) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0029: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_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_0055: 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) Vector3 val = ((Component)base.Chamber).transform.position + dir * (ExtractDistance + m_extra); Quaternion rotation = ((Component)base.Chamber).transform.rotation; Vector3 val2 = dir * m_slideSpeed; base.Chamber.EjectRound(val, val2, Vector3.zero, val, rotation, false); ResetProxy(); m_extracted = false; m_extra = 0f; m_slideSpeed = 0f; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)29, 1f); } } } public class SpawnDurationRuntime : MonoBehaviour { public float Delay; public float Duration; private ParticleSystem ps; private void Awake() { ps = ((Component)this).GetComponent(); } private void OnEnable() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ps == (Object)null) { ps = ((Component)this).GetComponent(); } if ((Object)(object)ps != (Object)null) { EmissionModule emission = ps.emission; ((EmissionModule)(ref emission)).enabled = true; } ((MonoBehaviour)this).CancelInvoke(); if (Duration > 0f) { ((MonoBehaviour)this).Invoke("StopEmission", Delay + Duration); } } private void StopEmission() { if ((Object)(object)ps != (Object)null) { ps.Stop(false, (ParticleSystemStopBehavior)1); } } } public class StopDisableWhenDone : MonoBehaviour { public ParticleSystem Ps; public float PollInterval = 0.25f; public float ParkDelay = 2f; private float nextPoll; private bool seenEmission; private bool parking; private float parkAt; private static readonly List s_parkedInstances = new List(); private const int MaxParkedInstances = 8; public static bool EnsureSoftParticles = true; private void Awake() { if ((Object)(object)Ps == (Object)null) { Ps = ((Component)this).GetComponent(); } } private static void RequireDepthFade() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (EnsureSoftParticles && Application.isPlaying) { Camera main = Camera.main; if ((Object)(object)main != (Object)null && (main.depthTextureMode & 1) == 0) { main.depthTextureMode = (DepthTextureMode)(main.depthTextureMode | 1); } } } private void OnEnable() { RequireDepthFade(); if ((Object)(object)Ps != (Object)null) { Ps.Play(); } seenEmission = false; parking = false; UntrackParked((!((Object)(object)((Component)this).transform.parent != (Object)null)) ? ((Component)this).gameObject : ((Component)((Component)this).transform.parent).gameObject); nextPoll = Time.time + PollInterval; } private void Update() { if (!Application.isPlaying || (Object)(object)Ps == (Object)null || Time.time < nextPoll) { return; } nextPoll = Time.time + PollInterval; if (Ps.particleCount > 0) { seenEmission = true; parking = false; } if (seenEmission && !Ps.IsAlive()) { Ps.Stop(); Transform parent = ((Component)this).transform.parent; if (!((Object)(object)parent != (Object)null) || !((Object)(object)((Component)parent).GetComponent() == (Object)null)) { ((Behaviour)this).enabled = false; } else if (!AllSystemsDone(parent)) { parking = false; } else if (!parking) { parking = true; parkAt = Time.time + ParkDelay; } else if (Time.time >= parkAt) { ParkInstance(((Component)parent).gameObject); } } } private static void ParkInstance(GameObject root) { UntrackParked(root); root.SetActive(false); s_parkedInstances.Add(root); while (s_parkedInstances.Count > 8) { GameObject val = s_parkedInstances[0]; s_parkedInstances.RemoveAt(0); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } } private static void UntrackParked(GameObject root) { for (int num = s_parkedInstances.Count - 1; num >= 0; num--) { GameObject val = s_parkedInstances[num]; if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)root) { s_parkedInstances.RemoveAt(num); } } } private static bool AllSystemsDone(Transform root) { ParticleSystem[] componentsInChildren = ((Component)root).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (!SystemDone(componentsInChildren[i], 0)) { return false; } } CryRibbon[] componentsInChildren2 = ((Component)root).GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren2.Length; j++) { if ((Object)(object)componentsInChildren2[j] != (Object)null && componentsInChildren2[j].IsBusy) { return false; } } AudioSource[] componentsInChildren3 = ((Component)root).GetComponentsInChildren(true); for (int k = 0; k < componentsInChildren3.Length; k++) { if (((Component)componentsInChildren3[k]).gameObject.activeInHierarchy && componentsInChildren3[k].isPlaying) { return false; } } return true; } private static bool SystemDone(ParticleSystem ps, int depth) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) if (depth > 8) { return true; } if ((Object)(object)ps == (Object)null || !((Component)ps).gameObject.activeInHierarchy) { return true; } if (ps.IsAlive()) { return false; } MainModule main = ps.main; if (((MainModule)(ref main)).loop) { return false; } MainModule main2 = ps.main; MinMaxCurve startDelay = ((MainModule)(ref main2)).startDelay; if ((int)((MinMaxCurve)(ref startDelay)).mode != 0) { return false; } float time = ps.time; float constant = ((MinMaxCurve)(ref startDelay)).constant; MainModule main3 = ps.main; if (time >= constant + ((MainModule)(ref main3)).duration - 0.05f) { return true; } if (ps.time > 0.05f) { return false; } Transform parent = ((Component)ps).transform.parent; ParticleSystem val = ((!((Object)(object)parent != (Object)null)) ? null : ((Component)parent).GetComponent()); if ((Object)(object)val == (Object)null) { return false; } return SystemDone(val, depth + 1); } } namespace BitWizrd.VetterliCyclone { public class VetterliCycloneLifter : MonoBehaviour { [Header("References")] public ClosedBoltWeapon rifle; public Transform lifterTransform; public FVRFireArmMagazine magazine; [Header("Lifter")] public Vector3 downPosition; public Vector3 upPosition; [Range(0f, 0.1f)] public float boltDeadzone = 0.05f; [Tooltip("How fast the lifter moves up and down")] public float liftSpeed = 5f; [Header("Bolt")] public ClosedBolt bolt; public Transform boltTransform; public Vector3 boltForwardPos; public Vector3 boltRearPos; [Header("Audio")] [Tooltip("Set to true to use the weapon's built-in bolt sounds")] public bool useWeaponAudio = true; public Transform boltHandle; public Vector3 boltHandleForwardRot; public Vector3 boltHandleRearRot; [Range(0f, 1f)] public float rotationPhaseEnd = 0.2f; [Header("Hammer")] public Transform hammer; public Vector3 hammerForwardPos; public Vector3 hammerBackPos; [Header("Proxy Hide Timing")] public float proxyHideTravel = 0.005f; private bool _waitingToHideProxy = false; private float _rearBoltZ = 0f; private bool _isLifterUp = false; private bool _isLifterMoving = false; private float _lifterLerpTime = 0f; private bool _wasBoltFullyBack = false; private float _lastBoltHandleRot = 0f; private bool _shouldHammerBeCocked; private bool _hasCockedThisCycle; private bool _hasReachedMaxRotation; private float _boltLerpAtMaxRotation; private bool _isBoltMovingBack; private bool _proxyHiddenSinceRearToForward = false; private BoltPos _lastBoltPos = (BoltPos)0; private bool _wasBoltAtRearPosition = false; private void Start() { //IL_008b: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rifle == (Object)null) { rifle = ((Component)this).GetComponentInParent(); if ((Object)(object)rifle == (Object)null || (Object)(object)rifle.Bolt == (Object)null) { ((Behaviour)this).enabled = false; return; } } if ((Object)(object)lifterTransform == (Object)null) { ((Behaviour)this).enabled = false; return; } if ((Object)(object)lifterTransform != (Object)null) { lifterTransform.localPosition = Vector3.Lerp(downPosition, upPosition, 0f); } if ((Object)(object)boltTransform != (Object)null) { boltTransform.localPosition = boltForwardPos; } _wasBoltFullyBack = Mathf.Abs(bolt.m_boltZ_current - bolt.m_boltZ_rear) < boltDeadzone; } private void Update() { //IL_0088: 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_0094: 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_00ce: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_0530: 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_0488: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rifle == (Object)null || (Object)(object)bolt == (Object)null || (Object)(object)lifterTransform == (Object)null || (Object)(object)boltTransform == (Object)null) { return; } float boltZ_current = bolt.m_boltZ_current; float num = Mathf.InverseLerp(bolt.m_boltZ_forward, bolt.m_boltZ_rear, boltZ_current); float num2 = Mathf.Clamp01(num / rotationPhaseEnd); boltHandle.localEulerAngles = Vector3.Lerp(boltHandleForwardRot, boltHandleRearRot, num2); if (num2 >= 1f) { float num3 = (num - rotationPhaseEnd) / (1f - rotationPhaseEnd); num3 = Mathf.Clamp01(num3); boltTransform.localPosition = Vector3.Lerp(boltForwardPos, boltRearPos, num3); } else { boltTransform.localPosition = boltForwardPos; } _lastBoltHandleRot = num2; bool flag = Mathf.Abs(boltZ_current - bolt.m_boltZ_forward) < boltDeadzone; bool flag2 = Mathf.Abs(boltZ_current - bolt.m_boltZ_rear) < boltDeadzone; if (useWeaponAudio && (Object)(object)rifle != (Object)null && !_wasBoltFullyBack && flag2) { ((FVRFireArm)rifle).PlayAudioEvent((FirearmAudioEventType)1, 1f); } if (num2 >= 0.95f && _lastBoltHandleRot < 0.95f && (Object)(object)rifle != (Object)null && !_hasCockedThisCycle) { _shouldHammerBeCocked = true; _hasCockedThisCycle = true; FieldInfo field = ((object)rifle).GetType().GetField("m_isHammerCocked", BindingFlags.Instance | BindingFlags.NonPublic); if ((object)field != null && !(bool)field.GetValue(rifle)) { rifle.CockHammer(false); } } else if (flag) { _shouldHammerBeCocked = false; _hasCockedThisCycle = false; _hasReachedMaxRotation = false; _isBoltMovingBack = false; } _wasBoltFullyBack = flag2; if ((Object)(object)hammer != (Object)null) { if (_shouldHammerBeCocked || flag2) { hammer.localPosition = hammerBackPos; } else if ((Object)(object)rifle != (Object)null) { FieldInfo field2 = ((object)rifle).GetType().GetField("m_isHammerCocked", BindingFlags.Instance | BindingFlags.NonPublic); if ((object)field2 != null) { bool flag3 = (bool)field2.GetValue(rifle); hammer.localPosition = ((!flag3) ? hammerForwardPos : hammerBackPos); } } } bool flag4 = Mathf.Abs(boltZ_current - bolt.m_boltZ_rear) < 0.0001f; bool flag5 = Mathf.Abs(boltZ_current - bolt.m_boltZ_forward) < 0.0001f; if (flag4) { _waitingToHideProxy = true; _rearBoltZ = boltZ_current; } if (_waitingToHideProxy && boltZ_current - _rearBoltZ > proxyHideTravel && (Object)(object)magazine != (Object)null && !_proxyHiddenSinceRearToForward) { magazine.HideAllProxies = true; magazine.UpdateBulletDisplay(); _proxyHiddenSinceRearToForward = true; _waitingToHideProxy = false; } if (flag4 && !_isLifterUp && !_isLifterMoving) { _isLifterMoving = true; _lifterLerpTime = 0f; } else if (flag5 && _isLifterUp && !_isLifterMoving) { _isLifterMoving = true; _lifterLerpTime = 0f; } if (_isLifterMoving) { _lifterLerpTime += Time.deltaTime * liftSpeed; float num4 = Mathf.Clamp01(_lifterLerpTime); if (!_isLifterUp) { lifterTransform.localPosition = Vector3.Lerp(downPosition, upPosition, num4); if (num4 >= 1f) { _isLifterUp = true; _isLifterMoving = false; } } else { lifterTransform.localPosition = Vector3.Lerp(upPosition, downPosition, num4); if (num4 >= 1f) { _isLifterUp = false; _isLifterMoving = false; if ((Object)(object)magazine != (Object)null && _proxyHiddenSinceRearToForward) { magazine.HideAllProxies = false; magazine.UpdateBulletDisplay(); _proxyHiddenSinceRearToForward = false; } _waitingToHideProxy = false; } } } else if (_isLifterUp) { lifterTransform.localPosition = upPosition; } else { lifterTransform.localPosition = downPosition; } _lastBoltPos = bolt.CurPos; _wasBoltAtRearPosition = flag4; } } } namespace BitWizrd.Vetterli { public class VetterliLifter : MonoBehaviour { [Header("References")] public BoltAction rifle; public Transform lifterTransform; public FVRFireArmMagazine magazine; [Header("Positions")] public Vector3 downPosition; public Vector3 upPosition; [Header("Animation")] public float liftSpeed = 5f; public float lowerSpeed = 3f; private bool _isLifted = false; private bool _isLifting = false; private bool _isLowering = false; private float _lerpProgress = 0f; private BoltAction_Handle.BoltActionHandleState _lastBoltState; private float _lastBoltLerp; private bool _magazineProxyState = false; private void Start() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rifle == (Object)null) { rifle = ((Component)this).GetComponentInParent(); } if ((Object)(object)lifterTransform == (Object)null) { Debug.LogError((object)"VetterliLifter: No lifter transform assigned!"); ((Behaviour)this).enabled = false; return; } lifterTransform.localPosition = downPosition; if ((Object)(object)magazine != (Object)null) { _magazineProxyState = false; magazine.HideAllProxies = false; magazine.UpdateBulletDisplay(); } } private void Update() { //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rifle == (Object)null || (Object)(object)lifterTransform == (Object)null) { return; } bool flag = _lastBoltState != rifle.CurBoltHandleState; bool flag2 = Mathf.Abs(_lastBoltLerp - rifle.BoltLerp) > 0.001f; _lastBoltState = rifle.CurBoltHandleState; _lastBoltLerp = rifle.BoltLerp; if ((Object)(object)magazine != (Object)null) { bool flag3 = ((rifle.CurBoltHandleState != BoltAction_Handle.BoltActionHandleState.Mid || !(rifle.BoltLerp < 0.99f)) && (rifle.CurBoltHandleState != BoltAction_Handle.BoltActionHandleState.Forward || !(rifle.BoltLerp < 0.99f))) || _isLowering; if (flag3 != _magazineProxyState) { _magazineProxyState = flag3; magazine.HideAllProxies = !flag3; magazine.UpdateBulletDisplay(); } } if (flag || flag2) { if (rifle.CurBoltHandleState == BoltAction_Handle.BoltActionHandleState.Rear && rifle.BoltLerp > 0.95f && !_isLifted && !_isLifting) { _isLifting = true; _isLowering = false; _isLifted = false; _lerpProgress = 0f; } else if (rifle.CurBoltHandleState == BoltAction_Handle.BoltActionHandleState.Forward && rifle.BoltLerp < 0.05f && _isLifted && !_isLowering) { _isLowering = true; _isLifting = false; _isLifted = false; _lerpProgress = 0f; } } if (_isLifting && _lerpProgress < 1f) { _lerpProgress += Time.deltaTime * liftSpeed; float num = Mathf.Clamp01(_lerpProgress); lifterTransform.localPosition = Vector3.Lerp(downPosition, upPosition, num); if (num >= 1f) { _isLifted = true; _isLifting = false; } } else if (!_isLifting && _isLifted && _lerpProgress < 1f) { _lerpProgress += Time.deltaTime * lowerSpeed; float num2 = Mathf.Clamp01(_lerpProgress); lifterTransform.localPosition = Vector3.Lerp(upPosition, downPosition, num2); if (num2 >= 1f) { _isLifted = false; } } else if (!_isLifting && !_isLifted) { lifterTransform.localPosition = downPosition; } else if (_isLifted && !_isLifting) { lifterTransform.localPosition = upPosition; } } } }