using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using FistVR; using HarmonyLib; using OpenScripts2; using OtherLoader; using Sodalite.Api; using Sodalite.Utilities; using UnityEditor; using UnityEngine; using UnityEngine.AI; using UnityEngine.UI; using VolksScripts; [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 VolksScripts { public class NVGPowerSwitch : FVRInteractiveObject { public PIPScope Scope; [HideInInspector] public bool Toggle = true; public override void SimpleInteraction(FVRViveHand hand) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).SimpleInteraction(hand); SM.PlayCoreSound((FVRPooledAudioType)10, ManagerSingleton.Instance.AudioEvent_AttachmentClick_Minor, ((Component)this).transform.position); if (Toggle) { Scope.enableNightvision = (Scope.enableThermal = false); } else { Scope.enableNightvision = (Scope.enableThermal = true); } Toggle = !Toggle; } } public class ANVIS21Control : MonoBehaviour { public Transform armreal; public Transform armfake; public PIPScope scopeL; public PIPScope scopeR; public float onspeed = 0.5f; public float offspeed = 0.5f; public AudioEvent powerOn; public AudioEvent powerOff; public bool isOn; private float gainVelL; private float gainVelR; private float brightVelL; private float brightVelR; public bool IsOn => isOn; private void Start() { SetScopesImmediate(0f); } private void Update() { SyncArms(); UpdateNVG(); } public void SetPower(bool value) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (isOn == value) { return; } isOn = value; if (isOn) { if (powerOn != null) { SM.PlayCoreSound((FVRPooledAudioType)10, powerOn, ((Component)this).transform.position); } } else if (powerOff != null) { SM.PlayCoreSound((FVRPooledAudioType)10, powerOff, ((Component)this).transform.position); } } private void SyncArms() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)armreal == (Object)null) && !((Object)(object)armfake == (Object)null)) { armfake.localPosition = armreal.localPosition; armfake.localRotation = armreal.localRotation; } } private void UpdateNVG() { float num = ((!isOn) ? 0f : 1f); float num2 = ((!isOn) ? offspeed : onspeed); if ((Object)(object)scopeL != (Object)null) { scopeL.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeL.nvDef.nightVisionTargetBrightness, num, ref brightVelL, num2); scopeL.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeL.nightVisionManualGainFactor, num, ref gainVelL, num2); ((Behaviour)scopeL).enabled = true; scopeL.UpdateParameters(); } if ((Object)(object)scopeR != (Object)null) { scopeR.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeR.nvDef.nightVisionTargetBrightness, num, ref brightVelR, num2); scopeR.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeR.nightVisionManualGainFactor, num, ref gainVelR, num2); ((Behaviour)scopeR).enabled = true; scopeR.UpdateParameters(); } } private void SetScopesImmediate(float value) { if ((Object)(object)scopeL != (Object)null) { scopeL.nvDef.nightVisionTargetBrightness = value; scopeL.nightVisionManualGainFactor = value; } if ((Object)(object)scopeR != (Object)null) { scopeR.nvDef.nightVisionTargetBrightness = value; scopeR.nightVisionManualGainFactor = value; } } } public class ANVIS21PowerSwitch : FVRInteractiveObject { public ANVIS21Control control; public Transform switchTransform; public Vector3 offEulerAngles; public Vector3 onEulerAngles; public float lerpSpeed = 8f; private float m_lerp; protected void Awake() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).Awake(); if ((Object)(object)switchTransform == (Object)null) { switchTransform = ((Component)this).transform; } if ((Object)(object)control != (Object)null) { m_lerp = ((!control.IsOn) ? 0f : 1f); switchTransform.localEulerAngles = Vector3.Lerp(offEulerAngles, onEulerAngles, m_lerp); } } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); if (!((Object)(object)control == (Object)null)) { control.SetPower(!control.IsOn); } } protected void FVRUpdate() { //IL_0074: 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_0085: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (!((Object)(object)control == (Object)null) && !((Object)(object)switchTransform == (Object)null)) { float num = ((!control.IsOn) ? 0f : 1f); m_lerp = Mathf.MoveTowards(m_lerp, num, Time.deltaTime * lerpSpeed); switchTransform.localEulerAngles = Vector3.Lerp(offEulerAngles, onEulerAngles, m_lerp); } } } } public class ForceBindToHead : MonoBehaviour { [Tooltip("The object that should follow the player's head (e.g. NVG physical root).")] public GameObject phys; [Tooltip("Optional: if true, runs even when not equipped.")] public bool alwaysFollow = true; private Transform headTransform; private void Start() { if ((Object)(object)GM.CurrentMovementManager != (Object)null && (Object)(object)GM.CurrentMovementManager.Head != (Object)null) { headTransform = ((Component)GM.CurrentMovementManager.Head).transform; } else { Debug.LogWarning((object)"[ForceBindToHead] Could not find head transform."); } } private void FixedUpdate() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)phys == (Object)null) && (alwaysFollow || !((Object)(object)headTransform == (Object)null))) { if ((Object)(object)headTransform == (Object)null && (Object)(object)GM.CurrentMovementManager != (Object)null) { headTransform = ((Component)GM.CurrentMovementManager.Head).transform; } if ((Object)(object)phys.transform.parent != (Object)(object)headTransform) { phys.transform.SetParent(headTransform); } phys.transform.localPosition = Vector3.zero; phys.transform.localEulerAngles = Vector3.zero; } } } namespace JerryComponent { public class PNV57EControl : MonoBehaviour { public GameObject phys; public GameObject armreal; public GameObject armfake; public Vector3 velLinearWorldL; public Vector3 velLinearWorldR; public Transform slapdirUP; public Transform slapdirDown; public HeadAttachment HA; public PIPScope scopeL; public PIPScope scopeR; public GameObject powerknob; public float refgain; public float reflum; public AudioEvent flip; public bool started = false; public float onspeed = 0.5f; public float offspeed = 2.5f; public bool isheadmounted = true; public AudioSource whing; public float volref; private void Start() { scopeL.nvDef.nightVisionTargetBrightness = 0f; scopeL.nightVisionManualGainFactor = 0f; scopeR.nvDef.nightVisionTargetBrightness = 0f; scopeR.nightVisionManualGainFactor = 0f; refgain = 0f; reflum = 0f; volref = 0f; whing.volume = 0f; whing.pitch = 0f; } private void FixedUpdate() { //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_053a: 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_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Invalid comparison between Unknown and I4 //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0281: 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_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Invalid comparison between Unknown and I4 //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_0200: 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_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)scopeL).enabled = true; scopeL.UpdateParameters(); ((Behaviour)scopeR).enabled = true; scopeR.UpdateParameters(); if (isheadmounted) { armfake.transform.localEulerAngles = armreal.transform.localEulerAngles; phys.transform.SetParent(((Component)GM.CurrentMovementManager.Head).gameObject.transform); phys.transform.localPosition = Vector3.zero; phys.transform.localEulerAngles = Vector3.zero; velLinearWorldL = GM.CurrentMovementManager.Hands[0].Input.VelLinearWorld; velLinearWorldR = GM.CurrentMovementManager.Hands[1].Input.VelLinearWorld; if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null && (int)HA.MAState == 0 && Vector3.Distance(GM.CurrentMovementManager.Hands[0].PalmTransform.position, slapdirUP.position) < 0.15f && Vector3.Angle(velLinearWorldL, slapdirUP.forward) < 60f && ((Vector3)(ref velLinearWorldL)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } else if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null && (int)HA.MAState == 1 && Vector3.Distance(GM.CurrentMovementManager.Hands[0].PalmTransform.position, slapdirDown.position) < 0.15f && Vector3.Angle(velLinearWorldL, slapdirDown.forward) < 60f && ((Vector3)(ref velLinearWorldL)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null && (int)HA.MAState == 0 && Vector3.Distance(GM.CurrentMovementManager.Hands[1].PalmTransform.position, slapdirUP.position) < 0.15f && Vector3.Angle(velLinearWorldR, slapdirUP.forward) < 60f && ((Vector3)(ref velLinearWorldR)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } else if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null && (int)HA.MAState == 1 && Vector3.Distance(GM.CurrentMovementManager.Hands[1].PalmTransform.position, slapdirDown.position) < 0.15f && Vector3.Angle(velLinearWorldR, slapdirDown.forward) < 60f && ((Vector3)(ref velLinearWorldR)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } } if (powerknob.transform.localEulerAngles.x > 15f) { scopeL.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeL.nvDef.nightVisionTargetBrightness, 0f, ref refgain, offspeed); scopeL.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeL.nightVisionManualGainFactor, 0f, ref reflum, offspeed); scopeR.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeR.nvDef.nightVisionTargetBrightness, 0f, ref refgain, offspeed); scopeR.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeR.nightVisionManualGainFactor, 0f, ref reflum, offspeed); whing.volume = Mathf.SmoothDamp(whing.volume, 0f, ref volref, offspeed); whing.pitch = Mathf.SmoothDamp(whing.pitch, 0f, ref volref, offspeed); started = false; } else if (powerknob.transform.localEulerAngles.x < 15f) { scopeL.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeL.nightVisionManualGainFactor, 1f, ref reflum, onspeed); scopeR.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeR.nightVisionManualGainFactor, 1f, ref reflum, onspeed); whing.volume = Mathf.SmoothDamp(whing.volume, 0.5f, ref volref, onspeed); whing.pitch = Mathf.SmoothDamp(whing.pitch, 1.3f, ref volref, onspeed); if (!started) { scopeL.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeL.nvDef.nightVisionTargetBrightness, 1f, ref refgain, onspeed); scopeR.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeR.nvDef.nightVisionTargetBrightness, 1f, ref refgain, onspeed); } if (scopeL.nvDef.nightVisionTargetBrightness > 0.9f && scopeR.nvDef.nightVisionTargetBrightness > 0.9f) { started = true; } } } private void OnDestroy() { Object.Destroy((Object)(object)phys); } } public class PNV57EControlAdj : MonoBehaviour { public GameObject phys; public PIPScope scopeL; public PIPScope scopeR; public GameObject powerknob; public float refgain; public float reflum; public AudioEvent flip; public bool started = false; public float onspeed = 0.5f; public float offspeed = 2.5f; public bool isheadmounted = true; public AudioSource whing; public float volref; public float pitref; public float volume; public float pitch; public GameObject root; public int scopePara; private void Start() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) scopePara = GM.Options.SimulationOptions.ScopeRecursiveRendering; GM.Options.SimulationOptions.ScopeRecursiveRendering = 0; GM.RefreshQuality(); powerknob.transform.localEulerAngles = new Vector3(30f, 0f, 0f); scopeL.nvDef.nightVisionTargetBrightness = 0f; scopeL.nightVisionManualGainFactor = 0f; scopeR.nvDef.nightVisionTargetBrightness = 0f; scopeR.nightVisionManualGainFactor = 0f; refgain = 0f; reflum = 0f; volref = 0f; pitref = 0f; whing.volume = 0f; whing.pitch = 0f; } private void FixedUpdate() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_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) root.transform.localPosition = new Vector3(0f, 0f, 0f); ((Behaviour)scopeL).enabled = true; scopeL.UpdateParameters(); ((Behaviour)scopeR).enabled = true; scopeR.UpdateParameters(); if (isheadmounted) { phys.transform.SetParent(((Component)GM.CurrentMovementManager.Head).gameObject.transform); phys.transform.localPosition = Vector3.zero; phys.transform.localEulerAngles = Vector3.zero; } if (powerknob.transform.localEulerAngles.x > 15f) { scopeL.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeL.nvDef.nightVisionTargetBrightness, 0f, ref refgain, offspeed); scopeL.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeL.nightVisionManualGainFactor, 0f, ref reflum, offspeed); scopeR.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeR.nvDef.nightVisionTargetBrightness, 0f, ref refgain, offspeed); scopeR.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeR.nightVisionManualGainFactor, 0f, ref reflum, offspeed); whing.volume = Mathf.SmoothDamp(whing.volume, 0f, ref volref, offspeed); whing.pitch = Mathf.SmoothDamp(whing.pitch, 0f, ref pitref, offspeed); started = false; } else if (powerknob.transform.localEulerAngles.x < 15f) { scopeL.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeL.nightVisionManualGainFactor, 1f, ref reflum, onspeed); scopeR.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeR.nightVisionManualGainFactor, 1f, ref reflum, onspeed); whing.volume = Mathf.SmoothDamp(whing.volume, volume, ref volref, onspeed); whing.pitch = Mathf.SmoothDamp(whing.pitch, pitch, ref pitref, onspeed); if (!started) { scopeL.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeL.nvDef.nightVisionTargetBrightness, 1f, ref refgain, onspeed); scopeR.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeR.nvDef.nightVisionTargetBrightness, 1f, ref refgain, onspeed); } if (scopeL.nvDef.nightVisionTargetBrightness > 0.9f && scopeR.nvDef.nightVisionTargetBrightness > 0.9f) { started = true; } } } private void OnDestroy() { Object.Destroy((Object)(object)phys); GM.Options.SimulationOptions.ScopeRecursiveRendering = scopePara; GM.RefreshQuality(); } } public class PVS7Control : MonoBehaviour { public GameObject phys; public GameObject armreal; public GameObject armfake; public Vector3 velLinearWorldL; public Vector3 velLinearWorldR; public Transform slapdirUP; public Transform slapdirDown; public HeadAttachment HA; public PIPScope scope; public GameObject powerknob; public float refgain; public float reflum; public AudioEvent flip; public bool started = false; public float onspeed = 0.5f; public float offspeed = 2.5f; public bool isheadmounted = true; private void Start() { scope.nvDef.nightVisionTargetBrightness = 0f; scope.nightVisionManualGainFactor = 0f; refgain = 0f; reflum = 0f; } private void FixedUpdate() { //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: 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_0073: 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_00a4: 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_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_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0469: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Invalid comparison between Unknown and I4 //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_026a: 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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_0331: Invalid comparison between Unknown and I4 //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0352: 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_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)scope).enabled = true; scope.UpdateParameters(); if (isheadmounted) { armfake.transform.localEulerAngles = armreal.transform.localEulerAngles; phys.transform.SetParent(((Component)GM.CurrentMovementManager.Head).gameObject.transform); phys.transform.localPosition = Vector3.zero; phys.transform.localEulerAngles = Vector3.zero; velLinearWorldL = GM.CurrentMovementManager.Hands[0].Input.VelLinearWorld; velLinearWorldR = GM.CurrentMovementManager.Hands[1].Input.VelLinearWorld; if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null && (int)HA.MAState == 0 && Vector3.Distance(GM.CurrentMovementManager.Hands[0].PalmTransform.position, slapdirUP.position) < 0.15f && Vector3.Angle(velLinearWorldL, slapdirUP.forward) < 60f && ((Vector3)(ref velLinearWorldL)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } else if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null && (int)HA.MAState == 1 && Vector3.Distance(GM.CurrentMovementManager.Hands[0].PalmTransform.position, slapdirDown.position) < 0.15f && Vector3.Angle(velLinearWorldL, slapdirDown.forward) < 60f && ((Vector3)(ref velLinearWorldL)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null && (int)HA.MAState == 0 && Vector3.Distance(GM.CurrentMovementManager.Hands[1].PalmTransform.position, slapdirUP.position) < 0.15f && Vector3.Angle(velLinearWorldR, slapdirUP.forward) < 60f && ((Vector3)(ref velLinearWorldR)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } else if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null && (int)HA.MAState == 1 && Vector3.Distance(GM.CurrentMovementManager.Hands[1].PalmTransform.position, slapdirDown.position) < 0.15f && Vector3.Angle(velLinearWorldR, slapdirDown.forward) < 60f && ((Vector3)(ref velLinearWorldR)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } } if (powerknob.transform.localEulerAngles.x > 15f) { scope.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scope.nvDef.nightVisionTargetBrightness, 0f, ref refgain, offspeed); scope.nightVisionManualGainFactor = Mathf.SmoothDamp(scope.nightVisionManualGainFactor, 0f, ref reflum, offspeed); started = false; } else if (powerknob.transform.localEulerAngles.x < 15f) { scope.nightVisionManualGainFactor = Mathf.SmoothDamp(scope.nightVisionManualGainFactor, 1f, ref reflum, onspeed); if (!started) { scope.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scope.nvDef.nightVisionTargetBrightness, 1f, ref refgain, onspeed); } if (scope.nvDef.nightVisionTargetBrightness > 0.9f) { started = true; } } } private void OnDestroy() { Object.Destroy((Object)(object)phys); } } } public class BaffleSuppressor : Suppressor { public enum PerceptionMode { Automatic, ForceEnvironment, UseVolumeOnly } [Header("Baffle (wear) settings")] [Tooltip("Max integrity (brand new).")] public int MaxIntegrity = 10; [Tooltip("Current integrity (MaxIntegrity = new, 0 = broken).")] [Range(0f, 100f)] public int Integrity = 10; [Tooltip("Integrity lost per shot.")] public int WearPerShot = 1; [Tooltip("Multiplier applied to loudness at full integrity (very quiet).")] [Range(0f, 1f)] public float QuietMultiplierAtFull = 0.12f; [Tooltip("Multiplier applied to loudness when fully broken (typically 1).")] [Range(0f, 2f)] public float LoudMultiplierAtBroken = 1f; [Header("Suppressor audio (played by this suppressor)")] [Tooltip("Clip played as the primary suppressed shot. If null, suppressor will still attempt to mute nearby audio but won't play a replacement.")] public AudioClip SuppressedShotClip; [Tooltip("Optional tail/ambience clip to complement the suppressed shot.")] public AudioClip SuppressedTailClip; [Tooltip("Base volume multiplier for suppressed shot clip (before applying integrity multiplier).")] [Range(0f, 2f)] public float SuppressedShotBaseVolume = 1f; [Tooltip("Base volume multiplier for suppressed tail clip.")] [Range(0f, 2f)] public float SuppressedTailBaseVolume = 1f; [Header("Visuals")] [Tooltip("GameObject root for intact visual (enable when not broken).")] public GameObject IntactVisual; [Tooltip("GameObject root for broken visual (enable when broken).")] public GameObject BrokenVisual; [Header("Feedback")] [Tooltip("Clip played when suppressor breaks.")] public AudioClip BreakClip; [Tooltip("Local audio source used for PlayOneShot; if null PlayClipAtPoint is used.")] public AudioSource LocalAudioSource; [Tooltip("If > 0, auto-repair after this many seconds (debugging/testing). 0 = disabled.")] public float AutoRepairAfterSeconds = 0f; [Header("Audio-silencing tuning (best-effort)")] [Tooltip("Radius around muzzle within which playing AudioSources may be considered gunshot audio (meters).")] public float MuzzleSilenceRadius = 0.75f; [Tooltip("Maximum age (seconds) of a recent AudioSource play to consider it for silencing.")] public float RecentPlayMaxAge = 0.2f; [Tooltip("Time (seconds) to fade an AudioSource's volume to zero before stopping it.")] public float FadeOutTime = 0.04f; [Header("Perception / Environment")] [Tooltip("How perception is reported to the scene (affects AI hearing/travel distance).")] public PerceptionMode PerceptionBehavior = PerceptionMode.Automatic; [Tooltip("When PerceptionBehavior == ForceEnvironment, use this environment for travel multiplier lookups.")] public FVRSoundEnvironment ForcedEnvironment = (FVRSoundEnvironment)11; [Tooltip("When PerceptionBehavior == UseVolumeOnly, scale perceived primary loudness by this multiplier (independent of environment).")] [Range(0f, 10f)] public float PerceptionVolumeMultiplier = 1f; [Header("Debris & Hole visuals")] [Tooltip("Optional debris prefab spawned when the suppressor breaks.")] public GameObject DebrisPrefab; [Tooltip("Spawn debris when the suppressor breaks.")] public bool SpawnDebrisOnBreak = true; [Tooltip("Min scale applied to spawned debris.")] public Vector3 DebrisScaleMin = new Vector3(0.2f, 0.2f, 0.2f); [Tooltip("Max scale applied to spawned debris.")] public Vector3 DebrisScaleMax = new Vector3(1.5f, 1.5f, 1.5f); [Tooltip("Lifetime of spawned debris (0 = no auto-destroy).")] public float DebrisLifetime = 5f; [Tooltip("Optional transform used as an animated 'hole' visual; its scale is driven by damage.")] public Transform HoleVisual; [Tooltip("Scale when intact (usually small or 0).")] public Vector3 HoleScaleAtIntact = Vector3.zero; [Tooltip("Scale when fully broken.")] public Vector3 HoleScaleAtBroken = Vector3.one; [Tooltip("How long to animate hole scale changes.")] public float HoleScaleAnimTime = 0.15f; private bool _isBroken = false; private readonly Dictionary _audioPlayStart = new Dictionary(); private FVRFireArm _cachedFirearm = null; private FVRFireArm _lastShotFirearm = null; private Coroutine _holeAnimCoroutine = null; public bool IsBroken => _isBroken; public override void Awake() { ((MuzzleDevice)this).Awake(); MaxIntegrity = Mathf.Max(1, MaxIntegrity); Integrity = Mathf.Clamp(Integrity, 0, MaxIntegrity); _isBroken = Integrity <= 0; ApplyVisualState(); UpdateHoleVisualImmediate(); } public float GetSuppressionMultiplier() { if (MaxIntegrity <= 0) { return LoudMultiplierAtBroken; } if (IsBroken) { return LoudMultiplierAtBroken; } float num = 1f - (float)Integrity / (float)MaxIntegrity; return Mathf.Lerp(QuietMultiplierAtFull, LoudMultiplierAtBroken, num); } public override void OnShot(FVRFireArm firearm, FVRTailSoundClass tailClass) { //IL_0004: 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) try { ((MuzzleDevice)this).OnShot(firearm, tailClass); } catch { } _lastShotFirearm = firearm; if (!IsBroken) { AttemptSilenceRecentAudioNearMuzzle(firearm); PlaySuppressedAudio(firearm); } NotifyPerception(firearm, tailClass); ApplyWear(); } private void AttemptSilenceRecentAudioNearMuzzle(FVRFireArm firearm) { //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_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_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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) Vector3 position = ((Component)this).transform.position; try { if ((Object)(object)firearm != (Object)null) { Transform muzzle = firearm.GetMuzzle(); if ((Object)(object)muzzle != (Object)null) { position = muzzle.position; } } } catch { } AudioSource[] array = Object.FindObjectsOfType(); float time = Time.time; foreach (AudioSource val in array) { if (!((Object)(object)val == (Object)null)) { bool isPlaying = val.isPlaying; bool flag = _audioPlayStart.ContainsKey(val); if (isPlaying && !flag) { _audioPlayStart[val] = time; } else if (!isPlaying && flag) { _audioPlayStart.Remove(val); } } } List list = new List(); foreach (KeyValuePair item in _audioPlayStart) { AudioSource key = item.Key; float value = item.Value; if (!((Object)(object)key == (Object)null) && key.isPlaying && !(time - value > RecentPlayMaxAge) && (!((Object)(object)LocalAudioSource != (Object)null) || !((Object)(object)key == (Object)(object)LocalAudioSource))) { Vector3 position2 = ((Component)key).transform.position; float num = Vector3.Distance(position2, position); if (num <= MuzzleSilenceRadius && (!((Object)(object)key.clip != (Object)null) || !(key.clip.length > 5f))) { list.Add(key); } } } for (int j = 0; j < list.Count; j++) { AudioSource s = list[j]; ((MonoBehaviour)this).StartCoroutine(FadeOutAndStopAudio(s, FadeOutTime)); } } private IEnumerator FadeOutAndStopAudio(AudioSource s, float fadeTime) { if ((Object)(object)s == (Object)null) { yield break; } float startVol = s.volume; float t = 0f; while (t < fadeTime) { if ((Object)(object)s == (Object)null) { yield break; } t += Time.deltaTime; float mul = 1f - Mathf.Clamp01(t / fadeTime); try { s.volume = startVol * mul; } catch { } yield return null; } try { s.Stop(); s.volume = startVol; } catch { } if (_audioPlayStart.ContainsKey(s)) { _audioPlayStart.Remove(s); } } private void PlaySuppressedAudio(FVRFireArm firearm) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_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_0105: 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) float suppressionMultiplier = GetSuppressionMultiplier(); float num = 1f; if ((Object)(object)SuppressedShotClip != (Object)null) { Vector3 val = ((Component)this).transform.position; try { if ((Object)(object)firearm != (Object)null) { Transform muzzle = firearm.GetMuzzle(); val = ((!((Object)(object)muzzle != (Object)null)) ? ((Component)firearm).transform.position : muzzle.position); } } catch { } float num2 = Mathf.Clamp01(SuppressedShotBaseVolume * suppressionMultiplier * num); if ((Object)(object)LocalAudioSource != (Object)null) { LocalAudioSource.PlayOneShot(SuppressedShotClip, num2); } else { AudioSource.PlayClipAtPoint(SuppressedShotClip, val, num2); } } if (!((Object)(object)SuppressedTailClip != (Object)null)) { return; } Vector3 position = ((Component)this).transform.position; try { if ((Object)(object)firearm != (Object)null) { Transform muzzle2 = firearm.GetMuzzle(); if ((Object)(object)muzzle2 != (Object)null) { position = muzzle2.position; } } } catch { } float num3 = Mathf.Clamp01(SuppressedTailBaseVolume * suppressionMultiplier * num); AudioSource.PlayClipAtPoint(SuppressedTailClip, position, num3); } private void NotifyPerception(FVRFireArm firearm, FVRTailSoundClass tailClass) { //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_008c: 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_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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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) try { Vector3 position = ((Component)this).transform.position; if ((Object)(object)firearm != (Object)null) { Transform muzzle = firearm.GetMuzzle(); if ((Object)(object)muzzle != (Object)null) { position = muzzle.position; } } float suppressionMultiplier = GetSuppressionMultiplier(); FVRSoundEnvironment val = (FVRSoundEnvironment)11; float num = 1f; int num2 = 0; try { num2 = GM.CurrentPlayerBody.GetPlayerIFF(); } catch { } if (PerceptionBehavior == PerceptionMode.Automatic) { try { val = GM.CurrentPlayerBody.GetCurrentSoundEnvironment(); } catch { } try { num = SM.GetSoundTravelDistanceMultByEnvironment(val); } catch { num = 1f; } } else if (PerceptionBehavior == PerceptionMode.ForceEnvironment) { val = ForcedEnvironment; try { num = SM.GetSoundTravelDistanceMultByEnvironment(val); } catch { num = 1f; } } else { num = 1f; } float num3 = 1f * suppressionMultiplier; if (PerceptionBehavior == PerceptionMode.UseVolumeOnly) { num3 *= PerceptionVolumeMultiplier; } float num4 = num3 * num * 0.5f; GM.CurrentSceneSettings.OnPerceiveableSound(num3, num4, position, num2, GM.CurrentPlayerBody.PlayerEntities[0]); } catch { } } private void ApplyWear() { if (!IsBroken) { Integrity -= WearPerShot; Integrity = Mathf.Clamp(Integrity, 0, MaxIntegrity); UpdateHoleVisual(); if (Integrity <= 0) { Integrity = 0; BreakSuppressor(); } } } private void BreakSuppressor() { //IL_0118: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00e2: 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_00ee: Unknown result type (might be due to invalid IL or missing references) if (_isBroken) { return; } _isBroken = true; ApplyVisualState(); if ((Object)(object)LocalAudioSource != (Object)null && (Object)(object)BreakClip != (Object)null) { LocalAudioSource.PlayOneShot(BreakClip); } else if ((Object)(object)BreakClip != (Object)null) { AudioSource.PlayClipAtPoint(BreakClip, ((Component)this).transform.position, 1f); } if (SpawnDebrisOnBreak && (Object)(object)DebrisPrefab != (Object)null) { Vector3 position = ((Component)this).transform.position; Quaternion rot = Quaternion.identity; if ((Object)(object)_lastShotFirearm != (Object)null) { try { Transform muzzle = _lastShotFirearm.GetMuzzle(); if ((Object)(object)muzzle != (Object)null) { position = muzzle.position; rot = muzzle.rotation; } else { position = ((Component)_lastShotFirearm).transform.position; } } catch { } } SpawnDebrisAt(position, rot, 1f); } if (AutoRepairAfterSeconds > 0f) { ((MonoBehaviour)this).StartCoroutine(AutoRepairCoroutine(AutoRepairAfterSeconds)); } } private IEnumerator AutoRepairCoroutine(float seconds) { yield return (object)new WaitForSeconds(seconds); RepairToFull(); } protected void ApplyVisualState() { if ((Object)(object)IntactVisual != (Object)null) { IntactVisual.SetActive(!_isBroken); } if ((Object)(object)BrokenVisual != (Object)null) { BrokenVisual.SetActive(_isBroken); } } public void RepairToFull() { Integrity = MaxIntegrity; _isBroken = false; ApplyVisualState(); UpdateHoleVisualImmediate(); } private void SpawnDebrisAt(Vector3 pos, Quaternion rot, float damageT) { //IL_001e: 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_0034: 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_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_0051: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)DebrisPrefab == (Object)null) { return; } try { GameObject val = Object.Instantiate(DebrisPrefab, pos, rot); if ((Object)(object)val != (Object)null) { Vector3 localScale = Vector3.Lerp(DebrisScaleMin, DebrisScaleMax, Mathf.Clamp01(damageT)); val.transform.localScale = localScale; if (DebrisLifetime > 0f) { Object.Destroy((Object)(object)val, DebrisLifetime); } } } catch { } } private IEnumerator AnimateHoleScale(Transform tform, Vector3 target, float duration) { //IL_0015: 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) if ((Object)(object)tform == (Object)null) { yield break; } Vector3 start = tform.localScale; float elapsed = 0f; while (elapsed < duration) { elapsed += Time.deltaTime; float i = Mathf.Clamp01(elapsed / duration); try { tform.localScale = Vector3.Lerp(start, target, i); } catch { } yield return null; } try { tform.localScale = target; } catch { } _holeAnimCoroutine = null; } private void UpdateHoleVisualImmediate() { //IL_002e: 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_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_004c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)HoleVisual == (Object)null) { return; } float num = 1f - (float)Integrity / (float)MaxIntegrity; Vector3 localScale = Vector3.Lerp(HoleScaleAtIntact, HoleScaleAtBroken, Mathf.Clamp01(num)); try { HoleVisual.localScale = localScale; } catch { } } private void UpdateHoleVisual() { //IL_002e: 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_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_0065: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)HoleVisual == (Object)null)) { float num = 1f - (float)Integrity / (float)MaxIntegrity; Vector3 target = Vector3.Lerp(HoleScaleAtIntact, HoleScaleAtBroken, Mathf.Clamp01(num)); if (_holeAnimCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_holeAnimCoroutine); } _holeAnimCoroutine = ((MonoBehaviour)this).StartCoroutine(AnimateHoleScale(HoleVisual, target, HoleScaleAnimTime)); } } public override void AttachToMount(FVRFireArmAttachmentMount m, bool playSound) { ((Suppressor)this).AttachToMount(m, playSound); _cachedFirearm = null; try { if (!((Object)(object)m != (Object)null)) { return; } FVRFireArmAttachmentMount rootMount = m.GetRootMount(); if ((Object)(object)rootMount != (Object)null && rootMount.Parent is FVRFireArm) { ref FVRFireArm cachedFirearm = ref _cachedFirearm; FVRPhysicalObject parent = rootMount.Parent; cachedFirearm = (FVRFireArm)(object)((parent is FVRFireArm) ? parent : null); return; } Transform val = ((Component)m).transform; while ((Object)(object)val != (Object)null) { FVRFireArm component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { _cachedFirearm = component; break; } val = val.parent; } } catch { } } } [RequireComponent(typeof(Rigidbody))] [RequireComponent(typeof(FVRPhysicalObject))] public class Boomerang : MonoBehaviour { public enum HandPreference { Nearest, Left, Right } public float spinTorque = 150f; public float lateralStrength = 8f; public float returnStrength = 40f; public float returnDelay = 0.6f; public float maxLifetime = 10f; public float pickupRadius = 0.4f; public bool autoAttachToHand = false; [Tooltip("How strongly lift counteracts gravity while in flight. 1 = full gravity cancel, 0 = no lift.")] public float liftFactor = 1.05f; [Tooltip("Minimum speed (m/s) the boomerang must be moving to be considered airborne. Below this it is treated as grounded.")] public float minAirborneSpeed = 1.5f; [Tooltip("Minimum release speed (m/s) required to arm the return. Below this it is treated as a drop, not a throw.")] public float minThrowSpeed = 3f; [Tooltip("Extra upward force applied during the return arc to maintain height.")] public float returnLiftBias = 2.5f; public HandPreference attachPreference = HandPreference.Nearest; private Rigidbody rb; private FVRPhysicalObject phys; private Transform playerHead; private bool wasHeldLastFrame; private bool thrown; private bool returnArmed; private bool returning; private float thrownTime; private float releaseSpeedAtThrow = 0f; private float origDrag = 0f; private float origAngularDrag = 0.05f; private void Awake() { rb = ((Component)this).GetComponent(); phys = ((Component)this).GetComponent(); playerHead = ((!((Object)(object)GM.CurrentPlayerBody != (Object)null)) ? null : GM.CurrentPlayerBody.Head); if ((Object)(object)rb != (Object)null) { rb.collisionDetectionMode = (CollisionDetectionMode)2; rb.maxAngularVelocity = Mathf.Max(rb.maxAngularVelocity, 200f); origDrag = rb.drag; origAngularDrag = rb.angularDrag; } } private void FixedUpdate() { //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_004d: 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_01f1: 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_00fb: 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_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: 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_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_0395: 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_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_053a: 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) if ((Object)(object)phys == (Object)null || (Object)(object)rb == (Object)null) { return; } bool isHeld = ((FVRInteractiveObject)phys).IsHeld; if (wasHeldLastFrame && !isHeld) { Vector3 velocity = rb.velocity; releaseSpeedAtThrow = ((Vector3)(ref velocity)).magnitude; thrown = true; returning = false; thrownTime = Time.time; returnArmed = releaseSpeedAtThrow >= minThrowSpeed; float num = Mathf.Clamp01(releaseSpeedAtThrow / Mathf.Max(minThrowSpeed, 0.0001f)); float num2 = spinTorque * Mathf.Lerp(0.35f, 1f, num); rb.maxAngularVelocity = Mathf.Max(rb.maxAngularVelocity, 200f); if (num > 0.01f) { rb.AddTorque(((Component)this).transform.up * num2, (ForceMode)2); } rb.drag = Mathf.Min(origDrag, 0.08f); rb.angularDrag = Mathf.Min(origAngularDrag, 0.02f); } wasHeldLastFrame = isHeld; if (!thrown) { return; } Vector3 velocity2 = rb.velocity; if (!(((Vector3)(ref velocity2)).sqrMagnitude > minAirborneSpeed * minAirborneSpeed) && Time.time - thrownTime > returnDelay) { ResetState(); rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; rb.drag = origDrag; rb.angularDrag = origAngularDrag; return; } Vector3 velocity3 = rb.velocity; if (((Vector3)(ref velocity3)).sqrMagnitude > 0.001f && releaseSpeedAtThrow >= minThrowSpeed) { Vector3 val = Vector3.Cross(((Vector3)(ref velocity3)).normalized, ((Component)this).transform.up); Vector3 normalized = ((Vector3)(ref val)).normalized; if (!float.IsNaN(normalized.x)) { float num3 = Mathf.Clamp01(((Vector3)(ref velocity3)).magnitude / Mathf.Max(minThrowSpeed, 1f)); rb.AddForce(normalized * lateralStrength * Mathf.Lerp(0.6f, 1f, num3), (ForceMode)5); } Rigidbody obj = rb; Vector3 gravity = Physics.gravity; Vector3 val2 = -((Vector3)(ref gravity)).normalized; Vector3 gravity2 = Physics.gravity; obj.AddForce(val2 * ((Vector3)(ref gravity2)).magnitude * liftFactor * 0.9f, (ForceMode)5); float num4 = Mathf.Clamp01(releaseSpeedAtThrow / Mathf.Max(minThrowSpeed, 0.0001f)); rb.AddTorque(((Component)this).transform.up * (spinTorque * 0.01f * Mathf.Lerp(0.6f, 1f, num4)), (ForceMode)5); } if (!returning && returnArmed && Time.time - thrownTime >= returnDelay) { returning = true; } if (returning) { Vector3 val3 = ((!((Object)(object)playerHead != (Object)null)) ? Vector3.zero : playerHead.position); if (autoAttachToHand) { FVRViveHand val4 = FindPreferredHand(); if ((Object)(object)val4 != (Object)null) { val3 = ((!((Object)(object)val4.PoseOverride != (Object)null)) ? ((Component)val4).transform.position : val4.PoseOverride.position); } } if (val3 != Vector3.zero) { Vector3 val5 = val3 - ((Component)this).transform.position; float magnitude = ((Vector3)(ref val5)).magnitude; Vector3 val6 = ((!(magnitude > 0.0001f)) ? Vector3.zero : ((Vector3)(ref val5)).normalized); float num5 = Mathf.Sqrt(Mathf.Clamp01(magnitude / 4f)) + 0.3f; rb.AddForce(val6 * returnStrength * num5, (ForceMode)5); rb.AddForce(Vector3.up * returnLiftBias, (ForceMode)5); rb.AddForce(-rb.velocity * 0.03f, (ForceMode)5); if (magnitude <= pickupRadius) { if (autoAttachToHand) { FVRViveHand val7 = FindPreferredHand(); if ((Object)(object)val7 != (Object)null) { val7.RetrieveObject(phys); ResetState(); rb.drag = origDrag; rb.angularDrag = origAngularDrag; return; } } ResetState(); rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; rb.drag = origDrag; rb.angularDrag = origAngularDrag; return; } } } if (Time.time - thrownTime > maxLifetime) { ResetState(); rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; rb.drag = origDrag; rb.angularDrag = origAngularDrag; } } private void ResetState() { thrown = false; returning = false; returnArmed = false; releaseSpeedAtThrow = 0f; } private FVRViveHand FindPreferredHand() { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_014c: 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) FVRViveHand[] array = Object.FindObjectsOfType(); if (array == null || array.Length == 0) { return null; } FVRViveHand result = null; if (attachPreference == HandPreference.Left) { FVRViveHand[] array2 = array; foreach (FVRViveHand val in array2) { if (!((Object)(object)val == (Object)null) && !val.IsThisTheRightHand) { result = val; break; } } return result; } if (attachPreference == HandPreference.Right) { FVRViveHand[] array3 = array; foreach (FVRViveHand val2 in array3) { if (!((Object)(object)val2 == (Object)null) && val2.IsThisTheRightHand) { result = val2; break; } } return result; } float num = float.MaxValue; Vector3 position = ((Component)this).transform.position; FVRViveHand[] array4 = array; foreach (FVRViveHand val3 in array4) { if (!((Object)(object)val3 == (Object)null)) { Vector3 val4 = ((!((Object)(object)val3.PoseOverride != (Object)null)) ? ((Component)val3).transform.position : val3.PoseOverride.position); Vector3 val5 = val4 - position; float sqrMagnitude = ((Vector3)(ref val5)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = val3; } } } return result; } } namespace VolksScripts { public class Bulletholder : FVRPhysicalObject { [Header("Bullet Slots")] [Tooltip("Positions where rounds will be placed. Order defines fill order.")] public List BulletSlots = new List(); [Header("Visuals (optional)")] public MeshRenderer SlotHighlight; [Header("Behaviors")] public bool ClearVelocityOnPlace = true; [Header("Capacity")] public int capacity = 8; private FVRFireArmRound[] _storedRounds; public int NumRounds { get; private set; } protected void Awake() { ((FVRPhysicalObject)this).Awake(); if (BulletSlots == null) { BulletSlots = new List(); } if (capacity <= 0 || capacity > BulletSlots.Count) { capacity = BulletSlots.Count; } _storedRounds = (FVRFireArmRound[])(object)new FVRFireArmRound[capacity]; NumRounds = 0; UpdateBulletDisplay(); } public bool TryPlace(FVRFireArmRound round) { if ((Object)(object)round == (Object)null || NumRounds >= capacity || capacity <= 0) { Debug.Log((object)"TryPlace failed: round is null or holder is full."); return false; } int num = FindFirstFreeSlot(); if (num < 0) { Debug.Log((object)"TryPlace failed: no free slot found."); return false; } Debug.Log((object)("TryPlace: placing round at slot " + num)); return PlaceAtIndex(round, num); } public bool PlaceAtIndex(FVRFireArmRound round, int index) { if ((Object)(object)round == (Object)null || index < 0 || index >= capacity || index >= BulletSlots.Count) { Debug.Log((object)("PlaceAtIndex failed: invalid round or index " + index)); return false; } if ((Object)(object)BulletSlots[index] == (Object)null) { Debug.Log((object)("PlaceAtIndex failed: slot " + index + " is null")); return false; } if ((Object)(object)_storedRounds[index] != (Object)null) { Debug.Log((object)("PlaceAtIndex failed: slot " + index + " already occupied")); return false; } PlaceAtSlot(round, BulletSlots[index]); _storedRounds[index] = round; NumRounds++; UpdateBulletDisplay(); if ((Object)(object)round != (Object)null) { ((FVRInteractiveObject)round).ForceBreakInteraction(); } Debug.Log((object)("PlaceAtIndex: round placed at slot " + index)); return true; } public FVRFireArmRound RemoveAt(int index) { if (index < 0 || index >= capacity) { return null; } FVRFireArmRound val = _storedRounds[index]; if ((Object)(object)val != (Object)null) { _storedRounds[index] = null; NumRounds--; UpdateBulletDisplay(); } return val; } public FVRFireArmRound GetAt(int index) { if (index < 0 || index >= capacity) { return null; } return _storedRounds[index]; } public void ClearAll() { for (int i = 0; i < capacity; i++) { _storedRounds[i] = null; } NumRounds = 0; UpdateBulletDisplay(); } private void PlaceAtSlot(FVRFireArmRound round, Transform slot) { //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_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_008e: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f7: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)slot == (Object)null)) { Vector3 up = ((Component)this).transform.up; Rigidbody val = ((!((Object)(object)((FVRPhysicalObject)round).RootRigidbody != (Object)null)) ? ((Component)round).GetComponent() : ((FVRPhysicalObject)round).RootRigidbody); if ((Object)(object)val != (Object)null && ClearVelocityOnPlace) { val.velocity = Vector3.zero; val.angularVelocity = Vector3.zero; } ((Component)round).transform.rotation = Quaternion.LookRotation(((Component)this).transform.forward, up); if (TryGetBaseAndTipAlongUp(round, up, out var baseAlongUp, out var _)) { float num = Vector3.Dot(slot.position, up); float num2 = num - baseAlongUp; Transform transform = ((Component)round).transform; transform.position += up * num2; Collider componentInChildren = ((Component)round).GetComponentInChildren(); Bounds bounds = componentInChildren.bounds; Vector3 val2 = Vector3.ProjectOnPlane(slot.position, up); Vector3 val3 = Vector3.ProjectOnPlane(((Bounds)(ref bounds)).center, up); Vector3 val4 = val2 - val3; Transform transform2 = ((Component)round).transform; transform2.position += val4; } else { ((Component)round).transform.position = slot.position; } if ((Object)(object)SlotHighlight != (Object)null) { ((Component)SlotHighlight).transform.position = slot.position; } } } private bool TryGetBaseAndTipAlongUp(FVRFireArmRound round, Vector3 up, out float baseAlongUp, out float tipAlongUp) { //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) //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_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) baseAlongUp = (tipAlongUp = 0f); Collider componentInChildren = ((Component)round).GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { return false; } Bounds bounds = componentInChildren.bounds; baseAlongUp = Vector3.Dot(((Bounds)(ref bounds)).min, up); tipAlongUp = Vector3.Dot(((Bounds)(ref bounds)).max, up); return true; } private int FindFirstFreeSlot() { for (int i = 0; i < capacity; i++) { if (i < BulletSlots.Count && !((Object)(object)BulletSlots[i] == (Object)null) && (Object)(object)_storedRounds[i] == (Object)null) { return i; } } return -1; } public void UpdateBulletDisplay() { for (int i = 0; i < BulletSlots.Count; i++) { if ((Object)(object)BulletSlots[i] != (Object)null) { } } } private void OnTriggerEnter(Collider other) { FVRFireArmRound componentInParent = ((Component)other).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null)) { TryPlace(componentInParent); } } } public class BulletholderReloadTrigger : MonoBehaviour { public Bulletholder Holder; private void OnTriggerEnter(Collider other) { if ((Object)(object)Holder == (Object)null) { Debug.LogWarning((object)"BulletholderReloadTrigger: Holder not assigned."); return; } FVRFireArmRound componentInParent = ((Component)other).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { Holder.TryPlace(componentInParent); } } } public class ShellCaddy : FVRFireArmMagazine { [Header("Caddy Configuration")] public int MaxCapacity = 8; public Transform DisplayContainer; private readonly List roundClassData = new List(); private int currentCapacity; private bool hasRoundType; private FireArmRoundType storedRoundType; private GameObject displayRoot; public override void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArmMagazine)this).Awake(); roundClassData.Clear(); currentCapacity = 0; hasRoundType = false; storedRoundType = (FireArmRoundType)0; } public override void Start() { ((FVRInteractiveObject)this).Start(); UpdateDisplayMag(); } public void AddShell(FVRFireArmRound shell) { //IL_005a: 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_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_0081: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)shell == (Object)null || !((FVRPhysicalObject)shell).m_isVisible || currentCapacity >= MaxCapacity) { Debug.LogWarning((object)"Invalid shell or caddy is full."); return; } if (!hasRoundType) { hasRoundType = true; storedRoundType = shell.RoundType; } if (shell.RoundType != storedRoundType) { Debug.LogWarning((object)"Shell type mismatch."); return; } roundClassData.Add(shell.RoundClass); currentCapacity++; Object.Destroy((Object)(object)((Component)shell).gameObject); UpdateDisplayMag(); } public FVRFireArmRound RemoveShell() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) if (currentCapacity == 0) { Debug.LogWarning((object)"No shells to remove."); return null; } FireArmRoundClass val = roundClassData[currentCapacity - 1]; roundClassData.RemoveAt(currentCapacity - 1); currentCapacity--; if (!hasRoundType || (Object)(object)DisplayContainer == (Object)null) { UpdateDisplayMag(); return null; } GameObject val2 = Object.Instantiate(((AnvilAsset)AM.GetRoundSelfPrefab(storedRoundType, val)).GetGameObject(), DisplayContainer.position, DisplayContainer.rotation); UpdateDisplayMag(); return val2.GetComponent(); } private void UpdateDisplayMag() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0084: 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_00b6: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)displayRoot != (Object)null) { Object.Destroy((Object)(object)displayRoot); displayRoot = null; } if (currentCapacity <= 0 || (Object)(object)DisplayContainer == (Object)null || !hasRoundType) { return; } displayRoot = new GameObject("ShellCaddyDisplay"); displayRoot.transform.SetParent(DisplayContainer, false); for (int i = 0; i < currentCapacity; i++) { GameObject val = Object.Instantiate(((AnvilAsset)AM.GetRoundSelfPrefab(storedRoundType, roundClassData[i])).GetGameObject(), displayRoot.transform); val.transform.localPosition = Vector3.down * (float)i * 0.02f; val.transform.localRotation = Quaternion.identity; Rigidbody component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; component.detectCollisions = false; } Collider[] componentsInChildren = val.GetComponentsInChildren(); for (int j = 0; j < componentsInChildren.Length; j++) { componentsInChildren[j].enabled = false; } } } public void ResetCaddy() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) roundClassData.Clear(); currentCapacity = 0; hasRoundType = false; storedRoundType = (FireArmRoundType)0; if ((Object)(object)displayRoot != (Object)null) { Object.Destroy((Object)(object)displayRoot); displayRoot = null; } UpdateDisplayMag(); } public void HandleCollision(Collider other) { FVRFireArmRound component = ((Component)other).GetComponent(); if ((Object)(object)component != (Object)null) { AddShell(component); } } } public class ShellCaddy_Reception : MonoBehaviour { public ShellCaddy caddy; private void OnTriggerStay(Collider other) { caddy.HandleCollision(other); } } } public class Compass : FVRPhysicalObject { [Header("Compass Lid")] public Transform Lid; public float openRotationX = 90f; public float openRotationY = 0f; public float openRotationZ = 0f; public float closeRotationX = 0f; public float closeRotationY = 0f; public float closeRotationZ = 0f; public float lidRotationSpeed = 5f; public AudioSource openCloseAudioSource; public AudioClip openClip; public AudioClip closeClip; [Header("Compass Needle")] public Transform Needle; [Tooltip("The direction that is considered North. Default is (0,0,1) (Z+).")] public Vector3 NorthDirection = Vector3.forward; public float needleSmoothTime = 0.5f; public float needleWobbleAmount = 2f; public float needleWobbleSpeed = 5f; private bool isOpen = false; private bool isTouching = false; private Vector2 initTouch = Vector2.zero; private Vector2 lastTouchPoint = Vector2.zero; private float currentNeedleAngle = 0f; private float needleVelocity = 0f; private void Update() { //IL_003a: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00b5: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) Quaternion val = ((!isOpen) ? Quaternion.Euler(closeRotationX, closeRotationY, closeRotationZ) : Quaternion.Euler(openRotationX, openRotationY, openRotationZ)); if ((Object)(object)Lid != (Object)null) { Lid.localRotation = Quaternion.Lerp(Lid.localRotation, val, Time.deltaTime * lidRotationSpeed); } if ((Object)(object)Needle != (Object)null) { Vector3 normalized = ((Vector3)(ref NorthDirection)).normalized; Vector3 val2 = Vector3.ProjectOnPlane(((Component)this).transform.forward, Vector3.up); Vector3 val3 = Vector3.ProjectOnPlane(normalized, Vector3.up); float num = Mathf.Atan2(Vector3.Cross(val2, val3).y, Vector3.Dot(val2, val3)) * 57.29578f; float num2 = Mathf.Sin(Time.time * needleWobbleSpeed) * needleWobbleAmount; num += num2; currentNeedleAngle = Mathf.SmoothDampAngle(currentNeedleAngle, num, ref needleVelocity, needleSmoothTime); Needle.localRotation = Quaternion.Euler(0f, currentNeedleAngle, 0f); } } public void ToggleLid() { isOpen = !isOpen; if ((Object)(object)openCloseAudioSource != (Object)null) { openCloseAudioSource.PlayOneShot((!isOpen) ? closeClip : openClip); } } public override void UpdateInteraction(FVRViveHand hand) { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonDown || hand.Input.AXButtonDown) { ToggleLid(); } return; } if (hand.Input.TouchpadTouched && !isTouching && hand.Input.TouchpadAxes != Vector2.zero) { isTouching = true; initTouch = hand.Input.TouchpadAxes; } if (hand.Input.TouchpadTouchUp && isTouching) { isTouching = false; Vector2 val = lastTouchPoint; float y = (val - initTouch).y; if (y > 0.5f || y < -0.5f) { ToggleLid(); } initTouch = Vector2.zero; val = Vector2.zero; } lastTouchPoint = hand.Input.TouchpadAxes; } } public class SimpleDartboard : MonoBehaviour, IFVRDamageable { private class StuckRestore : MonoBehaviour { private Collider[] _colliders; private bool[] _origIsTrigger; private Rigidbody _rb; private bool _origKinematic; private Transform _boardTransform; private bool _restored; public void Initialize(Rigidbody rootRigidbody, Transform boardTransform) { _boardTransform = boardTransform; _rb = rootRigidbody; _colliders = ((Component)this).GetComponentsInChildren(); _origIsTrigger = new bool[_colliders.Length]; for (int i = 0; i < _colliders.Length; i++) { _origIsTrigger[i] = (Object)(object)_colliders[i] != (Object)null && _colliders[i].isTrigger; } if ((Object)(object)_rb != (Object)null) { _origKinematic = _rb.isKinematic; } else { _origKinematic = false; } _restored = false; } private void Update() { if (_restored) { return; } if (!((Component)this).transform.IsChildOf(_boardTransform)) { Restore(); return; } FVRPhysicalObject componentInParent = ((Component)this).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && ((FVRInteractiveObject)componentInParent).IsHeld) { Restore(); } } private void Restore() { if (_restored) { return; } _restored = true; if (_colliders != null && _origIsTrigger != null) { int num = Mathf.Min(_colliders.Length, _origIsTrigger.Length); for (int i = 0; i < num; i++) { if (!((Object)(object)_colliders[i] == (Object)null)) { _colliders[i].isTrigger = _origIsTrigger[i]; } } } if ((Object)(object)_rb != (Object)null) { _rb.isKinematic = _origKinematic; } Object.Destroy((Object)(object)this); } private void OnDestroy() { if (!_restored) { Restore(); } } } [Header("Dartboard Settings")] public float minSharpDamage = 10f; [Header("Damage Thresholds")] [Tooltip("Minimum blunt damage required to consider sticking (0 disables blunt threshold).")] public float MinBlunt = 0f; [Tooltip("Minimum cutting damage required to consider sticking (0 disables cutting threshold).")] public float MinCutting = 0f; [Tooltip("Minimum piercing damage required to consider sticking (0 disables piercing threshold).")] public float MinPiercing = 10f; [Tooltip("Minimum total kinetic damage required to consider sticking (0 disables total threshold).")] public float MinTotal = 0f; [Tooltip("If true, stick when ANY threshold is met. If false, require Dam_TotalKinetic >= MinTotal.")] public bool AcceptIfAnyThreshold = true; [Header("Damage Classes")] [Tooltip("If true, accept Melee damage.")] public bool AcceptMelee = true; [Tooltip("If true, accept Projectile damage.")] public bool AcceptProjectile = true; [Tooltip("If true, accept other damage classes.")] public bool AcceptOtherDamageClasses = true; [Header("Damage Type Filters")] [Tooltip("If true, include blunt damage checks when evaluating thresholds.")] public bool AcceptBluntDamage = true; [Tooltip("If true, include cutting damage checks when evaluating thresholds.")] public bool AcceptCuttingDamage = true; [Tooltip("If true, include piercing damage checks when evaluating thresholds.")] public bool AcceptPiercingDamage = true; [Tooltip("If true, include total kinetic damage checks when evaluating thresholds.")] public bool AcceptTotalDamage = true; [Header("Sticking Settings")] [Tooltip("Radius (meters) around hit point to search for candidate objects to stick.")] public float StickSearchRadius = 0.6f; [Tooltip("Preferred maximum distance from hit point to object's collider closest point for easy sticking.")] public float StickMaxClosestDist = 0.25f; [Tooltip("If true, allow sticking objects that are currently held (will force break).")] public bool AllowStickingHeldObjects = false; [Header("Audio")] public AudioEvent HitEvent; public FVRPooledAudioType PoolType = (FVRPooledAudioType)0; public float HitSoundRefire = 0.1f; private float m_refireTick; private FVRPhysicalObject _myFvrObject; private void Awake() { _myFvrObject = ((Component)this).GetComponentInParent(); } private void Update() { if (m_refireTick > 0f) { m_refireTick -= Time.deltaTime; } } void IFVRDamageable.Damage(Damage d) { //IL_0003: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_0120: Unknown result type (might be due to invalid IL or missing references) if (!IsDamageClassAccepted(d.Class) || !EvaluateDamageThresholds(d)) { return; } PlayHitSound(Mathf.Clamp(d.Dam_TotalKinetic / 20f, 0.05f, 1f)); Collider[] array = Physics.OverlapSphere(d.point, StickSearchRadius, -1, (QueryTriggerInteraction)2); FVRPhysicalObject val = null; float num = float.MaxValue; foreach (Collider val2 in array) { if ((Object)(object)val2 == (Object)null) { continue; } FVRPhysicalObject componentInParent = ((Component)val2).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)componentInParent == (Object)(object)_myFvrObject) && !((Component)componentInParent).transform.IsChildOf(((Component)_myFvrObject).transform) && !((Component)_myFvrObject).transform.IsChildOf(((Component)componentInParent).transform) && (!((FVRInteractiveObject)componentInParent).IsHeld || AllowStickingHeldObjects)) { Vector3 val3 = val2.ClosestPoint(d.point); float num2 = Vector3.Distance(val3, d.point); if (num2 <= StickMaxClosestDist) { val = componentInParent; num = num2; break; } if (num2 < num) { num = num2; val = componentInParent; } } } if ((Object)(object)val != (Object)null && num <= StickSearchRadius * 1.5f) { StickObject(val); } } private bool IsDamageClassAccepted(DamageClass cls) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 if ((int)cls != 3) { if ((int)cls == 1) { return AcceptProjectile; } return AcceptOtherDamageClasses; } return AcceptMelee; } private bool EvaluateDamageThresholds(Damage d) { if (AcceptIfAnyThreshold) { if (AcceptPiercingDamage && MinPiercing > 0f && d.Dam_Piercing >= MinPiercing) { return true; } if (AcceptCuttingDamage && MinCutting > 0f && d.Dam_Cutting >= MinCutting) { return true; } if (AcceptBluntDamage && MinBlunt > 0f && d.Dam_Blunt >= MinBlunt) { return true; } if (AcceptTotalDamage && MinTotal > 0f && d.Dam_TotalKinetic >= MinTotal) { return true; } if (MinBlunt <= 0f && MinCutting <= 0f && MinPiercing <= 0f && MinTotal <= 0f) { float num = 0f; if (AcceptPiercingDamage) { num += d.Dam_Piercing; } if (AcceptCuttingDamage) { num += d.Dam_Cutting; } if (!AcceptPiercingDamage && !AcceptCuttingDamage) { return false; } return num >= minSharpDamage; } return false; } if (MinTotal > 0f && AcceptTotalDamage) { return d.Dam_TotalKinetic >= MinTotal; } float num2 = 0f; if (AcceptPiercingDamage) { num2 += d.Dam_Piercing; } if (AcceptCuttingDamage) { num2 += d.Dam_Cutting; } if (!AcceptPiercingDamage && !AcceptCuttingDamage) { return false; } return num2 >= minSharpDamage; } private void StickObject(FVRPhysicalObject obj) { //IL_0070: 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) if ((Object)(object)obj == (Object)null) { return; } if (((FVRInteractiveObject)obj).IsHeld) { ((FVRInteractiveObject)obj).ForceBreakInteraction(); } obj.ClearQuickbeltState(); Rigidbody rootRigidbody = obj.RootRigidbody; GameObject val = ((!((Object)(object)rootRigidbody != (Object)null)) ? ((Component)obj).gameObject : ((Component)rootRigidbody).gameObject); StuckRestore stuckRestore = val.AddComponent(); stuckRestore.Initialize(rootRigidbody, ((Component)this).transform); if ((Object)(object)rootRigidbody != (Object)null) { rootRigidbody.velocity = Vector3.zero; rootRigidbody.angularVelocity = Vector3.zero; rootRigidbody.isKinematic = true; } Collider[] componentsInChildren = ((Component)obj).GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)componentsInChildren[i] != (Object)null) { componentsInChildren[i].isTrigger = true; } } ((Component)obj).transform.SetParent(((Component)this).transform); } private void PlayHitSound(float soundMultiplier) { //IL_007d: 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_009f: 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_005a: 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) if (m_refireTick <= 0f && HitEvent != null) { m_refireTick = HitSoundRefire; float num = 0f; if ((Object)(object)GM.CurrentPlayerBody != (Object)null && (Object)(object)GM.CurrentPlayerBody.Head != (Object)null) { num = Vector3.Distance(((Component)this).transform.position, GM.CurrentPlayerBody.Head.position); } float num2 = num / 343f; SM.PlayCoreSoundDelayedOverrides(PoolType, HitEvent, ((Component)this).transform.position, HitEvent.VolumeRange * soundMultiplier, HitEvent.PitchRange, num2 + 0.04f); } } } public class FlamethrowerValve : FVRInteractiveObject { [Header("References")] public Transform RefFrame; public Transform Valve; [Header("Rotation Settings")] public Vector2 ValveRotRange = new Vector2(-50f, 50f); private float m_valveRot; [Header("Runtime")] public float Lerp = 0.5f; private Vector3 refDir = Vector3.one; public override void BeginInteraction(FVRViveHand hand) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_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_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) Vector3 up = ((HandInput)(ref hand.Input)).Up; Vector3 val = Vector3.ProjectOnPlane(up, RefFrame.right); refDir = ((Vector3)(ref val)).normalized; ((FVRInteractiveObject)this).BeginInteraction(hand); } public override void UpdateInteraction(FVRViveHand hand) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //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_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_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_0038: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00ea: Unknown result type (might be due to invalid IL or missing references) Vector3 up = ((HandInput)(ref hand.Input)).Up; Vector3 val = Vector3.ProjectOnPlane(up, RefFrame.right); Vector3 normalized = ((Vector3)(ref val)).normalized; float num = Mathf.Atan2(Vector3.Dot(RefFrame.right, Vector3.Cross(refDir, normalized)), Vector3.Dot(refDir, normalized)) * 57.29578f; num = Mathf.Clamp(num, -5f, 5f); m_valveRot += num; m_valveRot = Mathf.Clamp(m_valveRot, ValveRotRange.x, ValveRotRange.y); Valve.localEulerAngles = new Vector3(m_valveRot, 0f, 0f); Lerp = Mathf.InverseLerp(ValveRotRange.x, ValveRotRange.y, m_valveRot); refDir = normalized; ((FVRInteractiveObject)this).UpdateInteraction(hand); } } namespace VolksScripts { public class FlareBody : FVRPhysicalObject { [Header("Flare Parts")] public GameObject FlareHead; public Transform HeadAttachPoint; public Collider StrikeArea; [Header("Ignition")] public int MinStrikesToIgnite = 2; public int MaxStrikesToIgnite = 5; public float StrikeCooldown = 0.2f; [Header("Strike Force")] public float MinStrikeSpeed = 1.2f; [Header("Strike Timing")] public float StrikeArmDelay = 0.2f; [Header("Return")] public float ReturnHeadDelay = 2f; [Header("Strike Effects")] public ParticleSystem StrikeParticles; public int StrikeParticlesPerHit = 1; public AudioSource StrikeSound; [Header("Effects")] public GameObject FlareEffectsRoot; public ParticleSystem FlareParticles; public Light FlareLight; public AudioSource IgniteSound; public AudioSource BurnLoopSound; public AudioSource DieSound; [Header("Lifetime")] public float FlareLifetime = 20f; [Header("Debug")] public bool EnableDebug = false; private int m_strikeCount = 0; private int m_strikesRequired = 3; private bool m_isHeadAttached = true; private bool m_isIgnited = false; private float m_lastStrikeTime = -1f; private float m_nextStrikeAllowedTime = 0f; private Coroutine m_lifetimeCoroutine; private Coroutine m_returnCoroutine; private List m_headColliders = new List(); private bool[] m_headOrigIsTrigger; private Rigidbody m_headRigidbody; private Vector3 m_lastHeadPos; private float m_lastHeadTime; public override void Awake() { ((FVRPhysicalObject)this).Awake(); AttachHead(); ForceStopParticles(StrikeParticles); ForceStopParticles(FlareParticles); if ((Object)(object)FlareEffectsRoot != (Object)null) { FlareEffectsRoot.SetActive(false); } else if ((Object)(object)FlareLight != (Object)null) { ((Behaviour)FlareLight).enabled = false; } if ((Object)(object)BurnLoopSound != (Object)null) { BurnLoopSound.Stop(); } int num = Mathf.Min(MinStrikesToIgnite, MaxStrikesToIgnite); int num2 = Mathf.Max(MinStrikesToIgnite, MaxStrikesToIgnite); m_strikesRequired = Random.Range(num, num2 + 1); } public override void FVRUpdate() { //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) ((FVRPhysicalObject)this).FVRUpdate(); if (!m_isHeadAttached && (Object)(object)FlareHead != (Object)null) { m_lastHeadPos = FlareHead.transform.position; m_lastHeadTime = Time.time; } } public void DetachHead() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (!m_isHeadAttached) { return; } m_isHeadAttached = false; CacheHeadComponents(); SetHeadStrikeCollision(ignore: false); if ((Object)(object)FlareHead != (Object)null) { FlareHead.transform.parent = null; if ((Object)(object)m_headRigidbody != (Object)null) { m_headRigidbody.isKinematic = false; } m_lastHeadPos = FlareHead.transform.position; m_lastHeadTime = Time.time; } m_nextStrikeAllowedTime = Time.time + StrikeArmDelay; StartReturnTimer(); } public void AttachHead() { //IL_00b8: 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_0075: 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) m_isHeadAttached = true; if (m_returnCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(m_returnCoroutine); m_returnCoroutine = null; } if ((Object)(object)FlareHead != (Object)null && (Object)(object)HeadAttachPoint != (Object)null) { CacheHeadComponents(); if ((Object)(object)m_headRigidbody != (Object)null) { m_headRigidbody.isKinematic = true; m_headRigidbody.velocity = Vector3.zero; m_headRigidbody.angularVelocity = Vector3.zero; } SetHeadStrikeCollision(ignore: true); FlareHead.transform.parent = HeadAttachPoint; FlareHead.transform.localPosition = Vector3.zero; FlareHead.transform.localRotation = Quaternion.identity; FlareHead component = FlareHead.GetComponent(); if ((Object)(object)component != (Object)null) { component.Body = this; } } } private void StartReturnTimer() { if (m_returnCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(m_returnCoroutine); } m_returnCoroutine = ((MonoBehaviour)this).StartCoroutine(ReturnHeadCoroutine()); } private IEnumerator ReturnHeadCoroutine() { yield return (object)new WaitForSeconds(ReturnHeadDelay); if (m_isIgnited || (Object)(object)FlareHead == (Object)null || m_isHeadAttached) { yield break; } FlareHead head = FlareHead.GetComponent(); if ((Object)(object)head == (Object)null) { yield break; } while (((FVRInteractiveObject)head).IsHeld) { if (m_isIgnited || (Object)(object)FlareHead == (Object)null || m_isHeadAttached) { yield break; } yield return null; } head.ReturnToBody(); } public void TryStrikeFromHead(Collider headStrikeCollider, Collision col) { //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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_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_0112: Unknown result type (might be due to invalid IL or missing references) if (m_isIgnited || m_isHeadAttached) { DebugLog("Blocked: ignited/head attached."); return; } if (Time.time < m_nextStrikeAllowedTime) { DebugLog("Strike gated by arm delay."); return; } if ((Object)(object)StrikeArea == (Object)null || (Object)(object)headStrikeCollider == (Object)null || col == null) { DebugLog("Missing strike refs."); return; } for (int i = 0; i < col.contacts.Length; i++) { ContactPoint val = col.contacts[i]; bool flag = (Object)(object)((ContactPoint)(ref val)).thisCollider == (Object)(object)headStrikeCollider || (Object)(object)((ContactPoint)(ref val)).otherCollider == (Object)(object)headStrikeCollider; bool flag2 = (Object)(object)((ContactPoint)(ref val)).thisCollider == (Object)(object)StrikeArea || (Object)(object)((ContactPoint)(ref val)).otherCollider == (Object)(object)StrikeArea; if (flag && flag2) { Vector3 relativeVelocity = col.relativeVelocity; if (((Vector3)(ref relativeVelocity)).magnitude >= MinStrikeSpeed) { Strike(((ContactPoint)(ref val)).point); return; } Vector3 relativeVelocity2 = col.relativeVelocity; DebugLog("Speed too low: " + ((Vector3)(ref relativeVelocity2)).magnitude.ToString("F2")); return; } } DebugLog("No valid head/body strike in contacts."); } public void TryStrikeFromHead(Collider headStrikeCollider, Collider other) { //IL_00b1: 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_00bb: 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) if (m_isIgnited || m_isHeadAttached) { DebugLog("Blocked: ignited/head attached."); } else if (Time.time < m_nextStrikeAllowedTime) { DebugLog("Strike gated by arm delay."); } else if ((Object)(object)StrikeArea == (Object)null || (Object)(object)headStrikeCollider == (Object)null || (Object)(object)other == (Object)null) { DebugLog("Missing strike refs."); } else if ((Object)(object)other == (Object)(object)StrikeArea) { float triggerStrikeSpeed = GetTriggerStrikeSpeed(other); if (triggerStrikeSpeed >= MinStrikeSpeed) { Vector3 impactPoint = other.ClosestPoint(((Component)headStrikeCollider).transform.position); Strike(impactPoint); } else { DebugLog("Trigger speed too low: " + triggerStrikeSpeed.ToString("F2")); } } } private float GetTriggerStrikeSpeed(Collider other) { //IL_001f: 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_0024: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_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) Rigidbody attachedRigidbody = other.attachedRigidbody; Vector3 val = ((!((Object)(object)attachedRigidbody != (Object)null)) ? Vector3.zero : attachedRigidbody.velocity); Vector3 headVelocity = GetHeadVelocity(); Vector3 val2 = headVelocity - val; return ((Vector3)(ref val2)).magnitude; } private Vector3 GetHeadVelocity() { //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_004b: 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_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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_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_008a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)FlareHead == (Object)null) { return Vector3.zero; } float num = Time.time - m_lastHeadTime; if (num <= 0f) { return Vector3.zero; } Vector3 result = (FlareHead.transform.position - m_lastHeadPos) / num; m_lastHeadPos = FlareHead.transform.position; m_lastHeadTime = Time.time; return result; } private void Strike(Vector3 impactPoint) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!(Time.time - m_lastStrikeTime < StrikeCooldown)) { m_lastStrikeTime = Time.time; m_strikeCount++; PlayStrikeParticles(impactPoint); if ((Object)(object)StrikeSound != (Object)null) { ((Component)StrikeSound).gameObject.SetActive(true); StrikeSound.Play(); } if (m_strikeCount >= m_strikesRequired) { Ignite(); } } } private void PlayStrikeParticles(Vector3 impactPoint) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)StrikeParticles == (Object)null)) { ((Component)StrikeParticles).gameObject.SetActive(true); ((Component)StrikeParticles).transform.position = impactPoint; StrikeParticles.Clear(true); int num = Mathf.Max(1, StrikeParticlesPerHit); StrikeParticles.Emit(num); } } private void Ignite() { m_isIgnited = true; if ((Object)(object)FlareEffectsRoot != (Object)null) { FlareEffectsRoot.SetActive(true); } else { ForcePlayParticles(FlareParticles); if ((Object)(object)FlareLight != (Object)null) { ((Component)FlareLight).gameObject.SetActive(true); ((Behaviour)FlareLight).enabled = true; } } if ((Object)(object)IgniteSound != (Object)null) { ((Component)IgniteSound).gameObject.SetActive(true); IgniteSound.Play(); } if ((Object)(object)BurnLoopSound != (Object)null) { ((Component)BurnLoopSound).gameObject.SetActive(true); BurnLoopSound.loop = true; BurnLoopSound.Play(); } if ((Object)(object)FlareHead != (Object)null) { Object.Destroy((Object)(object)FlareHead); } if (m_lifetimeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(m_lifetimeCoroutine); } m_lifetimeCoroutine = ((MonoBehaviour)this).StartCoroutine(FlareLifeCoroutine()); } private IEnumerator FlareLifeCoroutine() { yield return (object)new WaitForSeconds(FlareLifetime); if ((Object)(object)BurnLoopSound != (Object)null) { BurnLoopSound.Stop(); } if ((Object)(object)DieSound != (Object)null) { DieSound.Play(); } if ((Object)(object)FlareEffectsRoot != (Object)null) { FlareEffectsRoot.SetActive(false); } else { ForceStopParticles(FlareParticles); if ((Object)(object)FlareLight != (Object)null) { ((Behaviour)FlareLight).enabled = false; } } float dieSoundLength = ((!((Object)(object)DieSound != (Object)null) || !((Object)(object)DieSound.clip != (Object)null)) ? 0f : DieSound.clip.length); while (((FVRInteractiveObject)this).IsHeld) { yield return null; } float elapsed = 0f; while (elapsed < dieSoundLength) { if (((FVRInteractiveObject)this).IsHeld) { elapsed = 0f; while (((FVRInteractiveObject)this).IsHeld) { yield return null; } } elapsed += Time.deltaTime; yield return null; } Object.Destroy((Object)(object)((Component)this).gameObject); } private void ForcePlayParticles(ParticleSystem ps) { if (!((Object)(object)ps == (Object)null)) { ((Component)ps).gameObject.SetActive(true); ps.Clear(true); ps.Play(true); } } private void ForceStopParticles(ParticleSystem ps) { if (!((Object)(object)ps == (Object)null)) { ps.Stop(true, (ParticleSystemStopBehavior)0); } } private void CacheHeadComponents() { m_headColliders.Clear(); if ((Object)(object)FlareHead == (Object)null) { m_headRigidbody = null; m_headOrigIsTrigger = null; return; } m_headColliders.AddRange(FlareHead.GetComponentsInChildren(true)); m_headRigidbody = FlareHead.GetComponent(); if (m_headOrigIsTrigger != null && m_headOrigIsTrigger.Length == m_headColliders.Count) { return; } if (m_headColliders.Count > 0) { m_headOrigIsTrigger = new bool[m_headColliders.Count]; for (int i = 0; i < m_headColliders.Count; i++) { Collider val = m_headColliders[i]; m_headOrigIsTrigger[i] = (Object)(object)val != (Object)null && val.isTrigger; } } else { m_headOrigIsTrigger = null; } } private void SetHeadStrikeCollision(bool ignore) { if (m_headColliders == null || m_headColliders.Count == 0) { return; } for (int i = 0; i < m_headColliders.Count; i++) { Collider val = m_headColliders[i]; if (!((Object)(object)val == (Object)null)) { if ((Object)(object)StrikeArea != (Object)null) { Physics.IgnoreCollision(val, StrikeArea, ignore); } if (ignore) { val.isTrigger = true; } else if (m_headOrigIsTrigger != null && i < m_headOrigIsTrigger.Length) { val.isTrigger = m_headOrigIsTrigger[i]; } } } } private void DebugLog(string msg) { if (EnableDebug) { Debug.Log((object)("[FlareBody] " + msg)); } } } public class FlareHead : FVRPhysicalObject { [Header("Owner")] public FlareBody Body; [Header("Strike Collider")] public Collider StrikeCollider; public override void Awake() { ((FVRPhysicalObject)this).Awake(); } public override void BeginInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).BeginInteraction(hand); if ((Object)(object)Body != (Object)null) { Body.DetachHead(); } } public void ReturnToBody() { if (!((Object)(object)Body == (Object)null) && !((FVRInteractiveObject)this).IsHeld) { Body.AttachHead(); } } private void OnTransformParentChanged() { if ((Object)(object)Body != (Object)null && (Object)(object)((Component)this).transform.parent == (Object)null) { Body.DetachHead(); } } public override void OnCollisionEnter(Collision col) { ((FVRPhysicalObject)this).OnCollisionEnter(col); if ((Object)(object)Body != (Object)null && (Object)(object)StrikeCollider != (Object)null) { Body.TryStrikeFromHead(StrikeCollider, col); } } private void OnTriggerEnter(Collider other) { if ((Object)(object)Body != (Object)null && (Object)(object)StrikeCollider != (Object)null) { Body.TryStrikeFromHead(StrikeCollider, other); } } } } public class FlyingHotdog : MonoBehaviour { public enum FlapAxis { X, Y, Z } [Tooltip("Seconds to wait before the hotdog starts flying.")] public float waitTime = 2f; [Header("Speed Settings")] [Tooltip("Minimum speed the hotdog can fly.")] public float minFlySpeed = 3f; [Tooltip("Maximum speed the hotdog can fly.")] public float maxFlySpeed = 7f; [Tooltip("How often the hotdog changes direction (seconds).")] public float directionChangeInterval = 1f; [Tooltip("How much the hotdog can move up or down per direction change.")] public float verticalVariance = 2f; [Tooltip("How quickly the hotdog turns toward its new direction. Higher = snappier.")] public float turnSpeed = 1.2f; [Header("Flock Settings")] [Tooltip("Prefab of the hotdog to spawn.")] public GameObject hotdogPrefab; [Tooltip("Minimum number of hotdogs in a flock.")] public int minFlockSize = 3; [Tooltip("Maximum number of hotdogs in a flock.")] public int maxFlockSize = 8; [Tooltip("Spawn radius for flock members.")] public float flockRadius = 2f; [Tooltip("Minimum flying height (Y axis).")] public float minFlyHeight = 15f; [Tooltip("Maximum flying height (Y axis).")] public float maxFlyHeight = 25f; [Tooltip("If true, this object is a flock spawner.")] public bool isSpawner = true; [Tooltip("Delay before spawning the rest of the flock (seconds).")] public float flockSpawnDelay = 1f; [Header("Wing Flapping")] [Tooltip("Left wing mesh transform.")] public Transform leftWing; [Tooltip("Right wing mesh transform.")] public Transform rightWing; [Tooltip("Axis to rotate wings around.")] public FlapAxis flapAxis = FlapAxis.Z; [Tooltip("Maximum angle (degrees) for wing flap (from center to top/bottom).")] public float flapAngle = 45f; [Tooltip("Flap speed in cycles per second.")] public float flapSpeed = 2f; [Header("Geometry / Raycast")] [Tooltip("Layers considered world geometry for ceiling/ground detection and spawn overlap checks.\nDefault = Everything. Set this to the world geometry layer(s) to avoid hitting sky, triggers, or NPC layers.")] public LayerMask GeometryMask = LayerMask.op_Implicit(-1); private float wingFlapTime = 0f; private Quaternion leftWingBaseRot; private Quaternion rightWingBaseRot; private Rigidbody rb; private Vector3 flyDirection; private Vector3 targetDirection; private float currentFlySpeed; private float velocityLerp = 0f; private float targetFlyHeight; private bool isFlying = false; private void Start() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00f3: 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_010f: Unknown result type (might be due to invalid IL or missing references) rb = ((Component)this).GetComponent(); if ((Object)(object)rb == (Object)null) { rb = ((Component)this).gameObject.AddComponent(); } rb.useGravity = false; rb.isKinematic = true; rb.collisionDetectionMode = (CollisionDetectionMode)2; rb.interpolation = (RigidbodyInterpolation)1; rb.WakeUp(); if ((Object)(object)leftWing != (Object)null) { leftWingBaseRot = leftWing.localRotation; } if ((Object)(object)rightWing != (Object)null) { rightWingBaseRot = rightWing.localRotation; } if (isSpawner && (Object)(object)hotdogPrefab != (Object)null) { ((MonoBehaviour)this).StartCoroutine(SpawnFlockWithDelay()); return; } currentFlySpeed = minFlySpeed; targetFlyHeight = ComputeTargetHeight(((Component)this).transform.position); SetInitialDirection(); flyDirection = targetDirection; ((MonoBehaviour)this).StartCoroutine(FlyRoutine()); } private void Update() { AnimateWings(); } private void AnimateWings() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_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_00bf: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)leftWing == (Object)null) || !((Object)(object)rightWing == (Object)null)) { wingFlapTime += Time.deltaTime * flapSpeed * 2f * (float)Math.PI; float num = Mathf.Sin(wingFlapTime) * flapAngle; Vector3 val = Vector3.forward; switch (flapAxis) { case FlapAxis.X: val = Vector3.right; break; case FlapAxis.Y: val = Vector3.up; break; case FlapAxis.Z: val = Vector3.forward; break; } if ((Object)(object)leftWing != (Object)null) { leftWing.localRotation = leftWingBaseRot * Quaternion.AngleAxis(num, val); } if ((Object)(object)rightWing != (Object)null) { rightWing.localRotation = rightWingBaseRot * Quaternion.AngleAxis(0f - num, val); } } } private IEnumerator SpawnFlockWithDelay() { yield return (object)new WaitForSeconds(flockSpawnDelay); int flockCount = Random.Range(minFlockSize, maxFlockSize + 1); for (int i = 0; i < flockCount; i++) { Vector3 val = Random.insideUnitSphere * flockRadius; Vector3 desired = ((Component)this).transform.position + val; desired = ResolveSpawnPosition(desired, 8, 0.2f); GameObject val2 = Object.Instantiate(hotdogPrefab, desired, Quaternion.identity); val2.SetActive(true); FlyingHotdog component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { component.isSpawner = false; component.targetFlyHeight = component.ComputeTargetHeight(desired); } } Object.Destroy((Object)(object)((Component)this).gameObject); } private IEnumerator FlyRoutine() { yield return (object)new WaitForSeconds(waitTime); while (Mathf.Abs(((Component)this).transform.position.y - targetFlyHeight) > 0.1f) { yield return (object)new WaitForFixedUpdate(); float dt = Time.fixedDeltaTime; Vector3 pos = ((Component)this).transform.position; float ascendSpeed = Mathf.Lerp(minFlySpeed, maxFlySpeed, 0.5f); float nextY = Mathf.MoveTowards(pos.y, targetFlyHeight, ascendSpeed * dt); Vector3 nextPos = new Vector3(pos.x, nextY, pos.z); if ((Object)(object)rb == (Object)null) { rb = ((Component)this).GetComponent(); } if ((Object)(object)rb != (Object)null) { rb.MovePosition(nextPos); } } isFlying = true; ((MonoBehaviour)this).StartCoroutine(FlockFlyRoutine()); } private IEnumerator FlockFlyRoutine() { if ((Object)(object)rb == (Object)null) { rb = ((Component)this).GetComponent(); } if ((Object)(object)rb == (Object)null) { yield break; } RaycastHit hit = default(RaycastHit); while (true) { SetTargetDirection(); float targetSpeed = Random.Range(minFlySpeed, maxFlySpeed); float timer = 0f; float dt; for (velocityLerp = 0f; timer < directionChangeInterval; timer += dt) { yield return (object)new WaitForFixedUpdate(); dt = Time.fixedDeltaTime; velocityLerp += dt / directionChangeInterval; currentFlySpeed = Mathf.Lerp(currentFlySpeed, targetSpeed, velocityLerp); FlyingHotdog flyingHotdog = this; Vector3 val = Vector3.Slerp(flyDirection, targetDirection, dt * turnSpeed); flyingHotdog.flyDirection = ((Vector3)(ref val)).normalized; Vector3 move = flyDirection * currentFlySpeed * dt; Vector3 nextPos = ((Component)this).transform.position + move; nextPos.y = Mathf.Clamp(nextPos.y, minFlyHeight, maxFlyHeight); if (Physics.Raycast(((Component)this).transform.position, flyDirection, ref hit, ((Vector3)(ref move)).magnitude + 0.5f)) { Vector3 val2 = Vector3.Reflect(flyDirection, ((RaycastHit)(ref hit)).normal); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = Random.Range(-45f, 45f); Quaternion val3 = Quaternion.AngleAxis(num, ((RaycastHit)(ref hit)).normal); FlyingHotdog flyingHotdog2 = this; Vector3 val4 = val3 * normalized; flyingHotdog2.flyDirection = ((Vector3)(ref val4)).normalized; targetDirection = flyDirection; } if ((Object)(object)rb == (Object)null) { rb = ((Component)this).GetComponent(); } if ((Object)(object)rb != (Object)null) { rb.MovePosition(nextPos); } } } } private void SetInitialDirection() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_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_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) Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 val = ((Vector2)(ref insideUnitCircle)).normalized * 0.5f; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, 0f, val.y); targetDirection = ((Vector3)(ref val2)).normalized; } private void SetTargetDirection() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000e: 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_004f: 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_0078: 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) Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized; float num = Random.Range(0f - verticalVariance, verticalVariance); float num2 = Mathf.Clamp(((Component)this).transform.position.y + num, minFlyHeight, maxFlyHeight) - ((Component)this).transform.position.y; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(normalized.x, num2, normalized.y); targetDirection = ((Vector3)(ref val)).normalized; } public float ComputeTargetHeight(Vector3 pos) { //IL_0030: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_013b: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_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_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: 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_01ab: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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_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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) float num = minFlyHeight; float num2 = maxFlyHeight; int value = ((LayerMask)(ref GeometryMask)).value; float num3 = Mathf.Max(2f, num2 - num + 2f); Vector3 val = pos + Vector3.up * 2f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.up, ref val2, num3, value, (QueryTriggerInteraction)1) && ((RaycastHit)(ref val2)).point.y > pos.y + 0.5f && ((RaycastHit)(ref val2)).normal.y < -0.3f) { float num4 = ((RaycastHit)(ref val2)).point.y - 1f; return Mathf.Clamp(num4, num, num2); } float num5 = float.NegativeInfinity; bool flag = false; float num6 = num2 + 2f; Vector3[] array = (Vector3[])(object)new Vector3[5] { pos + Vector3.up * num6, pos + Vector3.up * num6 + ((Component)this).transform.right * 0.5f, pos + Vector3.up * num6 - ((Component)this).transform.right * 0.5f, pos + Vector3.up * num6 + ((Component)this).transform.forward * 0.5f, pos + Vector3.up * num6 - ((Component)this).transform.forward * 0.5f }; RaycastHit val3 = default(RaycastHit); for (int i = 0; i < array.Length; i++) { if (Physics.Raycast(array[i], Vector3.down, ref val3, num6 + 4f, value, (QueryTriggerInteraction)1) && !(((RaycastHit)(ref val3)).point.y < pos.y - 200f) && ((RaycastHit)(ref val3)).point.y > num5) { num5 = ((RaycastHit)(ref val3)).point.y; flag = true; } } if (flag) { float num7 = num5 + Mathf.Clamp((num + num2) * 0.5f, num, num2); return Mathf.Clamp(num7, num, num2); } if ((Object)(object)GM.CurrentPlayerBody != (Object)null && (Object)(object)GM.CurrentPlayerBody.Head != (Object)null) { float y = GM.CurrentPlayerBody.Head.position.y; return Mathf.Clamp(y + Mathf.Clamp(num, num, num2), num, num2); } float num8 = Mathf.Clamp(pos.y, num, num2); if (num8 < num || num8 > num2) { num8 = Mathf.Lerp(num, num2, 0.5f); } return num8; } private Vector3 ResolveSpawnPosition(Vector3 desired, int maxAttempts = 12, float stepUp = 0.25f) { //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_001d: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_018a: 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_00c9: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) Vector3 val = desired; float num = 0.25f; int value = ((LayerMask)(ref GeometryMask)).value; for (int i = 0; i < maxAttempts; i++) { Collider[] array = Physics.OverlapSphere(val, num, value, (QueryTriggerInteraction)1); bool flag = false; foreach (Collider val2 in array) { if (!((Object)(object)val2 == (Object)null) && !val2.isTrigger && (!((Object)(object)GM.CurrentPlayerBody != (Object)null) || !((Component)val2).transform.IsChildOf(((Component)GM.CurrentPlayerBody).transform))) { flag = true; break; } } if (!flag) { return val; } float num2 = stepUp * (1f + (float)i * 0.25f); val += Vector3.up * num2; } Vector3 val3 = desired + Vector3.up * (maxFlyHeight + 5f); RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3, Vector3.down, ref val4, maxFlyHeight + 20f, value, (QueryTriggerInteraction)1)) { float y = ((RaycastHit)(ref val4)).point.y; float num3 = Mathf.Clamp(y + Mathf.Clamp(minFlyHeight, minFlyHeight, maxFlyHeight), minFlyHeight, maxFlyHeight); return new Vector3(desired.x, num3, desired.z); } return desired; } } [ExecuteInEditMode] public class HolographicSight : MonoBehaviour { public Transform VirtualQuad; public float Scale = 1f; public bool SizeCompensation = true; private MaterialPropertyBlock m_block; private void OnEnable() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown m_block = new MaterialPropertyBlock(); ((Component)this).GetComponent().SetPropertyBlock(m_block); } private void OnWillRenderObject() { //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.InverseTransformPoint(((Component)VirtualQuad).transform.position); m_block.SetVector("_Offset", Vector4.op_Implicit(val)); m_block.SetFloat("_Scale", Scale); m_block.SetFloat("_SizeCompensation", (!SizeCompensation) ? 0f : 1f); ((Component)this).GetComponent().SetPropertyBlock(m_block); } } public class ClosedBoltMagRelease : FVRInteractiveObject { public ClosedBoltWeapon Weapon; protected void Awake() { ((FVRInteractiveObject)this).Awake(); } public override void SimpleInteraction(FVRViveHand hand) { if ((Object)(object)Weapon != (Object)null && ((Object)(object)((FVRInteractiveObject)Weapon).m_hand == (Object)null || (Object)(object)hand != (Object)(object)((FVRInteractiveObject)Weapon).m_hand)) { ((FVRFireArm)Weapon).EjectMag(false); } ((FVRInteractiveObject)this).SimpleInteraction(hand); } } namespace VolksScripts { public class GiantSlingshot : FVRFireArm { public enum StringScaleAxis { X, Y, Z } public enum AxisDirection { X, Y, Z, NegativeX, NegativeY, NegativeZ } [Header("Slingshot")] public Transform Basket; public Transform String_Left; public Transform String_Right; public Transform Centroid; public Transform String_LeftTarget; public Transform String_RightTarget; public GameObject ColGO_Upper; public GameObject ColGO_Basket; public Collider Col_Basket; [Header("Basket Rotation")] [Tooltip("Local rotation offset applied after LookRotation (degrees).")] public Vector3 BasketRotationOffsetEuler = Vector3.zero; [Tooltip("Use the basket's initial local rotation as an offset (keeps X=90 meshes aligned).")] public bool UseBasketInitialRotationOffset = true; [Tooltip("Which local axis represents the basket's forward direction.")] public AxisDirection BasketForwardAxis = AxisDirection.Y; [Header("String Settings")] [Tooltip("Local rotation offset applied after LookRotation (degrees).")] public Vector3 StringRotationOffsetEuler = Vector3.zero; [Tooltip("Base scale for strings (use to preserve mesh width/height).")] public Vector3 StringBaseScale = Vector3.one; [Tooltip("Which axis should be scaled to match string length.")] public StringScaleAxis StringScaleAxisMode = StringScaleAxis.Z; [Tooltip("Scale relative to rest length so resting scale starts at 1.")] public bool ScaleStringsFromRestLength = true; [Tooltip("Which axis of the string mesh points along the string direction.")] public AxisDirection StringForwardAxis = AxisDirection.Z; [Header("String Behavior Options")] [Tooltip("If true, position string meshes at the midpoint between their anchor and the basket (useful when string pivot is centered).")] public bool UseMidpointForStrings = false; [Tooltip("If true, parent string transforms to the Basket so they follow basket movement/rotation directly. Use carefully.")] public bool ParentStringsToBasket = false; [Header("Debug Gizmos")] public bool ShowDebugGizmos = true; public bool ShowGizmoLabels = true; public Color GizmoColorLeft = Color.cyan; public Color GizmoColorRight = Color.magenta; public float GizmoSphereRadius = 0.02f; [Header("Controls")] public List Controls; [Header("Mounting")] public Collider Col; public LayerMask LM_CTest; public float MountRaycastDistance = 0.2f; [Header("Audio")] public AudioEvent AudEvent_Mount; public AudioEvent AudEvent_Fire; [Header("Slingshot Settings")] public float maxSlingVel = 20f; public float maxSlingDistance = 0.5f; private FVRPhysicalObject m_slungObject; private Vector3 m_basketLocalOffset = Vector3.zero; private bool isSlungObjectBeingSlinged; private Vector3 m_basketWorldVel = Vector3.zero; public bool m_isCol; private float m_colChange; private RaycastHit m_hit; private Vector3 m_initHandPointAdjust_Horizontal = Vector3.zero; private Vector3 m_initHandPointAdjust_Vertical = Vector3.zero; private Quaternion m_basketInitialLocalRotation = Quaternion.identity; private float m_leftRestLength = 1f; private float m_rightRestLength = 1f; public bool IsMounted => m_isCol; private Vector3 ApplyScaleAxis(Vector3 baseScale, float length, float restLength) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) Vector3 result = default(Vector3); ((Vector3)(ref result))..ctor(baseScale.x, baseScale.y, baseScale.z); float num = Mathf.Max(0.01f, length); float num2 = num; if (ScaleStringsFromRestLength && restLength > 0.0001f) { num2 = num / restLength; } switch (StringScaleAxisMode) { case StringScaleAxis.X: result.x = num2; break; case StringScaleAxis.Y: result.y = num2; break; default: result.z = num2; break; } return result; } public override 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) ((FVRFireArm)this).Awake(); if ((Object)(object)Basket != (Object)null) { m_basketInitialLocalRotation = Basket.localRotation; } if (ParentStringsToBasket) { if ((Object)(object)String_Left != (Object)null) { String_Left.SetParent(Basket, true); } if ((Object)(object)String_Right != (Object)null) { String_Right.SetParent(Basket, true); } } ResetBasketToCentroid(); CacheRestStringLengths(); NormalizeStringsAtRest(); } private void NormalizeStringsAtRest() { //IL_0023: 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_0083: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)String_Left != (Object)null && !ParentStringsToBasket) { String_Left.localRotation = Quaternion.identity; } if ((Object)(object)String_Right != (Object)null && !ParentStringsToBasket) { String_Right.localRotation = Quaternion.identity; } if ((Object)(object)String_Left != (Object)null) { String_Left.localScale = ApplyScaleAxis(StringBaseScale, m_leftRestLength, m_leftRestLength); } if ((Object)(object)String_Right != (Object)null) { String_Right.localScale = ApplyScaleAxis(StringBaseScale, m_rightRestLength, m_rightRestLength); } } private void ResetBasketToCentroid() { //IL_0034: 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_0056: 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) if (!((Object)(object)Basket == (Object)null) && !((Object)(object)Centroid == (Object)null)) { Basket.position = Centroid.position; Basket.rotation = GetBasketRotation(Vector3.ProjectOnPlane(((Component)this).transform.forward, ((Component)this).transform.up)); SyncBasketCollider(); UpdateStrings(); } } public void BeginHandAdjust(Vector3 v, bool isHorizontal) { //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_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) if (isHorizontal) { m_initHandPointAdjust_Horizontal = v; } else { m_initHandPointAdjust_Vertical = v; } } public void UpdateHandAdjust(Vector3 v, bool isHorizontal) { //IL_0023: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_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_0133: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_01a0: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) //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_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) //IL_006d: 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_006f: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (!((FVRInteractiveObject)this).IsHeld) { Vector3 val = ((!isHorizontal) ? m_initHandPointAdjust_Vertical : m_initHandPointAdjust_Horizontal); if (isHorizontal) { Vector3 val2 = Vector3.ProjectOnPlane(val - ((Component)this).transform.position, Vector3.up); Vector3 val3 = Vector3.ProjectOnPlane(v - ((Component)this).transform.position, Vector3.up); float num = Mathf.Atan2(Vector3.Dot(Vector3.up, Vector3.Cross(val2, val3)), Vector3.Dot(val2, val3)) * 57.29578f; Vector3 forward = ((Component)this).transform.forward; forward = Quaternion.AngleAxis(num, Vector3.up) * forward; ((FVRPhysicalObject)this).PivotLockRot = Quaternion.LookRotation(forward, Vector3.up); ((Component)this).transform.rotation = ((FVRPhysicalObject)this).PivotLockRot; m_initHandPointAdjust_Horizontal = v; } else { Vector3 val4 = Vector3.ProjectOnPlane(val - ((Component)this).transform.position, ((Component)this).transform.right); Vector3 val5 = Vector3.ProjectOnPlane(v - ((Component)this).transform.position, ((Component)this).transform.right); float num2 = Mathf.Atan2(Vector3.Dot(((Component)this).transform.right, Vector3.Cross(val4, val5)), Vector3.Dot(val4, val5)) * 57.29578f; Vector3 forward2 = ((Component)this).transform.forward; forward2 = Quaternion.AngleAxis(num2, ((Component)this).transform.right) * forward2; ((FVRPhysicalObject)this).PivotLockRot = Quaternion.LookRotation(forward2, Vector3.up); ((Component)this).transform.rotation = ((FVRPhysicalObject)this).PivotLockRot; m_initHandPointAdjust_Vertical = v; } } } public override void OnCollisionEnter(Collision collision) { //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_00dd: 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_00e7: 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) ((FVRPhysicalObject)this).OnCollisionEnter(collision); if ((Object)(object)m_slungObject != (Object)null) { return; } if ((Object)(object)((ContactPoint)(ref collision.contacts[0])).thisCollider == (Object)(object)Col_Basket && (Object)(object)((ContactPoint)(ref collision.contacts[0])).otherCollider.attachedRigidbody != (Object)null && (Object)(object)((Component)((ContactPoint)(ref collision.contacts[0])).otherCollider.attachedRigidbody).gameObject.GetComponent() != (Object)null) { FVRPhysicalObject component = ((Component)((ContactPoint)(ref collision.contacts[0])).otherCollider.attachedRigidbody).gameObject.GetComponent(); if (((FVRInteractiveObject)component).IsHeld && !component.RootRigidbody.isKinematic) { m_slungObject = component; m_basketLocalOffset = ((Component)component).transform.InverseTransformPoint(Basket.position); if ((Object)(object)ColGO_Upper != (Object)null) { ColGO_Upper.SetActive(false); } if ((Object)(object)ColGO_Basket != (Object)null) { ColGO_Basket.SetActive(false); } SM.PlayCoreSound((FVRPooledAudioType)0, AudEvent_Mount, Basket.position); } } if (CanMakeColChange() && !m_isCol && ((FVRInteractiveObject)this).IsHeld) { Vector3 relativeVelocity = collision.relativeVelocity; if (((Vector3)(ref relativeVelocity)).magnitude > 1f && (Object)(object)((ContactPoint)(ref collision.contacts[0])).thisCollider == (Object)(object)Col && ((Object)(object)((ContactPoint)(ref collision.contacts[0])).otherCollider.attachedRigidbody == (Object)null || ((ContactPoint)(ref collision.contacts[0])).otherCollider.attachedRigidbody.isKinematic)) { ColOn(); } } } public override void FVRFixedUpdate() { //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0313: 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) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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_01db: 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_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_slungObject != (Object)null && ((Object)(object)m_slungObject.RootRigidbody == (Object)null || !((Component)m_slungObject).gameObject.activeSelf || (Object)(object)m_slungObject.QuickbeltSlot != (Object)null)) { m_slungObject = null; } if ((Object)(object)m_slungObject == (Object)null) { isSlungObjectBeingSlinged = false; } else if (!isSlungObjectBeingSlinged) { if (((FVRInteractiveObject)m_slungObject).IsHeld) { Vector3 position = ((Component)m_slungObject).transform.TransformPoint(m_basketLocalOffset); Basket.position = position; Vector3 forward = Centroid.position - Basket.position; if (((Vector3)(ref forward)).magnitude > 0.001f) { Basket.rotation = GetBasketRotation(forward); } SyncBasketCollider(); } else { isSlungObjectBeingSlinged = true; Vector3 val = Centroid.position - Basket.position; float magnitude = ((Vector3)(ref val)).magnitude; float num = Mathf.Clamp(magnitude / maxSlingDistance, 0f, 1f); float num2 = Mathf.Lerp(0.1f, maxSlingVel, num); m_slungObject.RootRigidbody.velocity = ((Vector3)(ref val)).normalized * num2; m_slungObject.RootRigidbody.angularVelocity = Vector3.zero; float num3 = 0.1f + 0.3f * num; float num4 = Random.Range(0.7f, 0.75f) + num * 0.4f; SM.PlayCoreSoundOverrides((FVRPooledAudioType)0, AudEvent_Fire, Basket.position, new Vector2(num3, num3), new Vector2(num4, num4)); m_basketWorldVel = Vector3.zero; } } else { Centroid.rotation = Quaternion.LookRotation(m_slungObject.RootRigidbody.velocity); if (Centroid.InverseTransformPoint(((Component)m_slungObject).transform.position).z >= 0.3f) { isSlungObjectBeingSlinged = false; m_slungObject = null; if ((Object)(object)ColGO_Upper != (Object)null) { ColGO_Upper.SetActive(true); } if ((Object)(object)ColGO_Basket != (Object)null) { ColGO_Basket.SetActive(true); } Basket.position = Centroid.position; Basket.rotation = GetBasketRotation(((Component)this).transform.forward); SyncBasketCollider(); } else { Vector3 position2 = ((Component)m_slungObject).transform.TransformPoint(m_basketLocalOffset); Basket.position = position2; Transform basket = Basket; Vector3 velocity = m_slungObject.RootRigidbody.velocity; basket.rotation = GetBasketRotation(((Vector3)(ref velocity)).normalized); SyncBasketCollider(); } } UpdateStrings(); if (m_colChange > 0f) { m_colChange -= Time.deltaTime; } ((FVRFireArm)this).FVRFixedUpdate(); } public override void UpdateInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).UpdateInteraction(hand); if ((hand.Input.VelLinearWorld.y > 0.5f || hand.Input.TriggerPressed) && m_isCol && CanMakeColChange()) { ColOff(); } } private void UpdateStrings() { //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_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_01ca: 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_01e1: 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_01ee: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_0248: 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_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0274: 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_0236: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_010a: 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) if ((Object)(object)String_Left == (Object)null || (Object)(object)String_Right == (Object)null || (Object)(object)String_LeftTarget == (Object)null || (Object)(object)String_RightTarget == (Object)null || (Object)(object)Basket == (Object)null) { return; } if (!UseMidpointForStrings) { String_Left.position = String_LeftTarget.position; String_Right.position = String_RightTarget.position; Vector3 dir = Basket.position - String_Left.position; Vector3 dir2 = Basket.position - String_Right.position; float magnitude = ((Vector3)(ref dir)).magnitude; float magnitude2 = ((Vector3)(ref dir2)).magnitude; if (magnitude > 0.001f) { String_Left.rotation = GetStringRotation(dir); } if (magnitude2 > 0.001f) { String_Right.rotation = GetStringRotation(dir2); } String_Left.localScale = ApplyScaleAxis(StringBaseScale, magnitude, m_leftRestLength); String_Right.localScale = ApplyScaleAxis(StringBaseScale, magnitude2, m_rightRestLength); return; } Vector3 position = String_LeftTarget.position; Vector3 position2 = String_RightTarget.position; Vector3 dir3 = Basket.position - position; Vector3 dir4 = Basket.position - position2; float magnitude3 = ((Vector3)(ref dir3)).magnitude; float magnitude4 = ((Vector3)(ref dir4)).magnitude; Vector3 position3 = (position + Basket.position) * 0.5f; Vector3 position4 = (position2 + Basket.position) * 0.5f; String_Left.position = position3; String_Right.position = position4; if (magnitude3 > 0.001f) { String_Left.rotation = GetStringRotation(dir3); } if (magnitude4 > 0.001f) { String_Right.rotation = GetStringRotation(dir4); } String_Left.localScale = ApplyScaleAxis(StringBaseScale, magnitude3, m_leftRestLength); String_Right.localScale = ApplyScaleAxis(StringBaseScale, magnitude4, m_rightRestLength); } private Quaternion GetStringRotation(Vector3 dir) { //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_000e: 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_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_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_0043: 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_0031: 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_0042: 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) Vector3 axisVector = GetAxisVector(StringForwardAxis); Quaternion val = Quaternion.FromToRotation(axisVector, ((Vector3)(ref dir)).normalized); if (StringRotationOffsetEuler != Vector3.zero) { val *= Quaternion.Euler(StringRotationOffsetEuler); } return val; } private Quaternion GetBasketRotation(Vector3 forward) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0056: 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_0079: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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) if (((Vector3)(ref forward)).sqrMagnitude < 0.0001f) { forward = ((Component)this).transform.forward; } Vector3 axisVector = GetAxisVector(BasketForwardAxis); Quaternion val = Quaternion.FromToRotation(axisVector, ((Vector3)(ref forward)).normalized); if (BasketRotationOffsetEuler != Vector3.zero) { val *= Quaternion.Euler(BasketRotationOffsetEuler); } if (UseBasketInitialRotationOffset) { val *= m_basketInitialLocalRotation; } return val; } private void CacheRestStringLengths() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)String_Left == (Object)null) && !((Object)(object)String_Right == (Object)null) && !((Object)(object)Basket == (Object)null) && !((Object)(object)String_LeftTarget == (Object)null) && !((Object)(object)String_RightTarget == (Object)null)) { Vector3 val = Basket.position - String_Left.position; Vector3 val2 = Basket.position - String_Right.position; m_leftRestLength = Mathf.Max(0.0001f, ((Vector3)(ref val)).magnitude); m_rightRestLength = Mathf.Max(0.0001f, ((Vector3)(ref val2)).magnitude); } } private Vector3 GetAxisVector(AxisDirection axis) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_005c: Unknown result type (might be due to invalid IL or missing references) return (Vector3)(axis switch { AxisDirection.X => Vector3.right, AxisDirection.Y => Vector3.up, AxisDirection.Z => Vector3.forward, AxisDirection.NegativeX => Vector3.left, AxisDirection.NegativeY => Vector3.down, _ => Vector3.back, }); } private void SyncBasketCollider() { //IL_0024: 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) if ((Object)(object)Col_Basket != (Object)null) { ((Component)Col_Basket).transform.position = Basket.position; ((Component)Col_Basket).transform.rotation = Basket.rotation; } } private bool CanMakeColChange() { return m_colChange <= 0f; } private void ColOn() { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_00a0: 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_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_00e6: 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_010c: 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_0182: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; Quaternion rotation = ((Component)this).transform.rotation; if (Vector3.Angle(Vector3.up, ((Component)this).transform.forward) > 80f || !Physics.Raycast(((Component)this).transform.position, Vector3.down, ref m_hit, MountRaycastDistance, LayerMask.op_Implicit(LM_CTest), (QueryTriggerInteraction)1)) { return; } position = ((RaycastHit)(ref m_hit)).point + Vector3.up * 0.022f; rotation = Quaternion.LookRotation(((HandInput)(ref ((FVRInteractiveObject)this).m_hand.Input)).Pos - position, Vector3.up); m_isCol = true; if ((Object)(object)Col != (Object)null) { Col.enabled = false; } m_colChange = 1f; ((Component)this).transform.position = position; ((Component)this).transform.rotation = rotation; ((FVRPhysicalObject)this).RootRigidbody.isKinematic = true; ((FVRPhysicalObject)this).IsPivotLocked = true; ((FVRPhysicalObject)this).PivotLockPos = position; ((FVRPhysicalObject)this).PivotLockRot = ((Component)this).transform.rotation; if (Controls != null) { for (int i = 0; i < Controls.Count; i++) { if ((Object)(object)Controls[i] != (Object)null) { Controls[i].SetActive(true); } } } SM.PlayImpactSound((ImpactType)160, (MatSoundType)3, (AudioImpactIntensity)2, ((Component)this).transform.position, (FVRPooledAudioType)41, 10f); } private void ColOff() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if (!m_isCol) { return; } m_isCol = false; m_colChange = 1f; if ((Object)(object)Col != (Object)null) { Col.enabled = true; } ((FVRPhysicalObject)this).RootRigidbody.isKinematic = false; ((FVRPhysicalObject)this).IsPivotLocked = false; if (Controls != null) { for (int i = 0; i < Controls.Count; i++) { if ((Object)(object)Controls[i] != (Object)null) { Controls[i].SetActive(false); } } } SM.PlayImpactSound((ImpactType)160, (MatSoundType)3, (AudioImpactIntensity)1, ((Component)this).transform.position, (FVRPooledAudioType)41, 10f); } private void OnDrawGizmos() { if (ShowDebugGizmos) { DrawStringGizmos(selected: false); } } private void OnDrawGizmosSelected() { if (ShowDebugGizmos) { DrawStringGizmos(selected: true); } } private void DrawStringGizmos(bool selected) { //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_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_0057: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0065: 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_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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00d7: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_0127: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: 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) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_020e: 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_021a: 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) if ((Object)(object)String_LeftTarget == (Object)null || (Object)(object)String_RightTarget == (Object)null || (Object)(object)Basket == (Object)null) { return; } Vector3 position = String_LeftTarget.position; Vector3 position2 = String_RightTarget.position; Vector3 position3 = Basket.position; Vector3 val = position3 - position; Vector3 val2 = position3 - position2; float magnitude = ((Vector3)(ref val)).magnitude; float magnitude2 = ((Vector3)(ref val2)).magnitude; Vector3 val3 = (position + position3) * 0.5f; Vector3 val4 = (position2 + position3) * 0.5f; Gizmos.color = GizmoColorLeft; Gizmos.DrawLine(position, position3); Gizmos.DrawWireSphere(position, GizmoSphereRadius); Gizmos.DrawWireSphere(val3, GizmoSphereRadius * 0.8f); Gizmos.DrawWireSphere(position3, GizmoSphereRadius * 0.6f); Gizmos.color = GizmoColorRight; Gizmos.DrawLine(position2, position3); Gizmos.DrawWireSphere(position2, GizmoSphereRadius); Gizmos.DrawWireSphere(val4, GizmoSphereRadius * 0.8f); if (ShowGizmoLabels) { Handles.color = GizmoColorLeft; Handles.Label(val3 + Vector3.up * GizmoSphereRadius * 1.5f, $"L:{magnitude:F3}"); Handles.color = GizmoColorRight; Handles.Label(val4 + Vector3.up * GizmoSphereRadius * 1.5f, $"R:{magnitude2:F3}"); if (selected && (Object)(object)String_Left != (Object)null && (Object)(object)String_Right != (Object)null) { Handles.color = Color.yellow; Handles.Label(position3 + Vector3.up * GizmoSphereRadius * 2.5f, "Basket"); float num = magnitude - magnitude2; Handles.Label(position3 + Vector3.up * GizmoSphereRadius * 3.5f, $"Δ:{num:F3}"); } } } } public class GiantSlingshotRotator : FVRInteractiveObject { [Tooltip("If true, this rotator adjusts horizontally; otherwise, vertically.")] public bool IsHorizontal = true; [Tooltip("Reference to the GiantSlingshot this rotator controls.")] public GiantSlingshot Slingshot; public override bool IsInteractable() { return (Object)(object)Slingshot != (Object)null && !((FVRInteractiveObject)Slingshot).IsHeld && Slingshot.m_isCol && ((FVRInteractiveObject)this).IsInteractable(); } public override void BeginInteraction(FVRViveHand hand) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).BeginInteraction(hand); if ((Object)(object)Slingshot != (Object)null) { Slingshot.BeginHandAdjust(hand.Input.FilteredPos, IsHorizontal); } } public override void UpdateInteraction(FVRViveHand hand) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); if ((Object)(object)Slingshot != (Object)null) { Slingshot.UpdateHandAdjust(hand.Input.FilteredPos, IsHorizontal); } } } public class HeartbeatSensor : FVRPhysicalObject { [Header("Sensor Settings")] public float[] ScanningRanges = new float[3] { 5f, 10f, 20f }; public int CurrentRangeIndex = 0; public float BatteryLifeSeconds = 60f; public float RechargeRate = 10f; [Header("UI & Audio")] public RectTransform Screen; public GameObject PingDotPrefab; public GameObject WallRectPrefab; public AudioSource BeepAudio; public Image BatteryBar; public Text BatteryText; [Header("Button Audio")] public AudioSource ButtonAudioSource; public AudioClip ButtonPressClip; [Header("Detection")] public LayerMask SosigMask; public LayerMask WallMask; [Header("Audio Ping")] public float PingInterval = 1f; private float _pingTimer = 0f; [Header("Radar Filtering")] public float MaxPingHeight = 2f; [Header("Battery Blink")] [Range(0f, 1f)] public float LowBatteryThreshold = 0.25f; public Color LowBatteryColor = Color.red; public float BlinkSpeed = 4f; [Header("Enemy Floor Detection")] public float SameFloorHeightThreshold = 0.75f; [Header("Radar Options")] [Tooltip("Hide pings that are off-screen. Turn off for debugging.")] public bool ClipToScreen = true; [Header("Debug")] public bool DebugLog = false; [Header("Runtime Tweaks")] [Tooltip("Flip vertical mapping if pings appear on the bottom.")] public bool InvertY = false; [Header("Forward Mapping")] [Tooltip("Invert the forward direction used to map world positions to the radar. Enable if the radar appears reversed.")] public bool InvertForward = true; [Header("Wall Detection / Visualization")] [Tooltip("Height (meters) to sample walls at. Use ~1.8 for full-height walls.")] public float WallSamplingHeight = 1f; [Tooltip("Use collider.bounds to estimate lateral width for the wall visual.")] public bool UseWallBoundsForWidth = true; [Tooltip("Minimum UI pixel width for wall rects. (Kept for compatibility; prefer WallMinWidthUnits)")] public float WallMinPixels = 6f; [Tooltip("Wall visual thickness in UI pixels (vertical thickness of the rect on the radar). (Kept for compatibility; prefer WallThicknessUnits)")] public float WallThicknessPixels = 6f; [Tooltip("Maximum lateral wall width to consider (meters) to avoid enormous bounds values.")] public float MaxWallWidthMeters = 3f; [Tooltip("Minimum vertical size (meters) required for a collider to be considered a wall.")] public float MinWallHeightMeters = 0.5f; [Tooltip("Minimum wall width in UI local units (same units as Screen.rect.width). Use this to avoid mixing pixels/units.")] public float WallMinWidthUnits = 0.005f; [Tooltip("Wall thickness in UI local units (vertical height of the rect).")] public float WallThicknessUnits = 0.005f; [Header("Filtering")] [Tooltip("If true, ignore the player's own colliders so the center dot doesn't appear.")] public bool IgnorePlayer = true; private Color _batteryTextNormalColor; private Coroutine _blinkRoutine; private bool _isBlinking; private Dictionary _pings = new Dictionary(); private Dictionary _wallRects = new Dictionary(); private bool _isOn = false; private float _battery; private bool _enemyOnSameFloor = false; private Transform _direction_reference; public bool IsOn => _isOn; protected void Start() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_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) _battery = BatteryLifeSeconds; if ((Object)(object)Screen != (Object)null) { ((Component)Screen).gameObject.SetActive(false); } if ((Object)(object)BatteryText != (Object)null) { _batteryTextNormalColor = ((Graphic)BatteryText).color; } GameObject val = new GameObject("DirectionReference"); _direction_reference = val.transform; _direction_reference.parent = ((Component)this).transform; _direction_reference.localPosition = Vector3.zero; _direction_reference.localRotation = Quaternion.identity; ValidateAssignments(); UpdateUI(); } private void Update() { if (_isOn) { _battery -= Time.deltaTime; if (_battery <= 0f) { _battery = 0f; TogglePowerOff(); return; } UpdateScreen(); _pingTimer += Time.deltaTime; if (_pingTimer >= PingInterval && _enemyOnSameFloor) { if ((Object)(object)BeepAudio != (Object)null && !BeepAudio.mute && (Object)(object)BeepAudio.clip != (Object)null) { BeepAudio.PlayOneShot(BeepAudio.clip); } _pingTimer = 0f; } } else { if (_battery < BatteryLifeSeconds) { _battery += Time.deltaTime * RechargeRate; } if ((Object)(object)BeepAudio != (Object)null && BeepAudio.isPlaying) { BeepAudio.Stop(); } _pingTimer = 0f; } UpdateUI(); } private void UpdateScreen() { //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: 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_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_051d: 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_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_053d: 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_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_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_0508: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_059f: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: 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_015e: 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_0120: 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_06c7: Unknown result type (might be due to invalid IL or missing references) //IL_06de: Unknown result type (might be due to invalid IL or missing references) //IL_06f5: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_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_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0713: Unknown result type (might be due to invalid IL or missing references) //IL_072c: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) //IL_0752: Unknown result type (might be due to invalid IL or missing references) //IL_076e: Unknown result type (might be due to invalid IL or missing references) //IL_078a: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Screen == (Object)null || (Object)(object)PingDotPrefab == (Object)null || ScanningRanges == null || ScanningRanges.Length == 0) { return; } float num = ScanningRanges[Mathf.Clamp(CurrentRangeIndex, 0, ScanningRanges.Length - 1)]; Rect rect = Screen.rect; float width = ((Rect)(ref rect)).width; Rect rect2 = Screen.rect; float height = ((Rect)(ref rect2)).height; float num2 = width * 0.5f; float num3 = height * 0.5f; if (DebugLog) { Debug.Log((object)("Screen size (local): " + width + "x" + height)); } float num4 = ((Component)this).transform.position.y; if ((Object)(object)GM.CurrentPlayerBody != (Object)null && (Object)(object)GM.CurrentPlayerBody.Torso != (Object)null) { num4 = GM.CurrentPlayerBody.Torso.position.y + 0.3f; } float num5 = num4 - MaxPingHeight * 0.5f; float num6 = num4 + MaxPingHeight * 0.5f; Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, num, LayerMask.op_Implicit(SosigMask), (QueryTriggerInteraction)2); if (DebugLog) { Debug.Log((object)("Sosigs found by OverlapSphere: " + array.Length + " (range " + num + ")")); } HashSet hashSet = new HashSet(); _enemyOnSameFloor = false; Vector3 val = ((!InvertForward) ? ((Component)this).transform.forward : (-((Component)this).transform.forward)); Vector3 val2 = Vector3.ProjectOnPlane(val, Vector3.up); if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { val2 = Vector3.forward; } _direction_reference.rotation = Quaternion.LookRotation(val2, Vector3.up); Vector2 val6 = default(Vector2); Vector2 val7 = default(Vector2); foreach (Collider val3 in array) { if ((Object)(object)val3 == (Object)null || (IgnorePlayer && (Object)(object)GM.CurrentPlayerBody != (Object)null && ((Component)val3).transform.IsChildOf(((Component)GM.CurrentPlayerBody).transform))) { continue; } Transform transform = ((Component)val3).transform; if ((Object)(object)transform == (Object)null) { continue; } float y = transform.position.y; if (y < num5 || y > num6) { continue; } hashSet.Add(transform); if (!_pings.TryGetValue(transform, out var value) || (Object)(object)value == (Object)null) { value = Object.Instantiate(PingDotPrefab); ConfigureRadarRect(value, PingDotPrefab); ((Object)value).name = "Ping_" + ((Object)transform).name; _pings[transform] = value; } Vector3 val4 = _direction_reference.InverseTransformPoint(transform.position); if (DebugLog) { Debug.LogFormat("Projected for {0}: x={1:F3}, z={2:F3}, range={3:F3}", new object[4] { ((Object)transform).name, val4.x, val4.z, num }); } float num7 = val4.x / num * num2; float num8 = val4.z / num * num3; if (InvertY) { num8 = 0f - num8; } if (DebugLog) { Debug.LogFormat("Mapped px/py for {0}: pxLocal={1:F3}, pyLocal={2:F3} (halfW={3:F3}, halfH={4:F3})", new object[5] { ((Object)transform).name, num7, num8, num2, num3 }); } RectTransform component = value.GetComponent(); Vector2 val5; if ((Object)(object)component != (Object)null) { component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); try { LayoutRebuilder.ForceRebuildLayoutImmediate(component); } catch { } RectTransform component2 = PingDotPrefab.GetComponent(); Rect rect3 = component.rect; Vector2 size = ((Rect)(ref rect3)).size; if (((Vector2)(ref size)).sqrMagnitude > 0.0001f) { Rect rect4 = component.rect; val5 = ((Rect)(ref rect4)).size; } else { if ((Object)(object)component2 != (Object)null) { Rect rect5 = component2.rect; Vector2 size2 = ((Rect)(ref rect5)).size; if (((Vector2)(ref size2)).sqrMagnitude > 0.0001f) { Rect rect6 = component2.rect; val5 = ((Rect)(ref rect6)).size; goto IL_0524; } } val5 = Vector2.zero; } goto IL_0524; } float num9 = num7 * Mathf.Abs(((Transform)Screen).lossyScale.x); float num10 = num8 * Mathf.Abs(((Transform)Screen).lossyScale.y); value.transform.localPosition = new Vector3(num9, num10, 0f); value.transform.localRotation = PingDotPrefab.transform.localRotation; value.transform.localScale = PingDotPrefab.transform.localScale; goto IL_0795; IL_0795: bool flag = Mathf.Abs(num7) <= num2 && Mathf.Abs(num8) <= num3; value.SetActive(!ClipToScreen || flag); if (Mathf.Abs(y - num4) <= SameFloorHeightThreshold) { _enemyOnSameFloor = true; } continue; IL_0524: ((Vector2)(ref val6))..ctor(Mathf.Abs(((Transform)component).localScale.x), Mathf.Abs(((Transform)component).localScale.y)); if ((Mathf.Approximately(val6.x, 0f) || Mathf.Approximately(val6.y, 0f)) && (Object)(object)PingDotPrefab != (Object)null) { ((Vector2)(ref val6))..ctor(Mathf.Abs(PingDotPrefab.transform.localScale.x), Mathf.Abs(PingDotPrefab.transform.localScale.y)); } ((Vector2)(ref val7))..ctor(val5.x * 0.5f * val6.x, val5.y * 0.5f * val6.y); float num11 = Mathf.Max(0f, num2 - val7.x); float num12 = Mathf.Max(0f, num3 - val7.y); float num13 = Mathf.Clamp(num7, 0f - num11, num11); float num14 = Mathf.Clamp(num8, 0f - num12, num12); if ((num13 != num7 || num14 != num8) && DebugLog) { Debug.LogFormat("Clamped ping for {0} from ({1:F3},{2:F3}) to ({3:F3},{4:F3}) limits ({5:F3},{6:F3})", new object[7] { ((Object)transform).name, num7, num8, num13, num14, num11, num12 }); } component.anchoredPosition = new Vector2(num13, num14); ((Transform)component).localRotation = PingDotPrefab.transform.localRotation; ((Transform)component).localScale = PingDotPrefab.transform.localScale; goto IL_0795; } List list = new List(_pings.Keys); for (int j = 0; j < list.Count; j++) { Transform val8 = list[j]; if ((Object)(object)val8 == (Object)null || !hashSet.Contains(val8)) { if ((Object)(object)_pings[val8] != (Object)null) { Object.Destroy((Object)(object)_pings[val8]); } _pings.Remove(val8); } } UpdateWalls(num, num5, num6, num2, num3); } private void UpdateWalls(float range, float yMin, float yMaxWorld, float halfW, float halfH) { //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_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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_0156: 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_01db: 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_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0394: 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_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_0491: 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_04cf: 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_069f: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Unknown result type (might be due to invalid IL or missing references) //IL_06bd: Unknown result type (might be due to invalid IL or missing references) //IL_06de: Unknown result type (might be due to invalid IL or missing references) //IL_06fa: Unknown result type (might be due to invalid IL or missing references) //IL_0716: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: 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_0613: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)WallRectPrefab == (Object)null || (Object)(object)Screen == (Object)null) { return; } float num = ((Component)this).transform.position.y; if ((Object)(object)GM.CurrentPlayerBody != (Object)null && (Object)(object)GM.CurrentPlayerBody.Torso != (Object)null) { num = GM.CurrentPlayerBody.Torso.position.y + (WallSamplingHeight - 0.3f); } Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, range, LayerMask.op_Implicit(WallMask), (QueryTriggerInteraction)2); HashSet hashSet = new HashSet(); Vector3 val2 = default(Vector3); foreach (Collider val in array) { if ((Object)(object)val == (Object)null || (IgnorePlayer && (Object)(object)GM.CurrentPlayerBody != (Object)null && ((Component)val).transform.IsChildOf(((Component)GM.CurrentPlayerBody).transform))) { continue; } Bounds bounds = val.bounds; float y = ((Bounds)(ref bounds)).size.y; if (y < MinWallHeightMeters || (((Bounds)(ref bounds)).extents.x > MaxWallWidthMeters && ((Bounds)(ref bounds)).extents.z > MaxWallWidthMeters)) { continue; } ((Vector3)(ref val2))..ctor(((Component)this).transform.position.x, num, ((Component)this).transform.position.z); Vector3 val3 = val.ClosestPoint(val2); if (val3.y < yMin || val3.y > yMaxWorld) { continue; } Vector3 val4 = val3 - ((Component)this).transform.position; val4.y = 0f; if (((Vector3)(ref val4)).magnitude > range) { continue; } hashSet.Add(val); if (!_wallRects.TryGetValue(val, out var value) || (Object)(object)value == (Object)null) { value = Object.Instantiate(WallRectPrefab); ConfigureRadarRect(value, WallRectPrefab); ((Object)value).name = "Wall_" + ((Object)val).name; _wallRects[val] = value; } Vector3 val5 = _direction_reference.InverseTransformPoint(val3); float num2 = val5.x / Mathf.Max(range, 0.0001f) * halfW; float num3 = val5.z / Mathf.Max(range, 0.0001f) * halfH; if (InvertY) { num3 = 0f - num3; } float num4 = 0f; if (UseWallBoundsForWidth) { Vector3 center = ((Bounds)(ref bounds)).center; Vector3 extents = ((Bounds)(ref bounds)).extents; Vector3[] array2 = (Vector3[])(object)new Vector3[8] { new Vector3(center.x + extents.x, center.y + extents.y, center.z + extents.z), new Vector3(center.x + extents.x, center.y + extents.y, center.z - extents.z), new Vector3(center.x + extents.x, center.y - extents.y, center.z + extents.z), new Vector3(center.x + extents.x, center.y - extents.y, center.z - extents.z), new Vector3(center.x - extents.x, center.y + extents.y, center.z + extents.z), new Vector3(center.x - extents.x, center.y + extents.y, center.z - extents.z), new Vector3(center.x - extents.x, center.y - extents.y, center.z + extents.z), new Vector3(center.x - extents.x, center.y - extents.y, center.z - extents.z) }; float num5 = float.MaxValue; float num6 = float.MinValue; for (int j = 0; j < array2.Length; j++) { Vector3 val6 = _direction_reference.InverseTransformPoint(array2[j]); if (val6.x < num5) { num5 = val6.x; } if (val6.x > num6) { num6 = val6.x; } } num4 = Mathf.Abs(num6 - num5); } else { num4 = 0.5f; } num4 = Mathf.Clamp(num4, 0.01f, MaxWallWidthMeters); float num7 = num4 / Mathf.Max(range, 0.0001f) * halfW; float num8 = Mathf.Max(WallMinWidthUnits, Mathf.Abs(num7)); float num9 = halfW * 2f; num8 = Mathf.Min(num8, Mathf.Max(WallMinWidthUnits, num9 - 0.001f)); RectTransform component = value.GetComponent(); if ((Object)(object)component != (Object)null) { component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); float num10 = Mathf.Clamp(num2, 0f - halfW, halfW); float num11 = Mathf.Clamp(num3, 0f - halfH, halfH); component.anchoredPosition = new Vector2(num10, num11); component.sizeDelta = new Vector2(num8, WallThicknessUnits); ((Transform)component).localRotation = WallRectPrefab.transform.localRotation; ((Transform)component).localScale = WallRectPrefab.transform.localScale; } else { float num12 = num2 * Mathf.Abs(((Transform)Screen).lossyScale.x); float num13 = num3 * Mathf.Abs(((Transform)Screen).lossyScale.y); value.transform.localPosition = new Vector3(num12, num13, 0f); value.transform.localRotation = WallRectPrefab.transform.localRotation; value.transform.localScale = WallRectPrefab.transform.localScale; } bool flag = Mathf.Abs(num2) <= halfW && Mathf.Abs(num3) <= halfH; value.SetActive(!ClipToScreen || flag); } List list = new List(_wallRects.Keys); for (int k = 0; k < list.Count; k++) { Collider val7 = list[k]; if ((Object)(object)val7 == (Object)null || !hashSet.Contains(val7)) { if ((Object)(object)_wallRects[val7] != (Object)null) { Object.Destroy((Object)(object)_wallRects[val7]); } _wallRects.Remove(val7); } } } private void ConfigureRadarRect(GameObject go, GameObject referencePrefab) { //IL_0075: 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_009f: 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_00d7: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Screen == (Object)null) && !((Object)(object)go == (Object)null)) { go.transform.SetParent((Transform)(object)Screen, false); LayoutElement val = go.GetComponent(); if ((Object)(object)val == (Object)null) { val = go.AddComponent(); } val.ignoreLayout = true; RectTransform component = go.GetComponent(); if ((Object)(object)component != (Object)null) { component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = Vector2.zero; } go.transform.localRotation = ((!((Object)(object)referencePrefab != (Object)null)) ? Quaternion.identity : referencePrefab.transform.localRotation); go.transform.localScale = ((!((Object)(object)referencePrefab != (Object)null)) ? Vector3.one : referencePrefab.transform.localScale); } } private void TogglePowerOff() { _isOn = false; if ((Object)(object)Screen != (Object)null) { ((Component)Screen).gameObject.SetActive(false); } UpdateUI(); } private void ValidateAssignments() { if ((Object)(object)PingDotPrefab == (Object)null) { Debug.LogError((object)"PingDotPrefab is not assigned!"); } if ((Object)(object)WallRectPrefab == (Object)null) { Debug.LogWarning((object)"WallRectPrefab is not assigned!"); } if ((Object)(object)Screen == (Object)null) { Debug.LogError((object)"Screen RectTransform is not assigned!"); } } private void UpdateUI() { float num = ((!(BatteryLifeSeconds <= 0f)) ? (_battery / BatteryLifeSeconds) : 0f); if ((Object)(object)BatteryBar != (Object)null) { BatteryBar.fillAmount = num; } if ((Object)(object)BatteryText != (Object)null) { BatteryText.text = Mathf.RoundToInt(num * 100f) + "%"; } } public void ToggleAudio() { if ((Object)(object)BeepAudio != (Object)null) { BeepAudio.mute = !BeepAudio.mute; } } public void TogglePower() { if (_isOn) { _isOn = false; } else { _isOn = _battery > 0f; } if ((Object)(object)Screen != (Object)null) { ((Component)Screen).gameObject.SetActive(_isOn); } UpdateUI(); } public void IncreaseRange() { if (ScanningRanges != null && ScanningRanges.Length != 0) { CurrentRangeIndex = Mathf.Min(ScanningRanges.Length - 1, CurrentRangeIndex + 1); } } public void DecreaseRange() { if (ScanningRanges != null && ScanningRanges.Length != 0) { CurrentRangeIndex = Mathf.Max(0, CurrentRangeIndex - 1); } } } public class HeartbeatSensorButton : FVRInteractiveObject { public enum ButtonType { Power, Audio, RangePlus, RangeMinus } [Header("Button Settings")] public HeartbeatSensor TargetSensor; public ButtonType Type; public AudioSource ButtonAudioSource; public AudioClip ButtonPressClip; public bool IsToggled { get { if ((Object)(object)TargetSensor == (Object)null) { return false; } return Type == ButtonType.Power && TargetSensor.IsOn; } } protected void Awake() { ((FVRInteractiveObject)this).Awake(); } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); TriggerAction(); } private void TriggerAction() { if (!((Object)(object)TargetSensor == (Object)null)) { switch (Type) { case ButtonType.Power: TargetSensor.TogglePower(); break; case ButtonType.Audio: TargetSensor.ToggleAudio(); break; case ButtonType.RangePlus: TargetSensor.IncreaseRange(); break; case ButtonType.RangeMinus: TargetSensor.DecreaseRange(); break; } if (Object.op_Implicit((Object)(object)ButtonAudioSource) && Object.op_Implicit((Object)(object)ButtonPressClip)) { ButtonAudioSource.PlayOneShot(ButtonPressClip); } } } } public class InfiniteAmmoAttachment : FVRFireArmAttachment { [Header("Infinite Ammo Attachment")] [Tooltip("How often (in seconds) the InfiniteAmmo powerup is refreshed while mounted and held.")] public float RefreshInterval = 0.5f; [Tooltip("Suppresses the built-in hand particle effect that ActivatePower spawns for InfiniteAmmo.")] public bool SuppressHandEffect = true; private float m_refreshTimer = 0f; private MethodInfo m_deactivateBuffMethod; private static readonly object[] k_infiniteAmmoBuffIndex = new object[1] { 2 }; public override void FVRUpdate() { ((FVRPhysicalObject)this).FVRUpdate(); if ((Object)(object)base.curMount == (Object)null || (Object)(object)GM.CurrentPlayerBody == (Object)null) { return; } FVRPhysicalObject rootObject = ((FVRFireArmAttachment)this).GetRootObject(); if ((Object)(object)rootObject == (Object)null || !((FVRInteractiveObject)rootObject).IsHeld) { return; } m_refreshTimer -= Time.deltaTime; if (!(m_refreshTimer <= 0f)) { return; } m_refreshTimer = RefreshInterval; GM.CurrentPlayerBody.ActivatePower((PowerupType)2, (PowerUpIntensity)0, (PowerUpDuration)3, false, false, -1f); if (SuppressHandEffect) { if ((object)m_deactivateBuffMethod == null) { m_deactivateBuffMethod = typeof(FVRPlayerBody).GetMethod("DeActivateBuff", BindingFlags.Instance | BindingFlags.NonPublic); } if ((object)m_deactivateBuffMethod != null) { m_deactivateBuffMethod.Invoke(GM.CurrentPlayerBody, k_infiniteAmmoBuffIndex); } } } } } public class Sheath_Trigger : MonoBehaviour { public Sheath_Weapon Sheath; private void OnTriggerStay(Collider other) { if ((Object)(object)Sheath != (Object)null) { Sheath.SheathTriggerStay(other); } } private void OnTriggerExit(Collider other) { if ((Object)(object)Sheath != (Object)null) { Sheath.SheathTriggerExit(other); } } } public class Sheath_Weapon : FVRPhysicalObject { [Header("Sword Matching")] [Tooltip("If empty, any FVRMeleeWeapon can be sheathed. Otherwise, only swords whose ItemID matches an entry in this list are accepted.")] public List AcceptedSwordItemIDs = new List(); [Header("Sheath Geometry")] [Tooltip("Transform at the mouth (opening) of the sheath.")] public Transform SheathMouth; [Tooltip("Transform at the inner end of the sheath (where the tip rests).")] public Transform SheathEnd; [Tooltip("Distance from mouth along sheath axis that counts as fully sheathed (meters).")] public float FullySheathedDistance = 0.7f; [Tooltip("Distance from mouth along sheath axis that triggers the end-stop sound (meters).")] public float EndStopDistance = 0.65f; [Header("Sheath Audio")] public AudioClip HitEndClip; public AudioClip FullSheathClip; public AudioClip DrawClip; public AudioSource SheathAudioSource; [Header("Behavior")] [Tooltip("Minimum inward speed (m/s) required to play the full sheath sound.")] public float DramaticSheathSpeed = 1.5f; private FVRMeleeWeapon _currentSword; private bool _isSwordFullySheathed; private float _lastDepth; private float _depthVel; private float _sheathLength; private bool _hasPlayedEndStop; private Collider[] _sheathedColliders; private bool[] _sheathedCollidersOrigIsTrigger; protected void Awake() { ((FVRPhysicalObject)this).Awake(); if ((Object)(object)SheathAudioSource == (Object)null) { if (base.CollisionSound != null && (Object)(object)base.CollisionSound.m_audioCollision != (Object)null) { SheathAudioSource = base.CollisionSound.m_audioCollision; } else { SheathAudioSource = ((Component)this).GetComponent(); } } CacheSheathLength(); } private void CacheSheathLength() { //IL_002a: 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) _sheathLength = ((!((Object)(object)SheathMouth != (Object)null) || !((Object)(object)SheathEnd != (Object)null)) ? 0f : Vector3.Distance(SheathMouth.position, SheathEnd.position)); } private void Update() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_currentSword == (Object)null || (Object)(object)SheathMouth == (Object)null || (Object)(object)SheathEnd == (Object)null || _sheathLength <= 0.0001f) { return; } if (_isSwordFullySheathed) { if (((FVRInteractiveObject)_currentSword).IsHeld && ((FVRInteractiveObject)this).IsHeld) { DrawSword(); } return; } Vector3 swordTipWorldPos = GetSwordTipWorldPos(_currentSword); float depthAlongSheath = GetDepthAlongSheath(swordTipWorldPos); float lastDepth = _lastDepth; _lastDepth = depthAlongSheath; _depthVel = (depthAlongSheath - lastDepth) / Mathf.Max(Time.deltaTime, 0.0001f); float num = Mathf.Clamp(EndStopDistance, 0f, _sheathLength); float num2 = Mathf.Clamp(FullySheathedDistance, 0f, _sheathLength); if (!_hasPlayedEndStop && lastDepth < num && depthAlongSheath >= num) { PlaySheathSound(HitEndClip, 1f); _hasPlayedEndStop = true; } if (depthAlongSheath >= num2) { SheatheCompletely(); } } private void SheatheCompletely() { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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) if (!((Object)(object)_currentSword == (Object)null)) { if (Mathf.Abs(_depthVel) >= DramaticSheathSpeed) { PlaySheathSound(FullSheathClip, 1f); } _isSwordFullySheathed = true; ((FVRInteractiveObject)_currentSword).ForceBreakInteraction(); if ((Object)(object)((FVRPhysicalObject)_currentSword).RootRigidbody != (Object)null) { ((FVRPhysicalObject)_currentSword).RootRigidbody.isKinematic = true; ((FVRPhysicalObject)_currentSword).RootRigidbody.velocity = Vector3.zero; ((FVRPhysicalObject)_currentSword).RootRigidbody.angularVelocity = Vector3.zero; } CacheAndSetSwordCollidersToTrigger(_currentSword); ((Component)_currentSword).transform.SetParent(SheathEnd, true); ((Component)_currentSword).transform.localPosition = Vector3.zero; ((Component)_currentSword).transform.localRotation = Quaternion.identity; SetSwordRenderersEnabled(_currentSword, enabled: false); } } private void DrawSword() { if (!((Object)(object)_currentSword == (Object)null)) { PlaySheathSound(DrawClip, 1f); ((Component)_currentSword).transform.SetParent((Transform)null, true); RestoreSwordColliders(); if ((Object)(object)((FVRPhysicalObject)_currentSword).RootRigidbody != (Object)null) { ((FVRPhysicalObject)_currentSword).RootRigidbody.isKinematic = false; } SetSwordRenderersEnabled(_currentSword, enabled: true); _isSwordFullySheathed = false; _currentSword = null; } } private void SetSwordRenderersEnabled(FVRMeleeWeapon sword, bool enabled) { if (!((Object)(object)sword == (Object)null)) { Renderer[] componentsInChildren = ((Component)sword).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = enabled; } } } private void CacheAndSetSwordCollidersToTrigger(FVRMeleeWeapon sword) { if ((Object)(object)sword == (Object)null) { return; } _sheathedColliders = ((Component)sword).GetComponentsInChildren(true); if (_sheathedColliders == null || _sheathedColliders.Length == 0) { return; } _sheathedCollidersOrigIsTrigger = new bool[_sheathedColliders.Length]; for (int i = 0; i < _sheathedColliders.Length; i++) { if (!((Object)(object)_sheathedColliders[i] == (Object)null)) { _sheathedCollidersOrigIsTrigger[i] = _sheathedColliders[i].isTrigger; _sheathedColliders[i].isTrigger = true; } } } private void RestoreSwordColliders() { if (_sheathedColliders == null || _sheathedCollidersOrigIsTrigger == null) { return; } int num = Mathf.Min(_sheathedColliders.Length, _sheathedCollidersOrigIsTrigger.Length); for (int i = 0; i < num; i++) { if (!((Object)(object)_sheathedColliders[i] == (Object)null)) { _sheathedColliders[i].isTrigger = _sheathedCollidersOrigIsTrigger[i]; } } _sheathedColliders = null; _sheathedCollidersOrigIsTrigger = null; } private Vector3 GetSwordTipWorldPos(FVRMeleeWeapon sword) { //IL_0033: 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_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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((FVRPhysicalObject)sword).MP.EndPoint != (Object)null) { return ((FVRPhysicalObject)sword).MP.EndPoint.position; } return ((Component)sword).transform.position + ((Component)sword).transform.forward * 0.5f; } private float GetDepthAlongSheath(Vector3 worldPos) { //IL_0044: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_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_0073: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)SheathMouth == (Object)null || (Object)(object)SheathEnd == (Object)null || _sheathLength <= 0.0001f) { return 0f; } Vector3 val = SheathEnd.position - SheathMouth.position; Vector3 normalized = ((Vector3)(ref val)).normalized; float num = Vector3.Dot(worldPos - SheathMouth.position, normalized); return Mathf.Clamp(num, 0f, _sheathLength); } public void SheathTriggerStay(Collider other) { //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) if (_isSwordFullySheathed) { return; } FVRMeleeWeapon val = null; if ((Object)(object)other != (Object)null) { val = ((Component)other).GetComponentInParent(); if ((Object)(object)val == (Object)null && (Object)(object)other.attachedRigidbody != (Object)null) { val = ((Component)other.attachedRigidbody).GetComponentInParent(); } } if ((Object)(object)val != (Object)null && IsSwordAcceptable(val)) { if ((!((Object)(object)_currentSword != (Object)null) || !((Object)(object)_currentSword != (Object)(object)val)) && (Object)(object)_currentSword == (Object)null) { _currentSword = val; _isSwordFullySheathed = false; _hasPlayedEndStop = false; _lastDepth = GetDepthAlongSheath(GetSwordTipWorldPos(val)); } } else { if ((Object)(object)SheathMouth == (Object)null) { return; } float num = Mathf.Max(0.12f, _sheathLength * 0.25f); Collider[] array = Physics.OverlapSphere(SheathMouth.position, num, -1, (QueryTriggerInteraction)2); FVRMeleeWeapon val2 = null; float num2 = float.MaxValue; Vector3 position = SheathMouth.position; foreach (Collider val3 in array) { if ((Object)(object)val3 == (Object)null) { continue; } FVRMeleeWeapon componentInParent = ((Component)val3).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && IsSwordAcceptable(componentInParent)) { Vector3 swordTipWorldPos = GetSwordTipWorldPos(componentInParent); float num3 = Vector3.Distance(swordTipWorldPos, position); if (num3 < num2) { num2 = num3; val2 = componentInParent; } } } if ((Object)(object)val2 != (Object)null && num2 <= 0.25f && (!((Object)(object)_currentSword != (Object)null) || !((Object)(object)_currentSword != (Object)(object)val2)) && (Object)(object)_currentSword == (Object)null) { _currentSword = val2; _isSwordFullySheathed = false; _hasPlayedEndStop = false; _lastDepth = GetDepthAlongSheath(GetSwordTipWorldPos(val2)); } } } public void SheathTriggerExit(Collider other) { if (!_isSwordFullySheathed) { FVRMeleeWeapon componentInParent = ((Component)other).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent == (Object)(object)_currentSword) { _currentSword = null; _hasPlayedEndStop = false; } } } private bool IsSwordAcceptable(FVRMeleeWeapon sword) { if ((Object)(object)sword == (Object)null) { return false; } if (AcceptedSwordItemIDs == null || AcceptedSwordItemIDs.Count == 0) { return true; } if ((Object)(object)((FVRPhysicalObject)sword).IDSpawnedFrom == (Object)null) { return false; } string itemID = ((FVRPhysicalObject)sword).IDSpawnedFrom.ItemID; for (int i = 0; i < AcceptedSwordItemIDs.Count; i++) { if (AcceptedSwordItemIDs[i] == itemID) { return true; } } return false; } private void PlaySheathSound(AudioClip clip, float vol) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)clip == (Object)null)) { if ((Object)(object)SheathAudioSource != (Object)null) { SheathAudioSource.PlayOneShot(clip, vol); } else { AudioSource.PlayClipAtPoint(clip, ((Component)this).transform.position, vol); } } } public override void BeginInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).BeginInteraction(hand); if (_isSwordFullySheathed && (Object)(object)_currentSword != (Object)null) { SetSwordRenderersEnabled(_currentSword, enabled: true); } } public override void EndInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).EndInteraction(hand); if (_isSwordFullySheathed && (Object)(object)_currentSword != (Object)null && !((FVRInteractiveObject)this).IsHeld) { SetSwordRenderersEnabled(_currentSword, enabled: false); } } } public class GrillButton : FVRInteractiveObject { public KebabGrill grill; public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); if ((Object)(object)grill != (Object)null) { grill.ToggleGrill(); } } } [RequireComponent(typeof(Collider))] public class KebabGrill : FVRInteractiveObject { [Header("Spawner params")] public string itemID; public bool isInfinite = true; [Tooltip("How many objects can be taken from this spawner before it runs out")] public int objectCapacity; private int objectsRemaining; private AnvilCallback itemLoader; [Header("Audio")] public AudioSource audioSource; public AudioClip emptyClip; public AudioClip grillOnClip; public AudioClip grillOffClip; public AudioSource grillLoopSource; public AudioClip grillLoopClip; [Header("Scaling")] public Transform visualToScale; public Vector3 fullScale = Vector3.one; public Vector3 emptyScale = new Vector3(0.2f, 0.2f, 0.2f); [Header("Regeneration")] public bool enableRegeneration = false; public float regenTime = 10f; [Header("Grill Visuals")] public Renderer grillRenderer; public Material grillOnMaterial; public Material grillOffMaterial; [Header("Rotating Object")] public GameObject spinnyThing; public float spinRate = 180f; public int spinAxis = 1; [Header("Grill Toggle Object")] public GameObject grillToggleObject; [Header("Button Animation")] public Transform buttonTransform; public bool animateButtonTranslation = true; public Vector3 buttonOnPosition; public Vector3 buttonOffPosition; public Vector3 buttonOnRotation; public Vector3 buttonOffRotation; public float buttonAnimSpeed = 8f; private Coroutine regenCoroutine; private bool grillOn = false; private float buttonAnimLerp = 0f; private float buttonAnimTarget = 0f; public override void Awake() { //IL_0046: 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_00d9: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).Awake(); itemLoader = ((AnvilAsset)IM.OD[itemID]).GetGameObjectAsync(); objectsRemaining = objectCapacity; if ((Object)(object)visualToScale != (Object)null) { visualToScale.localScale = fullScale; } SetGrillMaterial(on: false); if ((Object)(object)grillToggleObject != (Object)null) { grillToggleObject.SetActive(false); } if ((Object)(object)grillLoopSource != (Object)null) { grillLoopSource.loop = true; grillLoopSource.clip = grillLoopClip; grillLoopSource.Stop(); } if ((Object)(object)buttonTransform != (Object)null) { buttonTransform.localPosition = buttonOffPosition; buttonTransform.localEulerAngles = buttonOffRotation; } } public override void BeginInteraction(FVRViveHand hand) { //IL_0050: 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) if (!isInfinite && objectsRemaining < 1) { return; } ((FVRInteractiveObject)this).BeginInteraction(hand); if (!((AnvilCallbackBase)itemLoader).IsCompleted) { ((AnvilCallbackBase)itemLoader).CompleteNow(); } FVRPhysicalObject component = Object.Instantiate(itemLoader.Result, ((Component)hand).transform.position, ((Component)hand).transform.rotation).GetComponent(); if ((Object)(object)component != (Object)null) { hand.ForceSetInteractable((FVRInteractiveObject)(object)component); ((FVRInteractiveObject)component).BeginInteraction(hand); } objectsRemaining--; UpdateVisualScale(); if (objectsRemaining < 1) { PlayEmptySound(); if (enableRegeneration && regenCoroutine == null) { regenCoroutine = ((MonoBehaviour)this).StartCoroutine(Regenerate()); } } } private void PlayEmptySound() { if ((Object)(object)audioSource != (Object)null && (Object)(object)emptyClip != (Object)null) { audioSource.PlayOneShot(emptyClip); } } private void UpdateVisualScale() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)visualToScale == (Object)null)) { float num = ((objectCapacity <= 0) ? 0f : Mathf.Clamp01((float)objectsRemaining / (float)objectCapacity)); visualToScale.localScale = Vector3.Lerp(emptyScale, fullScale, num); } } private IEnumerator Regenerate() { while (objectsRemaining < objectCapacity) { yield return (object)new WaitForSeconds(regenTime / (float)objectCapacity); objectsRemaining++; UpdateVisualScale(); } regenCoroutine = null; } private void Update() { //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_0048: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if (grillOn && (Object)(object)spinnyThing != (Object)null) { Vector3 zero = Vector3.zero; ((Vector3)(ref zero))[spinAxis] = spinRate * Time.deltaTime; spinnyThing.transform.Rotate(zero); } if ((Object)(object)buttonTransform != (Object)null) { buttonAnimLerp = Mathf.MoveTowards(buttonAnimLerp, buttonAnimTarget, Time.deltaTime * buttonAnimSpeed); if (animateButtonTranslation) { buttonTransform.localPosition = Vector3.Lerp(buttonOffPosition, buttonOnPosition, buttonAnimLerp); } buttonTransform.localEulerAngles = Vector3.Lerp(buttonOffRotation, buttonOnRotation, buttonAnimLerp); } } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); ToggleGrill(); } public void ToggleGrill() { grillOn = !grillOn; SetGrillMaterial(grillOn); if ((Object)(object)grillToggleObject != (Object)null) { grillToggleObject.SetActive(grillOn); } buttonAnimTarget = ((!grillOn) ? 0f : 1f); if ((Object)(object)audioSource != (Object)null) { audioSource.PlayOneShot((!grillOn) ? grillOffClip : grillOnClip); } if (!((Object)(object)grillLoopSource != (Object)null) || !((Object)(object)grillLoopClip != (Object)null)) { return; } if (grillOn) { if (!grillLoopSource.isPlaying) { grillLoopSource.Play(); } } else { grillLoopSource.Stop(); } } private void SetGrillMaterial(bool on) { if ((Object)(object)grillRenderer != (Object)null) { grillRenderer.material = ((!on) ? grillOffMaterial : grillOnMaterial); } } } namespace VolksScripts { public class Lawgiver : FVRFireArm { private enum DustCoverState { Closed, Opening, Open, Closing } [Header("Lawgiver - Chamber")] public FVRFireArmChamber Chamber; [Header("Lawgiver - Magazine Mount")] [Tooltip("Fixed mount transform for the magazine. MUST be a sibling of MagLifter — never a child of it. H3VR parents the magazine to the gun root at this position; if MagMountOverride moves with MagLifter, the magazine will not follow.")] public Transform MagMountOverride; [Header("Lawgiver - Trigger Delay (Bolt Simulation)")] [Tooltip("Delay in seconds between pulling the trigger and the shot firing, to simulate bolt travel.")] public float TriggerDelay = 0.15f; [Tooltip("Trigger pull threshold to initiate firing.")] public float TriggerFiringThreshold = 0.8f; [Tooltip("Trigger release threshold to allow re-firing.")] public float TriggerResetThreshold = 0.4f; [Header("Lawgiver - Trigger Visuals")] public bool HasTrigger = true; public Transform Trigger; public float Trigger_ForwardValue = 0f; public float Trigger_RearwardValue = 15f; public InterpStyle TriggerInterpStyle = (InterpStyle)1; public Axis TriggerAxis = (Axis)0; [Header("Lawgiver - Dust Cover")] [Tooltip("The transform of the dust cover part that moves/rotates.")] public Transform DustCover; [Tooltip("Local rotation or position value at Point A (closed/locked). Must match the transform's actual resting value on the chosen axis.")] public float DustCover_PointA = 0f; [Tooltip("Local rotation or position value at Point B (open).")] public float DustCover_PointB = 90f; [Tooltip("Speed at which the dust cover moves (degrees or units per second).")] public float DustCoverSpeed = 180f; [Tooltip("Rotation or Translate.")] public InterpStyle DustCoverInterpStyle = (InterpStyle)1; [Tooltip("Axis the dust cover moves on.")] public Axis DustCoverAxis = (Axis)0; [Header("Lawgiver - Dust Cover Audio")] [Tooltip("Sound played when dust cover reaches Point B (open).")] public AudioEvent DustCoverOpenSound; [Tooltip("Sound played when dust cover reaches Point A (closed).")] public AudioEvent DustCoverCloseSound; [Header("Lawgiver - Dust Cover Object Toggles")] [Tooltip("Enabled when dust cover is fully open (Point B). Disabled when fully closed (Point A). Add your UniversalAdvancedMagazineGrabTrigger GameObject here.")] public GameObject[] DustCoverOpenObjects; [Header("Lawgiver - Magazine Lifter")] [Tooltip("Purely visual mesh transform. Must NOT contain MagMountOverride or any functional H3VR transform.")] public Transform MagLifter; [Tooltip("Lifter value when dust cover is at Point A (sunken).")] public float MagLifter_PointA = 0f; [Tooltip("Lifter value when dust cover is at Point B (raised).")] public float MagLifter_PointB = 10f; [Tooltip("Rotation or Translate.")] public InterpStyle MagLifterInterpStyle = (InterpStyle)0; [Tooltip("Axis the lifter moves on.")] public Axis MagLifterAxis = (Axis)1; private DustCoverState m_dustCoverState = DustCoverState.Closed; private float m_curDustCoverLerp = 0f; private float m_tarDustCoverLerp = 0f; private float m_lastDustCoverLerp = -1f; private bool m_hasTriggerReset = true; private float m_triggerFloat = 0f; private bool m_isFiringDelayed = false; private float m_firingDelayRemaining = 0f; private bool m_hasPlayedOpenSound = false; private bool m_hasPlayedCloseSound = false; public override void Awake() { ((FVRFireArm)this).Awake(); base.UsesMagazines = true; if ((Object)(object)Chamber != (Object)null) { base.FChambers.Add(Chamber); } SetDustCoverObjects(active: false); } public override Transform GetMagMountingTransform() { if ((Object)(object)MagMountOverride != (Object)null) { return MagMountOverride; } return ((FVRFireArm)this).GetMagMountingTransform(); } public override void FVRUpdate() { ((FVRFireArm)this).FVRUpdate(); } public override void UpdateInteraction(FVRViveHand hand) { //IL_0137: 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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); if (((FVRPhysicalObject)this).IsAltHeld) { return; } m_triggerFloat = ((!((FVRInteractiveObject)this).m_hasTriggeredUpSinceBegin) ? 0f : hand.Input.TriggerFloat); if (!m_hasTriggerReset && m_triggerFloat <= TriggerResetThreshold) { m_hasTriggerReset = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)16, 1f); } if (m_hasTriggerReset && m_triggerFloat >= TriggerFiringThreshold && !m_isFiringDelayed && m_dustCoverState == DustCoverState.Closed && (Object)(object)Chamber != (Object)null && Chamber.IsFull && !Chamber.IsSpent) { m_hasTriggerReset = false; m_isFiringDelayed = true; m_firingDelayRemaining = TriggerDelay; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); } if (HasTrigger && (Object)(object)Trigger != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(Trigger, Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat), TriggerInterpStyle, TriggerAxis); } if (hand.IsInStreamlinedMode) { if (hand.Input.AXButtonDown) { OnDustCoverButtonPressed(); } } else if (hand.Input.TouchpadDown) { Vector2 touchpadAxes = hand.Input.TouchpadAxes; if (((Vector2)(ref touchpadAxes)).magnitude > 0.2f && Vector2.Angle(touchpadAxes, Vector2.down) <= 45f) { OnDustCoverButtonPressed(); } } UpdateDustCoverAndLifter(); UpdateFiringDelay(); } public override void EndInteraction(FVRViveHand hand) { m_triggerFloat = 0f; m_isFiringDelayed = false; m_hasTriggerReset = true; ((FVRFireArm)this).EndInteraction(hand); if (m_dustCoverState != DustCoverState.Open) { return; } for (int i = 0; i < DustCoverOpenObjects.Length; i++) { if ((Object)(object)DustCoverOpenObjects[i] != (Object)null && DustCoverOpenObjects[i].activeSelf) { SetLayerRecursive(DustCoverOpenObjects[i], LayerMask.NameToLayer("Interactable")); } } } private void OnDustCoverButtonPressed() { switch (m_dustCoverState) { case DustCoverState.Closed: m_dustCoverState = DustCoverState.Opening; m_tarDustCoverLerp = 1f; m_hasPlayedOpenSound = false; break; case DustCoverState.Open: m_dustCoverState = DustCoverState.Closing; m_tarDustCoverLerp = 0f; m_hasPlayedCloseSound = false; break; } } private void UpdateDustCoverAndLifter() { //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Abs(DustCover_PointB - DustCover_PointA); if (num < 0.001f) { return; } float num2 = DustCoverSpeed * Time.deltaTime / num; m_curDustCoverLerp = Mathf.MoveTowards(m_curDustCoverLerp, m_tarDustCoverLerp, num2); if (m_dustCoverState == DustCoverState.Opening && m_curDustCoverLerp >= 1f) { m_curDustCoverLerp = 1f; m_dustCoverState = DustCoverState.Open; if (!m_hasPlayedOpenSound) { m_hasPlayedOpenSound = true; ((FVRFireArm)this).PlayAudioEventHandling(DustCoverOpenSound); } SetDustCoverObjects(active: true); } else if (m_dustCoverState == DustCoverState.Closing && m_curDustCoverLerp <= 0f) { m_curDustCoverLerp = 0f; m_dustCoverState = DustCoverState.Closed; if (!m_hasPlayedCloseSound) { m_hasPlayedCloseSound = true; ((FVRFireArm)this).PlayAudioEventHandling(DustCoverCloseSound); } SetDustCoverObjects(active: false); TryChamberRound(); } if (Mathf.Abs(m_curDustCoverLerp - m_lastDustCoverLerp) > 0.001f) { float num3 = Mathf.Lerp(DustCover_PointA, DustCover_PointB, m_curDustCoverLerp); float num4 = Mathf.Lerp(MagLifter_PointA, MagLifter_PointB, m_curDustCoverLerp); if ((Object)(object)DustCover != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(DustCover, num3, DustCoverInterpStyle, DustCoverAxis); } if ((Object)(object)MagLifter != (Object)null) { ((FVRPhysicalObject)this).SetAnimatedComponent(MagLifter, num4, MagLifterInterpStyle, MagLifterAxis); } } m_lastDustCoverLerp = m_curDustCoverLerp; } private void SetDustCoverObjects(bool active) { if (DustCoverOpenObjects == null) { return; } for (int i = 0; i < DustCoverOpenObjects.Length; i++) { GameObject val = DustCoverOpenObjects[i]; if (!((Object)(object)val == (Object)null)) { val.SetActive(active); if (active) { SetLayerRecursive(val, LayerMask.NameToLayer("Interactable")); } } } } private static void SetLayerRecursive(GameObject go, int layer) { go.layer = layer; for (int i = 0; i < go.transform.childCount; i++) { SetLayerRecursive(((Component)go.transform.GetChild(i)).gameObject, layer); } } private void TryChamberRound() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Chamber != (Object)null) || Chamber.IsFull || !((Object)(object)base.Magazine != (Object)null) || !base.Magazine.HasARound()) { return; } GameObject val = base.Magazine.RemoveRound(false); if ((Object)(object)val != (Object)null) { FVRFireArmRound component = val.GetComponent(); if ((Object)(object)component != (Object)null) { Chamber.Autochamber(component.RoundClass); } } } private void UpdateFiringDelay() { if (m_isFiringDelayed) { m_firingDelayRemaining -= Time.deltaTime; if (m_firingDelayRemaining <= 0f) { m_isFiringDelayed = false; FireShot(); } } } private void FireShot() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Chamber == (Object)null) && Chamber.IsFull && !Chamber.IsSpent) { Chamber.Fire(); ((FVRFireArm)this).Fire(Chamber, ((FVRFireArm)this).GetMuzzle(), true, 1f, -1f); ((FVRFireArm)this).FireMuzzleSmoke(); bool flag = ((FVRFireArm)this).IsTwoHandStabilized(); bool flag2 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null; bool flag3 = ((FVRFireArm)this).IsShoulderStabilized(); ((FVRFireArm)this).Recoil(flag, flag2, flag3, (FVRFireArmRecoilProfile)null, 1f); ((FVRFireArm)this).PlayAudioGunShot(Chamber.GetRound(), GM.CurrentPlayerBody.GetCurrentSoundEnvironment(), 1f); if (GM.CurrentSceneSettings.IsAmmoInfinite || GM.CurrentPlayerBody.IsInfiniteAmmo) { Chamber.IsSpent = false; Chamber.UpdateProxyDisplay(); } else { Chamber.SetRound((FVRFireArmRound)null, false); TryChamberRound(); } } } public override void LoadMag(FVRFireArmMagazine mag) { if (m_dustCoverState == DustCoverState.Open) { ((FVRFireArm)this).LoadMag(mag); if ((Object)(object)base.Magazine != (Object)null && base.Magazine.HasARound()) { m_dustCoverState = DustCoverState.Closing; m_tarDustCoverLerp = 0f; m_hasPlayedCloseSound = false; } } } public override List GetChamberRoundList() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Chamber != (Object)null && Chamber.IsFull && !Chamber.IsSpent) { List list = new List(); list.Add(Chamber.GetRound().RoundClass); return list; } return null; } public override void SetLoadedChambers(List rounds) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (rounds.Count > 0 && (Object)(object)Chamber != (Object)null) { Chamber.Autochamber(rounds[0]); } } } public class BicLighter : FVRPhysicalObject { private bool m_isLit; private bool isTouching; private Vector2 initTouch = Vector2.zero; private Vector2 LastTouchPoint = Vector2.zero; [Header("Lighting Chance")] [Range(0f, 1f)] public float LightChance = 0.5f; private float currentChance; public Transform Flame; private float m_flame_min = 0.1f; private float m_flame_max = 0.85f; private float m_flame_cur = 0.1f; public AudioSource Audio_Lighter; public AudioClip AudioClip_Strike; public Transform[] FlameJoints; public float[] FlameWeights; public ParticleSystem Sparks; public AlloyAreaLight AlloyLight; public LayerMask LM_FireDamage; private RaycastHit m_hit; public override void Awake() { ((FVRPhysicalObject)this).Awake(); currentChance = LightChance; } public override void UpdateInteraction(FVRViveHand hand) { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); if (hand.IsInStreamlinedMode) { if (hand.Input.AXButtonDown) { TryLight(); } return; } if (hand.Input.TouchpadTouched && !isTouching && hand.Input.TouchpadAxes != Vector2.zero) { isTouching = true; initTouch = hand.Input.TouchpadAxes; } if (hand.Input.TouchpadTouchUp && isTouching) { isTouching = false; Vector2 lastTouchPoint = LastTouchPoint; float y = (lastTouchPoint - initTouch).y; if (y < -0.5f) { TryLight(); } initTouch = Vector2.zero; lastTouchPoint = Vector2.zero; } LastTouchPoint = hand.Input.TouchpadAxes; } public override void FVRUpdate() { //IL_0057: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_01dd: 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_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Expected O, but got Unknown //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).FVRUpdate(); if (m_isLit) { m_flame_cur = Mathf.Lerp(m_flame_cur, m_flame_max, Time.deltaTime * 2f); AlloyLight.Intensity = m_flame_cur * (Mathf.PerlinNoise(Time.time * 10f, ((Component)AlloyLight).transform.position.y) * 0.05f + 0.5f); } else { m_flame_cur = Mathf.Lerp(m_flame_cur, m_flame_min, Time.deltaTime * 7f); } Flame.localScale = new Vector3(m_flame_cur, m_flame_cur, m_flame_cur); Quaternion val = Quaternion.Inverse(((Component)this).transform.rotation); val = Quaternion.Slerp(val, Random.rotation, Mathf.PerlinNoise(Time.time * 5f, 0f) * 0.3f); for (int i = 0; i < FlameJoints.Length; i++) { Quaternion val2 = Quaternion.Slerp(Quaternion.identity, val, FlameWeights[i] + Random.Range(-0.05f, 0.05f)); FlameJoints[i].localScale = new Vector3(Random.Range(0.95f, 1.05f), Random.Range(0.98f, 1.02f), Random.Range(0.95f, 1.05f)); FlameJoints[i].localRotation = Quaternion.Slerp(FlameJoints[i].localRotation, val2, Time.deltaTime * 6f); } if (!m_isLit) { return; } Vector3 position = FlameJoints[0].position; Vector3 position2 = FlameJoints[FlameJoints.Length - 1].position; Vector3 val3 = position2 - position; if (Physics.Raycast(position, ((Vector3)(ref val3)).normalized, ref m_hit, ((Vector3)(ref val3)).magnitude, LayerMask.op_Implicit(LM_FireDamage), (QueryTriggerInteraction)2)) { IFVRDamageable component = ((Component)((RaycastHit)(ref m_hit)).collider).gameObject.GetComponent(); if (component == null && (Object)(object)((RaycastHit)(ref m_hit)).collider.attachedRigidbody != (Object)null) { component = ((Component)((RaycastHit)(ref m_hit)).collider.attachedRigidbody).gameObject.GetComponent(); } if (component != null) { IFVRDamageable obj = component; Damage val4 = new Damage(); val4.Class = (DamageClass)2; val4.Dam_Thermal = 50f; val4.Dam_TotalEnergetic = 50f; val4.point = ((RaycastHit)(ref m_hit)).point; val4.hitNormal = ((RaycastHit)(ref m_hit)).normal; val4.strikeDir = ((Component)this).transform.forward; obj.Damage(val4); } FVRIgnitable component2 = ((Component)((Component)((RaycastHit)(ref m_hit)).collider).transform).gameObject.GetComponent(); if ((Object)(object)component2 == (Object)null && (Object)(object)((RaycastHit)(ref m_hit)).collider.attachedRigidbody != (Object)null) { ((Component)((RaycastHit)(ref m_hit)).collider.attachedRigidbody).gameObject.GetComponent(); } if ((Object)(object)component2 != (Object)null) { FXM.Ignite(component2, 0.1f); } } } private void TryLight() { Sparks.Emit(Random.Range(2, 3)); if (!m_isLit) { if (Random.value < currentChance) { m_isLit = true; Audio_Lighter.PlayOneShot(AudioClip_Strike, 0.3f); ((Component)Flame).gameObject.SetActive(true); currentChance = LightChance; } else { Audio_Lighter.PlayOneShot(AudioClip_Strike, 0.3f); currentChance += 0.1f; currentChance = Mathf.Clamp01(currentChance); } } else { m_isLit = false; ((Component)Flame).gameObject.SetActive(false); currentChance = LightChance; } } } public class Lighter : FVRPhysicalObject { private bool m_isLit; private bool isTouching; private Vector2 initTouch = Vector2.zero; private Vector2 LastTouchPoint = Vector2.zero; public Transform Flame; private float m_flame_min = 0.1f; private float m_flame_max = 0.85f; private float m_flame_cur = 0.1f; public AudioSource Audio_Lighter; public AudioClip AudioClip_Strike; public AudioClip AudioClip_Extinguish; public Transform[] FlameJoints; public float[] FlameWeights; public ParticleSystem Sparks; public AlloyAreaLight AlloyLight; public LayerMask LM_FireDamage; private RaycastHit m_hit; public override void UpdateInteraction(FVRViveHand hand) { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonDown || hand.Input.AXButtonDown) { Light(); } return; } if (hand.Input.TouchpadTouched && !isTouching && hand.Input.TouchpadAxes != Vector2.zero) { isTouching = true; initTouch = hand.Input.TouchpadAxes; } if (hand.Input.TouchpadTouchUp && isTouching) { isTouching = false; Vector2 lastTouchPoint = LastTouchPoint; float y = (lastTouchPoint - initTouch).y; if (y > 0.5f || y < -0.5f) { Light(); } initTouch = Vector2.zero; lastTouchPoint = Vector2.zero; } LastTouchPoint = hand.Input.TouchpadAxes; } public override void FVRUpdate() { //IL_0057: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_01dd: 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_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Expected O, but got Unknown //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).FVRUpdate(); if (m_isLit) { m_flame_cur = Mathf.Lerp(m_flame_cur, m_flame_max, Time.deltaTime * 2f); AlloyLight.Intensity = m_flame_cur * (Mathf.PerlinNoise(Time.time * 10f, ((Component)AlloyLight).transform.position.y) * 0.05f + 0.5f); } else { m_flame_cur = Mathf.Lerp(m_flame_cur, m_flame_min, Time.deltaTime * 7f); } Flame.localScale = new Vector3(m_flame_cur, m_flame_cur, m_flame_cur); Quaternion val = Quaternion.Inverse(((Component)this).transform.rotation); val = Quaternion.Slerp(val, Random.rotation, Mathf.PerlinNoise(Time.time * 5f, 0f) * 0.3f); for (int i = 0; i < FlameJoints.Length; i++) { Quaternion val2 = Quaternion.Slerp(Quaternion.identity, val, FlameWeights[i] + Random.Range(-0.05f, 0.05f)); FlameJoints[i].localScale = new Vector3(Random.Range(0.95f, 1.05f), Random.Range(0.98f, 1.02f), Random.Range(0.95f, 1.05f)); FlameJoints[i].localRotation = Quaternion.Slerp(FlameJoints[i].localRotation, val2, Time.deltaTime * 6f); } if (!m_isLit) { return; } Vector3 position = FlameJoints[0].position; Vector3 position2 = FlameJoints[FlameJoints.Length - 1].position; Vector3 val3 = position2 - position; if (Physics.Raycast(position, ((Vector3)(ref val3)).normalized, ref m_hit, ((Vector3)(ref val3)).magnitude, LayerMask.op_Implicit(LM_FireDamage), (QueryTriggerInteraction)2)) { IFVRDamageable component = ((Component)((RaycastHit)(ref m_hit)).collider).gameObject.GetComponent(); if (component == null && (Object)(object)((RaycastHit)(ref m_hit)).collider.attachedRigidbody != (Object)null) { component = ((Component)((RaycastHit)(ref m_hit)).collider.attachedRigidbody).gameObject.GetComponent(); } if (component != null) { IFVRDamageable obj = component; Damage val4 = new Damage(); val4.Class = (DamageClass)2; val4.Dam_Thermal = 50f; val4.Dam_TotalEnergetic = 50f; val4.point = ((RaycastHit)(ref m_hit)).point; val4.hitNormal = ((RaycastHit)(ref m_hit)).normal; val4.strikeDir = ((Component)this).transform.forward; obj.Damage(val4); } FVRIgnitable component2 = ((Component)((Component)((RaycastHit)(ref m_hit)).collider).transform).gameObject.GetComponent(); if ((Object)(object)component2 == (Object)null && (Object)(object)((RaycastHit)(ref m_hit)).collider.attachedRigidbody != (Object)null) { ((Component)((RaycastHit)(ref m_hit)).collider.attachedRigidbody).gameObject.GetComponent(); } if ((Object)(object)component2 != (Object)null) { FXM.Ignite(component2, 0.1f); } } } private void Light() { if (!m_isLit) { Sparks.Emit(Random.Range(2, 3)); m_isLit = true; Audio_Lighter.PlayOneShot(AudioClip_Strike, 0.3f); ((Component)Flame).gameObject.SetActive(true); } else { m_isLit = false; Audio_Lighter.PlayOneShot(AudioClip_Extinguish, 0.3f); ((Component)Flame).gameObject.SetActive(false); } } } } public class FVRMagazineBeltVisual : MonoBehaviour { [Header("Required")] public FVRFireArmMagazine Magazine; [Header("Belt Path")] public Transform FeedPoint; public Transform MidPoint; public Transform LoosePoint; [Header("Visual Tuning")] public float RoundSpacing = 0.035f; public bool RotateAlongCurve = true; [Header("Link Ejection")] public GameObject LinkPrefab; public Transform EjectionPoint; public float LinkEjectForce = 2f; private void LateUpdate() { //IL_00a0: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Magazine == (Object)null || Magazine.DisplayBullets == null) { return; } int num = Mathf.Min(Magazine.DisplayBullets.Length, Magazine.m_numRounds); if (num <= 0) { return; } for (int i = 0; i < num; i++) { GameObject val = Magazine.DisplayBullets[i]; if ((Object)(object)val == (Object)null) { continue; } Transform transform = val.transform; float num2 = ((num > 1) ? ((float)i / (float)(num - 1)) : 0f); Vector3 val3 = (transform.position = Bezier(FeedPoint.position, MidPoint.position, LoosePoint.position, num2)); if (RotateAlongCurve) { float t = Mathf.Clamp01(num2 + 0.01f); Vector3 val4 = Bezier(FeedPoint.position, MidPoint.position, LoosePoint.position, t); Vector3 val5 = val4 - val3; Vector3 normalized = ((Vector3)(ref val5)).normalized; if (((Vector3)(ref normalized)).sqrMagnitude > 0.0001f) { transform.rotation = Quaternion.LookRotation(normalized); } } } } public void EjectLink() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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) if ((Object)(object)LinkPrefab != (Object)null && (Object)(object)EjectionPoint != (Object)null) { GameObject val = Object.Instantiate(LinkPrefab, EjectionPoint.position, EjectionPoint.rotation); Rigidbody component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.AddForce(EjectionPoint.forward * LinkEjectForce, (ForceMode)1); } } } private Vector3 Bezier(Vector3 a, Vector3 b, Vector3 c, float t) { //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_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_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_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_0015: 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_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_0024: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.Lerp(a, b, t); Vector3 val2 = Vector3.Lerp(b, c, t); return Vector3.Lerp(val, val2, t); } } namespace VolksScripts { public class AttachableMGHandle : AttachableForegrip { [Header("References (optional)")] [Tooltip("Optional. If null, this script will try to resolve the foregrip when attached.")] public FVRAlternateGrip MainForeGrip; public WaggleJoint Waggle; public Vector3 GrabEuler; [Header("Renderer toggles (only)")] [Tooltip("Optional: if set, ALL Renderers under this root will be enabled while held.")] public Transform EnableRenderersRootWhenHeld; [Tooltip("Optional: if set, ALL Renderers under this root will be disabled while held.")] public Transform DisableRenderersRootWhenHeld; [Tooltip("Enabled while held, disabled while not held.")] public Renderer[] RenderersEnableWhenHeld; [Tooltip("Disabled while held, enabled while not held.")] public Renderer[] RenderersDisableWhenHeld; [Header("Failsafe (optional)")] [Tooltip("If > 0, automatically revert after N seconds even if EndInteraction is not called.")] public float AutoRevertSeconds = 0f; private bool _isHeld; private float _heldTime; private bool _wagglePrevManualExecution; private float _nextForegripResolveTime; public override void BeginInteraction(FVRViveHand hand) { ((AttachableForegrip)this).BeginInteraction(hand); SetHeld(held: true); } public override void EndInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).EndInteraction(hand); SetHeld(held: false); } public override void FVRUpdate() { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (_isHeld && !IsActuallyStillHeld()) { SetHeld(held: false); } if (_isHeld && AutoRevertSeconds > 0f && Time.timeSinceLevelLoad - _heldTime >= AutoRevertSeconds) { SetHeld(held: false); } if (_isHeld) { if ((Object)(object)Waggle != (Object)null && (Object)(object)Waggle.hingeGraphic != (Object)null) { Waggle.hingeGraphic.localRotation = Quaternion.Euler(GrabEuler); } } else if ((Object)(object)Waggle != (Object)null) { Waggle.Execute(); } } private bool IsActuallyStillHeld() { bool flag = false; try { flag = ((FVRInteractiveObject)this).IsHeld; } catch { flag = false; } if (flag) { return true; } FVRAlternateGrip orResolveForegrip = GetOrResolveForegrip(); if ((Object)(object)orResolveForegrip == (Object)null) { return false; } try { if ((Object)(object)orResolveForegrip.LastGrabbedInGrip == (Object)(object)this) { if (((FVRInteractiveObject)orResolveForegrip).IsHeld) { return true; } if ((Object)(object)orResolveForegrip.PrimaryObject != (Object)null && orResolveForegrip.PrimaryObject.IsAltHeld) { return true; } } } catch { } return false; } private FVRAlternateGrip GetOrResolveForegrip() { if ((Object)(object)MainForeGrip != (Object)null) { return MainForeGrip; } if (Time.timeSinceLevelLoad < _nextForegripResolveTime) { return null; } _nextForegripResolveTime = Time.timeSinceLevelLoad + 0.25f; try { if ((Object)(object)((FVRFireArmAttachmentInterface)this).Attachment == (Object)null) { return null; } FVRPhysicalObject rootObject = ((FVRFireArmAttachmentInterface)this).Attachment.GetRootObject(); FVRFireArm val = (FVRFireArm)(object)((rootObject is FVRFireArm) ? rootObject : null); if ((Object)(object)val == (Object)null || (Object)(object)val.Foregrip == (Object)null) { return null; } FVRAlternateGrip component = val.Foregrip.GetComponent(); if ((Object)(object)component == (Object)null) { return null; } MainForeGrip = component; return component; } catch { return null; } } private void SetHeld(bool held) { if (_isHeld == held) { return; } _isHeld = held; if (_isHeld) { _heldTime = Time.timeSinceLevelLoad; } if ((Object)(object)Waggle != (Object)null) { if (_isHeld) { _wagglePrevManualExecution = Waggle.ManualExecution; Waggle.ManualExecution = true; } else { Waggle.ManualExecution = _wagglePrevManualExecution; try { Waggle.ResetParticlePos(); } catch { } } } ApplyRendererToggles(_isHeld); } private void ApplyRendererToggles(bool held) { SetRenderersEnabled(RenderersEnableWhenHeld, held); SetRenderersEnabled(RenderersDisableWhenHeld, !held); SetRenderersEnabledUnderRoot(EnableRenderersRootWhenHeld, held); SetRenderersEnabledUnderRoot(DisableRenderersRootWhenHeld, !held); } private static void SetRenderersEnabled(Renderer[] renderers, bool enabled) { if (renderers == null) { return; } foreach (Renderer val in renderers) { if (!((Object)(object)val == (Object)null)) { try { val.enabled = enabled; } catch { } } } } private static void SetRenderersEnabledUnderRoot(Transform root, bool enabled) { if ((Object)(object)root == (Object)null) { return; } Renderer[] componentsInChildren; try { componentsInChildren = ((Component)root).GetComponentsInChildren(true); } catch { return; } foreach (Renderer val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { try { val.enabled = enabled; } catch { } } } } } } namespace MeatKit { public class HideInNormalInspectorAttribute : PropertyAttribute { } } namespace Volks.Infinite_Ammo_Attachment { [BepInPlugin("Volks.Infinite_Ammo_Attachment", "Infinite_Ammo_Attachment", "1.0.0")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class Infinite_Ammo_AttachmentPlugin : 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(), "Volks.Infinite_Ammo_Attachment"); OtherLoader.RegisterDirectLoad(BasePath, "Volks.Infinite_Ammo_Attachment", "", "", "infiniteammo_attachment", ""); } } } public class SodaCanDrinkable : FVRPhysicalObject { [Header("Drink Settings")] public float RequiredTiltAngle = 30f; public float DrinkRate = 0.12f; public float TotalHealAmount = 0.05f; public float RequiredMouthDistance = 0.15f; [Header("Pour Direction")] [Tooltip("Local direction that should point downward when pouring. Example: (0,1,0) if model up is the spout.")] public Vector3 LocalPourDirection = Vector3.up; [Header("Particles")] public ParticleSystem DripParticles; public float HealPerEmission = 0.01f; public int ParticlesPerEmission = 3; [Header("Powerup (Optional)")] public bool GrantPowerupOnDrink = false; public PowerupType PowerupType; public PowerUpIntensity PowerupIntensity; public PowerUpDuration PowerupDuration; public bool PowerupIsPuke = false; public bool PowerupIsInverted = false; [Header("Audio")] public AudioSource DrinkLoopSource; [Header("Debug")] public bool EnableDebug = false; public float DebugInterval = 0.5f; private bool m_isOpened; private bool m_isDrinking; private bool m_isPouring; private bool m_powerupGranted; private float m_healRemaining; private float m_nextDebugTime; private float m_emitAccumulator; public override void Awake() { ((FVRPhysicalObject)this).Awake(); m_healRemaining = TotalHealAmount; if ((Object)(object)DripParticles != (Object)null) { DripParticles.Stop(); } if ((Object)(object)DrinkLoopSource != (Object)null) { DrinkLoopSource.Stop(); } } public void OnCanOpened() { m_isOpened = true; DebugLog("Can opened."); } private void Update() { //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_0044: 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_0046: Unknown result type (might be due to invalid IL or missing references) if (!m_isOpened || m_healRemaining <= 0f) { StopDrinking(); StopPouring(); return; } Vector3 val = ((Component)this).transform.TransformDirection(((Vector3)(ref LocalPourDirection)).normalized); float num = Vector3.Angle(val, Vector3.down); if (num <= RequiredTiltAngle) { Pour(); return; } StopDrinking(); StopPouring(); DebugLog("Tilt too low. Tilt=" + num.ToString("F1")); } public override void UpdateInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).UpdateInteraction(hand); if (GrantPowerupOnDrink && !m_powerupGranted && m_isOpened && ((FVRInteractiveObject)this).IsHeld) { TryGrantPowerup(); } } private void Pour() { if (!m_isPouring) { m_isPouring = true; DebugLog("Pouring started."); } if ((Object)(object)DripParticles != (Object)null && !DripParticles.isPlaying) { DripParticles.Play(); } float num = DrinkRate * Time.deltaTime; num = Mathf.Min(num, m_healRemaining); if (num <= 0f) { StopDrinking(); StopPouring(); return; } EmitForAmount(num); if (CanDrinkNow()) { Drink(num); } else { m_healRemaining -= num; } if (m_healRemaining <= 0f) { DebugLog("Can empty."); StopDrinking(); StopPouring(); } } private bool CanDrinkNow() { //IL_0063: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) if (!((FVRInteractiveObject)this).IsHeld) { DebugLog("Not held."); return false; } if ((Object)(object)GM.CurrentPlayerBody == (Object)null || (Object)(object)GM.CurrentPlayerBody.Head == (Object)null) { DebugLog("Player body/head missing."); return false; } Transform head = GM.CurrentPlayerBody.Head; Vector3 val = head.position + head.up * -0.2f; float num = Vector3.Distance(((Component)this).transform.position, val); if (num > RequiredMouthDistance) { DebugLog("Too far from mouth. Dist=" + num.ToString("F3")); return false; } return true; } private void Drink(float liquidThisFrame) { if (!m_isDrinking) { m_isDrinking = true; if ((Object)(object)DrinkLoopSource != (Object)null) { DrinkLoopSource.loop = true; if (!DrinkLoopSource.isPlaying) { DrinkLoopSource.Play(); } } DebugLog("Drinking started."); } if ((Object)(object)GM.CurrentPlayerBody != (Object)null) { GM.CurrentPlayerBody.HealPercent(liquidThisFrame); } m_healRemaining -= liquidThisFrame; } private void TryGrantPowerup() { //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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_00ac: 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_00db: 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) if (m_powerupGranted || (Object)(object)GM.CurrentPlayerBody == (Object)null || (Object)(object)GM.CurrentPlayerBody.Head == (Object)null) { return; } Vector3 val = ((Component)GM.CurrentPlayerBody.Head).transform.position + Vector3.up * -0.1f; if (!(Vector3.Distance(((Component)this).transform.position, val) > RequiredMouthDistance)) { if ((Object)(object)GM.CurrentSceneSettings != (Object)null) { GM.CurrentSceneSettings.OnPowerupUse(PowerupType); } GM.CurrentPlayerBody.ActivatePower(PowerupType, PowerupIntensity, PowerupDuration, PowerupIsPuke, PowerupIsInverted, -1f); m_powerupGranted = true; DebugLog("Powerup activated: " + PowerupType); } } private void EmitForAmount(float amountThisFrame) { if (!((Object)(object)DripParticles == (Object)null) && !(HealPerEmission <= 0f) && !(amountThisFrame <= 0f)) { m_emitAccumulator += amountThisFrame; int num = Mathf.FloorToInt(m_emitAccumulator / HealPerEmission); if (num > 0) { int num2 = Mathf.Max(1, ParticlesPerEmission); DripParticles.Emit(num * num2); m_emitAccumulator -= (float)num * HealPerEmission; } } } private void StopDrinking() { if (m_isDrinking) { m_isDrinking = false; if ((Object)(object)DrinkLoopSource != (Object)null && DrinkLoopSource.isPlaying) { DrinkLoopSource.Stop(); } DebugLog("Drinking stopped."); } } private void StopPouring() { if (m_isPouring) { m_isPouring = false; if ((Object)(object)DripParticles != (Object)null && DripParticles.isPlaying) { DripParticles.Stop(); } DebugLog("Pouring stopped."); } } private void DebugLog(string message) { if (EnableDebug && !(Time.time < m_nextDebugTime)) { m_nextDebugTime = Time.time + DebugInterval; Debug.Log((object)("[SodaCanDrinkable] " + message)); } } } public class SodaCanTab : FVRInteractiveObject { [Header("References")] public Transform CanBody; public SodaCanDrinkable Can; [Header("Pull Settings")] public float PullDistanceRequired = 0.035f; public float MaxBackwardPull = 0.01f; [Header("Rotation")] public Vector3 MaxPullEuler = new Vector3(-45f, 0f, 0f); [Header("Open Toggle")] public GameObject ToggleOnOpen; [Header("Snap Back")] public float SnapBackDelay = 0.5f; [Header("Audio")] public AudioEvent AudioOpen; private Vector3 m_pullStartLocal; private bool m_isOpened; private Quaternion m_originalLocalRotation; private Coroutine m_snapRoutine; public override void Awake() { //IL_000e: 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) ((FVRInteractiveObject)this).Awake(); m_originalLocalRotation = ((Component)this).transform.localRotation; } public override void BeginInteraction(FVRViveHand hand) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).BeginInteraction(hand); if (!m_isOpened && !((Object)(object)CanBody == (Object)null)) { m_pullStartLocal = CanBody.InverseTransformPoint(hand.Input.FilteredPos); } } public override void FVRUpdate() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_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_006c: 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_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_00b7: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (!((FVRInteractiveObject)this).IsHeld || m_isOpened || (Object)(object)base.m_hand == (Object)null || (Object)(object)CanBody == (Object)null) { return; } Vector3 val = CanBody.InverseTransformPoint(base.m_hand.Input.FilteredPos); Vector3 val2 = val - m_pullStartLocal; if (!(val2.y < 0f - MaxBackwardPull)) { float magnitude = ((Vector3)(ref val2)).magnitude; float num = Mathf.Clamp01(magnitude / PullDistanceRequired); Quaternion val3 = Quaternion.Euler(MaxPullEuler); ((Component)this).transform.localRotation = Quaternion.Lerp(m_originalLocalRotation, val3, num); if (magnitude >= PullDistanceRequired) { OpenCan(); } } } private void OpenCan() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) m_isOpened = true; SM.PlayCoreSound((FVRPooledAudioType)10, AudioOpen, ((Component)this).transform.position); if ((Object)(object)ToggleOnOpen != (Object)null) { ToggleOnOpen.SetActive(true); } if ((Object)(object)Can != (Object)null) { Can.OnCanOpened(); } if (m_snapRoutine != null) { ((MonoBehaviour)this).StopCoroutine(m_snapRoutine); } m_snapRoutine = ((MonoBehaviour)this).StartCoroutine(SnapBackAfterDelay()); } private IEnumerator SnapBackAfterDelay() { if (SnapBackDelay > 0f) { yield return (object)new WaitForSeconds(SnapBackDelay); } ((Component)this).transform.localRotation = m_originalLocalRotation; } public override bool IsInteractable() { return !m_isOpened; } } namespace SimpleLightProbePlacer { [RequireComponent(typeof(LightProbeGroup))] [AddComponentMenu("Rendering/Light Probe Group Control")] public class LightProbeGroupControl : MonoBehaviour { [SerializeField] private float m_mergeDistance = 0.5f; [SerializeField] private bool m_usePointLights = true; [SerializeField] private float m_pointLightRange = 1f; private int m_mergedProbes; private LightProbeGroup m_lightProbeGroup; public float MergeDistance { get { return m_mergeDistance; } set { m_mergeDistance = value; } } public int MergedProbes => m_mergedProbes; public bool UsePointLights { get { return m_usePointLights; } set { m_usePointLights = value; } } public float PointLightRange { get { return m_pointLightRange; } set { m_pointLightRange = value; } } public LightProbeGroup LightProbeGroup { get { if ((Object)(object)m_lightProbeGroup != (Object)null) { return m_lightProbeGroup; } return m_lightProbeGroup = ((Component)this).GetComponent(); } } public void DeleteAll() { LightProbeGroup.probePositions = null; m_mergedProbes = 0; } public void Create() { DeleteAll(); List list = CreatePositions(); list.AddRange(CreateAroundPointLights(m_pointLightRange)); list = MergeClosestPositions(list, m_mergeDistance, out m_mergedProbes); ApplyPositions(list); } public void Merge() { if (LightProbeGroup.probePositions != null) { List source = MergeClosestPositions(LightProbeGroup.probePositions.ToList(), m_mergeDistance, out m_mergedProbes); source = source.Select((Vector3 x) => ((Component)this).transform.TransformPoint(x)).ToList(); ApplyPositions(source); } } private void ApplyPositions(List positions) { LightProbeGroup.probePositions = positions.Select((Vector3 x) => ((Component)this).transform.InverseTransformPoint(x)).ToArray(); } private static List CreatePositions() { LightProbeVolume[] array = Object.FindObjectsOfType(); if (array.Length == 0) { return new List(); } List list = new List(); for (int i = 0; i < array.Length; i++) { list.AddRange(array[i].CreatePositions()); } return list; } private static List CreateAroundPointLights(float range) { List list = (from x in Object.FindObjectsOfType() where (int)x.type == 2 select x).ToList(); if (list.Count == 0) { return new List(); } List list2 = new List(); for (int i = 0; i < list.Count; i++) { list2.AddRange(CreatePositionsAround(((Component)list[i]).transform, range)); } return list2; } private static List MergeClosestPositions(List positions, float distance, out int mergedCount) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) if (positions == null) { mergedCount = 0; return new List(); } int count = positions.Count; bool flag = false; while (!flag) { Dictionary> dictionary = new Dictionary>(); for (int i = 0; i < positions.Count; i++) { List list = positions.Where(delegate(Vector3 x) { //IL_0000: 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_001c: Unknown result type (might be due to invalid IL or missing references) Vector3 val2 = x - positions[i]; return ((Vector3)(ref val2)).magnitude < distance; }).ToList(); if (list.Count > 0 && !dictionary.ContainsKey(positions[i])) { dictionary.Add(positions[i], list); } } positions.Clear(); List list2 = dictionary.Keys.ToList(); for (int j = 0; j < list2.Count; j++) { Vector3 center = dictionary[list2[j]].Aggregate(Vector3.zero, (Vector3 result, Vector3 target) => result + target) / (float)dictionary[list2[j]].Count; if (!positions.Exists((Vector3 x) => x == center)) { positions.Add(center); } } flag = positions.Select((Vector3 x) => positions.Where(delegate(Vector3 y) { //IL_0000: 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_0011: 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_001d: Unknown result type (might be due to invalid IL or missing references) int result2; if (y != x) { Vector3 val = y - x; result2 = ((((Vector3)(ref val)).magnitude < distance) ? 1 : 0); } else { result2 = 0; } return (byte)result2 != 0; })).All((IEnumerable x) => !x.Any()); } mergedCount = count - positions.Count; return positions; } public static List CreatePositionsAround(Transform transform, float range) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_00b1: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) Vector3[] source = (Vector3[])(object)new Vector3[8] { new Vector3(-0.5f, 0.5f, -0.5f), new Vector3(-0.5f, 0.5f, 0.5f), new Vector3(0.5f, 0.5f, 0.5f), new Vector3(0.5f, 0.5f, -0.5f), new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(-0.5f, -0.5f, 0.5f), new Vector3(0.5f, -0.5f, 0.5f), new Vector3(0.5f, -0.5f, -0.5f) }; return source.Select((Vector3 x) => transform.TransformPoint(x * range)).ToList(); } } public enum LightProbeVolumeType { Fixed, Float } [AddComponentMenu("Rendering/Light Probe Volume")] public class LightProbeVolume : TransformVolume { [SerializeField] private LightProbeVolumeType m_type = LightProbeVolumeType.Fixed; [SerializeField] private Vector3 m_densityFixed = Vector3.one; [SerializeField] private Vector3 m_densityFloat = Vector3.one; public LightProbeVolumeType Type { get { return m_type; } set { m_type = value; } } public Vector3 Density { get { //IL_0018: 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_001d: 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) return (m_type != 0) ? m_densityFloat : m_densityFixed; } set { //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_000d: 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) if (m_type == LightProbeVolumeType.Fixed) { m_densityFixed = value; } else { m_densityFloat = value; } } } public static Color EditorColor => new Color(1f, 0.9f, 0.25f); public List CreatePositions() { return CreatePositions(m_type); } public List CreatePositions(LightProbeVolumeType type) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) return (type != 0) ? CreatePositionsFloat(((Component)this).transform, base.Origin, base.Size, Density) : CreatePositionsFixed(((Component)this).transform, base.Origin, base.Size, Density); } public static List CreatePositionsFixed(Transform volumeTransform, Vector3 origin, Vector3 size, Vector3 density) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Vector3 val = origin; float num = size.x / (float)Mathf.FloorToInt(density.x); float num2 = size.y / (float)Mathf.FloorToInt(density.y); float num3 = size.z / (float)Mathf.FloorToInt(density.z); val -= size * 0.5f; for (int i = 0; (float)i <= density.x; i++) { for (int j = 0; (float)j <= density.y; j++) { for (int k = 0; (float)k <= density.z; k++) { Vector3 val2 = val + new Vector3((float)i * num, (float)j * num2, (float)k * num3); val2 = volumeTransform.TransformPoint(val2); list.Add(val2); } } } return list; } public static List CreatePositionsFloat(Transform volumeTransform, Vector3 origin, Vector3 size, Vector3 density) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_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_005a: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Vector3 val = origin; int num = Mathf.FloorToInt(size.x / density.x); int num2 = Mathf.FloorToInt(size.y / density.y); int num3 = Mathf.FloorToInt(size.z / density.z); val -= size * 0.5f; val.x += (size.x - (float)num * density.x) * 0.5f; val.y += (size.y - (float)num2 * density.y) * 0.5f; val.z += (size.z - (float)num3 * density.z) * 0.5f; for (int i = 0; i <= num; i++) { for (int j = 0; j <= num2; j++) { for (int k = 0; k <= num3; k++) { Vector3 val2 = val + new Vector3((float)i * density.x, (float)j * density.y, (float)k * density.z); val2 = volumeTransform.TransformPoint(val2); list.Add(val2); } } } return list; } } [AddComponentMenu("")] public class TransformVolume : MonoBehaviour { [SerializeField] private Volume m_volume = new Volume(Vector3.zero, Vector3.one); public Volume Volume { get { return m_volume; } set { m_volume = value; } } public Vector3 Origin => m_volume.Origin; public Vector3 Size => m_volume.Size; public bool IsInBounds(Vector3[] points) { //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_000c: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = GetBounds(); return ((Bounds)(ref bounds)).Intersects(GetBounds(points)); } public bool IsOnBorder(Vector3[] points) { if (points.All((Vector3 x) => !IsInVolume(x))) { return false; } return !points.All(IsInVolume); } public bool IsInVolume(Vector3[] points) { return points.All(IsInVolume); } public bool IsInVolume(Vector3 position) { //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_0020: Unknown result type (might be due to invalid IL or missing references) Plane val = default(Plane); for (int i = 0; i < 6; i++) { ((Plane)(ref val))..ctor(GetSideDirection(i), GetSidePosition(i)); if (((Plane)(ref val)).GetSide(position)) { return false; } } return true; } public Vector3[] GetCorners() { //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_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_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_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_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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_0174: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[8] { new Vector3(-0.5f, 0.5f, -0.5f), new Vector3(-0.5f, 0.5f, 0.5f), new Vector3(0.5f, 0.5f, 0.5f), new Vector3(0.5f, 0.5f, -0.5f), new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(-0.5f, -0.5f, 0.5f), new Vector3(0.5f, -0.5f, 0.5f), new Vector3(0.5f, -0.5f, -0.5f) }; for (int i = 0; i < array.Length; i++) { ref Vector3 reference = ref array[i]; reference.x *= m_volume.Size.x; ref Vector3 reference2 = ref array[i]; reference2.y *= m_volume.Size.y; ref Vector3 reference3 = ref array[i]; reference3.z *= m_volume.Size.z; ref Vector3 reference4 = ref array[i]; reference4 = ((Component)this).transform.TransformPoint(m_volume.Origin + array[i]); } return array; } public Bounds GetBounds() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) return GetBounds(GetCorners()); } public Bounds GetBounds(Vector3[] points) { //IL_0002: 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_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_0036: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) Vector3 val = points.Aggregate(Vector3.zero, (Vector3 result, Vector3 point) => result + point) / (float)points.Length; Bounds result2 = default(Bounds); ((Bounds)(ref result2))..ctor(val, Vector3.zero); for (int i = 0; i < points.Length; i++) { ((Bounds)(ref result2)).Encapsulate(points[i]); } return result2; } public GameObject[] GetGameObjectsInBounds(LayerMask layerMask) { //IL_000e: 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_007f: Unknown result type (might be due to invalid IL or missing references) MeshRenderer[] array = Object.FindObjectsOfType(); List list = new List(); Bounds bounds = GetBounds(); for (int i = 0; i < array.Length; i++) { if (!((Object)(object)((Component)array[i]).gameObject == (Object)(object)((Component)((Component)this).transform).gameObject) && !((Object)(object)((Component)array[i]).GetComponent() != (Object)null) && ((1 << ((Component)array[i]).gameObject.layer) & ((LayerMask)(ref layerMask)).value) != 0 && ((Bounds)(ref bounds)).Intersects(((Renderer)array[i]).bounds)) { list.Add(((Component)array[i]).gameObject); } } return list.ToArray(); } public Vector3 GetSideDirection(int side) { //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_000e: 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_0019: 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_002e: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[6]; Vector3 right = Vector3.right; Vector3 up = Vector3.up; Vector3 forward = Vector3.forward; array[0] = right; ref Vector3 reference = ref array[1]; reference = -right; array[2] = up; ref Vector3 reference2 = ref array[3]; reference2 = -up; array[4] = forward; ref Vector3 reference3 = ref array[5]; reference3 = -forward; return ((Component)this).transform.TransformDirection(array[side]); } public Vector3 GetSidePosition(int side) { //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_000e: 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_0019: 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_002e: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[6]; Vector3 right = Vector3.right; Vector3 up = Vector3.up; Vector3 forward = Vector3.forward; array[0] = right; ref Vector3 reference = ref array[1]; reference = -right; array[2] = up; ref Vector3 reference2 = ref array[3]; reference2 = -up; array[4] = forward; ref Vector3 reference3 = ref array[5]; reference3 = -forward; return ((Component)this).transform.TransformPoint(array[side] * GetSizeAxis(side) + m_volume.Origin); } public float GetSizeAxis(int side) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) switch (side) { case 0: case 1: return m_volume.Size.x * 0.5f; case 2: case 3: return m_volume.Size.y * 0.5f; default: return m_volume.Size.z * 0.5f; } } public static Volume EditorVolumeControl(TransformVolume transformVolume, float handleSize, Color color) { //IL_000f: 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) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //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_0124: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Expected O, but got Unknown //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: 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_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_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: 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_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0287: 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_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: 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_02c4: 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_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035a: 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_01d4: Expected O, but got Unknown Vector3[] array = (Vector3[])(object)new Vector3[6]; Transform transform = ((Component)transformVolume).transform; Handles.color = color; for (int i = 0; i < array.Length; i++) { ref Vector3 reference = ref array[i]; reference = transformVolume.GetSidePosition(i); } ref Vector3 reference2 = ref array[0]; reference2 = Handles.Slider(array[0], transform.right, handleSize, new CapFunction(Handles.DotHandleCap), 1f); ref Vector3 reference3 = ref array[1]; reference3 = Handles.Slider(array[1], transform.right, handleSize, new CapFunction(Handles.DotHandleCap), 1f); ref Vector3 reference4 = ref array[2]; reference4 = Handles.Slider(array[2], transform.up, handleSize, new CapFunction(Handles.DotHandleCap), 1f); ref Vector3 reference5 = ref array[3]; reference5 = Handles.Slider(array[3], transform.up, handleSize, new CapFunction(Handles.DotHandleCap), 1f); ref Vector3 reference6 = ref array[4]; reference6 = Handles.Slider(array[4], transform.forward, handleSize, new CapFunction(Handles.DotHandleCap), 1f); ref Vector3 reference7 = ref array[5]; reference7 = Handles.Slider(array[5], transform.forward, handleSize, new CapFunction(Handles.DotHandleCap), 1f); Vector3 origin = default(Vector3); origin.x = transform.InverseTransformPoint((array[0] + array[1]) * 0.5f).x; origin.y = transform.InverseTransformPoint((array[2] + array[3]) * 0.5f).y; origin.z = transform.InverseTransformPoint((array[4] + array[5]) * 0.5f).z; Vector3 size = default(Vector3); size.x = transform.InverseTransformPoint(array[0]).x - transform.InverseTransformPoint(array[1]).x; size.y = transform.InverseTransformPoint(array[2]).y - transform.InverseTransformPoint(array[3]).y; size.z = transform.InverseTransformPoint(array[4]).z - transform.InverseTransformPoint(array[5]).z; return new Volume(origin, size); } } [Serializable] public struct Volume { [SerializeField] private Vector3 m_origin; [SerializeField] private Vector3 m_size; public Vector3 Origin => m_origin; public Vector3 Size => m_size; public Volume(Vector3 origin, Vector3 size) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) m_origin = origin; m_size = size; } public static bool operator ==(Volume left, Volume right) { return left.Equals(right); } public static bool operator !=(Volume left, Volume right) { return !left.Equals(right); } public bool Equals(Volume other) { //IL_0002: 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_0019: 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) return Origin == other.Origin && Size == other.Size; } public override bool Equals(object obj) { if (object.ReferenceEquals(null, obj)) { return false; } return obj is Volume && Equals((Volume)obj); } public override int GetHashCode() { //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_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) Vector3 origin = Origin; int num = ((object)(Vector3)(ref origin)).GetHashCode() * 397; Vector3 size = Size; return num ^ ((object)(Vector3)(ref size)).GetHashCode(); } public override string ToString() { //IL_0007: 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) return $"Origin: {Origin}, Size: {Size}"; } } } namespace nrgill28.AtlasSampleScene { public class CTF_CaptureZone : MonoBehaviour { public CTF_Manager Manager; public CTF_Team Team; public void OnTriggerEnter(Collider other) { CTF_Flag component = ((Component)other).GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.Team != Team) { Manager.FlagCaptured(component); } } } public class CTF_Flag : FVRPhysicalObject { [Header("Flag stuffs")] public CTF_Team Team; public float RespawnDelay = 10f; public Vector3 FloorOffset = new Vector3(0f, 0.25f, 0f); private Vector3 _resetPosition; private Quaternion _resetRotation; private Transform _followTransform; private bool _isHeld; private bool _isTaken; private float _timer; private CTF_Sosig _heldBy; public override void Awake() { //IL_000e: 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_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) ((FVRPhysicalObject)this).Awake(); _resetPosition = ((Component)this).transform.position; _resetRotation = ((Component)this).transform.rotation; } private void Update() { if (_isTaken && !_isHeld) { _timer -= Time.deltaTime; if (_timer < 0f) { ReturnFlag(); } } } public void Take() { _isHeld = true; _isTaken = true; } public void Drop() { //IL_001a: 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) //IL_0040: 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) ((FVRInteractiveObject)this).IsHeld = false; _timer = RespawnDelay; NavMeshHit val = default(NavMeshHit); NavMesh.SamplePosition(((Component)this).transform.position, ref val, 100f, -1); ((Component)this).transform.position = ((NavMeshHit)(ref val)).position + FloorOffset; ((Component)this).transform.rotation = Quaternion.identity; } public void ReturnFlag() { //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) if (((FVRInteractiveObject)this).IsHeld) { ((FVRInteractiveObject)this).ForceBreakInteraction(); } if (Object.op_Implicit((Object)(object)_heldBy)) { _heldBy.HeldFlag = null; } ((Component)this).transform.SetPositionAndRotation(_resetPosition, _resetRotation); _isTaken = false; } private void OnTriggerEnter(Collider other) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (_isHeld) { return; } CTF_Sosig componentInParent = ((Component)other).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent) && (int)componentInParent.Sosig.BodyState == 0) { if (componentInParent.Team == Team) { ReturnFlag(); return; } _heldBy = componentInParent; componentInParent.HeldFlag = this; Take(); } } public override void BeginInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).BeginInteraction(hand); Take(); } public override void EndInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).EndInteraction(hand); Drop(); } } public class CTF_Manager : MonoBehaviour { [Header("References")] public Text[] ScoreTexts; public Transform[] AttackPoints; public Text StartButtonText; [Header("Red Team")] public CTF_Flag RedFlag; public int RedTeamSize; public Transform[] RedSpawns; public SosigEnemyID[] RedTeam; [Header("Blue Team")] public CTF_Flag BlueFlag; public int BlueTeamSize; public Transform[] BlueSpawns; public SosigEnemyID[] BlueTeam; private int _blueScore; private int _redScore; private bool _running; private readonly List _sosigs = new List(); private readonly SpawnOptions _spawnOptions; public CTF_Manager() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown SpawnOptions val = new SpawnOptions(); val.SpawnState = (SosigOrder)7; val.SpawnActivated = true; val.EquipmentMode = (EquipmentSlots)7; val.SpawnWithFullAmmo = true; _spawnOptions = val; ((MonoBehaviour)this)..ctor(); } private void Start() { UpdateScoreText(); } public void ToggleGame() { if (_running) { EndGame(); StartButtonText.text = "Start Game"; } else { StartGame(); StartButtonText.text = "Stop Game"; } } private void StartGame() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown ResetGame(); _running = true; GM.CurrentSceneSettings.SosigKillEvent += new SosigKill(CurrentSceneSettingsOnSosigKillEvent); ((MonoBehaviour)this).StartCoroutine(DoInitialSpawns()); } private void EndGame() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown GM.CurrentSceneSettings.SosigKillEvent -= new SosigKill(CurrentSceneSettingsOnSosigKillEvent); foreach (CTF_Sosig sosig in _sosigs) { sosig.Sosig.ClearSosig(); } _running = false; } private void CurrentSceneSettingsOnSosigKillEvent(Sosig s) { CTF_Sosig cTF_Sosig = _sosigs.FirstOrDefault((CTF_Sosig x) => (Object)(object)x.Sosig == (Object)(object)s); if (Object.op_Implicit((Object)(object)cTF_Sosig)) { ((MonoBehaviour)this).StartCoroutine(RespawnSosig(cTF_Sosig)); } } private void SpawnSosig(CTF_Team team) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_008e: Unknown result type (might be due to invalid IL or missing references) _spawnOptions.IFF = (int)team; _spawnOptions.SosigTargetPosition = SodaliteUtils.GetRandom((IList)AttackPoints).position; Transform transform; SosigEnemyID random; if (team == CTF_Team.Red) { transform = ((Component)SodaliteUtils.GetRandom((IList)RedSpawns)).transform; random = SodaliteUtils.GetRandom((IList)RedTeam); } else { transform = ((Component)SodaliteUtils.GetRandom((IList)BlueSpawns)).transform; random = SodaliteUtils.GetRandom((IList)BlueTeam); } Sosig val = SosigAPI.Spawn(ManagerSingleton.Instance.odicSosigObjsByID[random], _spawnOptions, transform.position, transform.rotation); CTF_Sosig cTF_Sosig = ((Component)val).gameObject.AddComponent(); _sosigs.Add(cTF_Sosig); cTF_Sosig.Sosig = val; cTF_Sosig.Team = team; } private IEnumerator DoInitialSpawns() { int i = 0; while (i < Mathf.Max(RedTeamSize, BlueTeamSize)) { if (i < RedTeamSize) { SpawnSosig(CTF_Team.Red); } if (i < BlueTeamSize) { SpawnSosig(CTF_Team.Blue); } i++; yield return (object)new WaitForSeconds(2.5f); } } private IEnumerator RespawnSosig(CTF_Sosig sosig) { yield return (object)new WaitForSeconds(5f); sosig.Sosig.ClearSosig(); _sosigs.Remove(sosig); yield return (object)new WaitForSeconds(5f); if (_running) { int sosigsLeft = _sosigs.Count((CTF_Sosig x) => x.Team == sosig.Team); int teamSize = ((sosig.Team != 0) ? BlueTeamSize : RedTeamSize); if (sosigsLeft < teamSize) { SpawnSosig(sosig.Team); } } } public void ResetGame() { _blueScore = 0; _redScore = 0; UpdateScoreText(); if (Object.op_Implicit((Object)(object)RedFlag)) { RedFlag.ReturnFlag(); } if (Object.op_Implicit((Object)(object)BlueFlag)) { BlueFlag.ReturnFlag(); } } public void FlagCaptured(CTF_Flag flag) { if (flag.Team == CTF_Team.Red) { _blueScore++; } else { _redScore++; } UpdateScoreText(); flag.ReturnFlag(); } public void UpdateScoreText() { Text[] scoreTexts = ScoreTexts; foreach (Text val in scoreTexts) { val.text = "" + _redScore + " - " + _blueScore + ""; } } private void OnDrawGizmos() { //IL_0001: 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_003b: 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_007d: 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) Gizmos.color = Color.red; Transform[] redSpawns = RedSpawns; foreach (Transform val in redSpawns) { Gizmos.DrawSphere(val.position, 0.15f); } Gizmos.color = Color.blue; Transform[] blueSpawns = BlueSpawns; foreach (Transform val2 in blueSpawns) { Gizmos.DrawSphere(val2.position, 0.15f); } Gizmos.color = Color.green; Transform[] attackPoints = AttackPoints; foreach (Transform val3 in attackPoints) { Gizmos.DrawSphere(val3.position, 0.15f); } } } public class CTF_Sosig : MonoBehaviour { public CTF_Team Team; public CTF_Flag HeldFlag; public Sosig Sosig; private void Awake() { Sosig = ((Component)this).GetComponent(); } private void Update() { //IL_001d: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0059: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)HeldFlag)) { Vector3 val = ((Component)Sosig).transform.position - ((Component)Sosig).transform.forward * 0.1f; ((Component)HeldFlag).transform.SetPositionAndRotation(val, ((Component)Sosig).transform.rotation); } } } public enum CTF_Team { Red, Blue } public class PopupTarget : MonoBehaviour, IFVRDamageable { [Flags] public enum TargetRange { Near = 1, Mid = 2, Far = 4, All = 7 } public PopupTargetManager Manager; public TargetRange Range; public Transform Pivot; public Vector3 SetRotation; private Quaternion _startRotation; private Quaternion _endRotation; private bool _set; public bool Set { get { return _set; } set { //IL_003e: 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_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) if (_set != value) { _set = value; ((MonoBehaviour)this).StartCoroutine((!_set) ? RotateTo(_endRotation, _startRotation) : RotateTo(_startRotation, _endRotation)); } } } private void Awake() { //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_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_002e: Unknown result type (might be due to invalid IL or missing references) _startRotation = Pivot.rotation; _endRotation = Quaternion.Euler(SetRotation + ((Quaternion)(ref _startRotation)).eulerAngles); } void IFVRDamageable.Damage(Damage dam) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 if (Set && (int)dam.Class == 1) { Set = false; Manager.TargetHit(this); } } private IEnumerator RotateTo(Quaternion from, Quaternion to) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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) float elapsed = 0f; while (elapsed < 0.25f) { yield return null; elapsed += Time.deltaTime; Pivot.localRotation = Quaternion.Slerp(from, to, elapsed / 0.25f); } Pivot.rotation = to; } } public class PopupTargetManager : MonoBehaviour { public List Targets; private readonly List _setTargets = new List(); private void Awake() { ((MonoBehaviour)this).StartCoroutine(StartSetAsync(3f, 8f, 5, PopupTarget.TargetRange.All)); } private IEnumerator StartSetAsync(float minDelay, float maxDelay, int numTargets, PopupTarget.TargetRange ranges) { yield return (object)new WaitForSeconds(Random.Range(minDelay, maxDelay)); IListExtensions.Shuffle((IList)Targets); _setTargets.Clear(); foreach (PopupTarget target in Targets) { if ((target.Range & ranges) != 0) { target.Set = true; _setTargets.Add(target); numTargets--; } if (numTargets == 0) { break; } } } public void TargetHit(PopupTarget target) { if (_setTargets.Contains(target)) { _setTargets.Remove(target); if (_setTargets.Count == 0) { ((MonoBehaviour)this).StartCoroutine(StartSetAsync(3f, 8f, 5, PopupTarget.TargetRange.All)); } } } } } namespace VolksScripts { public class PepperSpray : FVRPhysicalObject, IFVRDamageable { [Header("Spray Behaviour")] public float SprayDistance = 6f; public float SprayAngle = 4f; public float SprayCloudSpawnInterval = 0.05f; public LayerMask LM_SprayCast; public string Filltag; [Header("Cloud Effect (PowerUp_Cloud)")] public PowerUp_Cloud PepperCloudPrefab; public float PepperCloudRadius = 3f; public float PepperCloudLifetime = 1f; public bool OverrideCloudParams = true; public PowerupType PepperType = (PowerupType)10; public PowerUpIntensity PepperIntensity = (PowerUpIntensity)1; public PowerUpDuration PepperDuration = (PowerUpDuration)1; public bool PepperIsPuke = false; public bool PepperIsInverted = false; [Header("FX / Audio")] public Transform Tip; public Vector2 TipRange; public Transform Muzzle; public ParticleSystem PSystem_Spray; public AudioEvent AudEvent_Head; public AudioEvent AudEvent_Tail; public AudioEvent AudEvent_Rattle; public AudioSource AudSource_Loop; public AudioClip AudClip_Spray; private bool m_isSpraying; private bool m_wasSpraying; private float m_timeTilCast = 0.02f; private float m_timeTilCloudSpawn; [Header("Rattle (optional)")] public float RattleRadius = 0.02f; public float RattleHeight = 0.01f; public Transform ballviz; private Vector3 m_rattlePos = Vector3.zero; private Vector3 m_rattleLastPos = Vector3.zero; private Vector3 m_rattleVel = Vector3.zero; private bool m_israttleSide; private bool m_wasrattleSide; public void Damage(Damage d) { } public override void UpdateInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).UpdateInteraction(hand); m_isSpraying = false; float triggerFloat = hand.Input.TriggerFloat; if (triggerFloat > 0.05f) { ((FVRPhysicalObject)this).SetAnimatedComponent(Tip, Mathf.Lerp(TipRange.x, TipRange.y, triggerFloat), (InterpStyle)0, (Axis)1); if (triggerFloat > 0.25f) { m_isSpraying = true; } } else { ((FVRPhysicalObject)this).SetAnimatedComponent(Tip, TipRange.x, (InterpStyle)0, (Axis)1); } } public override void EndInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).EndInteraction(hand); ((FVRPhysicalObject)this).SetAnimatedComponent(Tip, TipRange.x, (InterpStyle)0, (Axis)1); m_isSpraying = false; } public override void FVRUpdate() { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_028c: 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) ((FVRPhysicalObject)this).FVRUpdate(); RattleUpdate(); if (m_isSpraying) { if ((Object)(object)PSystem_Spray != (Object)null) { if (!PSystem_Spray.isPlaying) { PSystem_Spray.Play(); } PSystem_Spray.Emit(8); } m_timeTilCast -= Time.deltaTime; m_timeTilCloudSpawn -= Time.deltaTime; if (m_timeTilCast <= 0f) { m_timeTilCast = 0.02f; RaycastHit val = default(RaycastHit); if ((Object)(object)Muzzle != (Object)null && Physics.Raycast(Muzzle.position, Muzzle.forward, ref val, SprayDistance, LayerMask.op_Implicit(LM_SprayCast), (QueryTriggerInteraction)1)) { if (((Component)((RaycastHit)(ref val)).collider).gameObject.CompareTag(Filltag)) { PotatoGun val2 = ((!Object.op_Implicit((Object)(object)((RaycastHit)(ref val)).collider.attachedRigidbody)) ? null : ((Component)((RaycastHit)(ref val)).collider.attachedRigidbody).gameObject.GetComponent()); if ((Object)(object)val2 != (Object)null) { val2.InsertGas(0.01f); } } TrySpawnPepperCloud(((RaycastHit)(ref val)).point, ((RaycastHit)(ref val)).normal); } else if ((Object)(object)Muzzle != (Object)null) { TrySpawnPepperCloud(Muzzle.position + Muzzle.forward * (SprayDistance * 0.4f), Muzzle.forward); } } } if (m_isSpraying && !m_wasSpraying) { if (AudEvent_Head != null && (Object)(object)Muzzle != (Object)null) { SM.PlayCoreSound((FVRPooledAudioType)10, AudEvent_Head, Muzzle.position); } if ((Object)(object)AudSource_Loop != (Object)null && (Object)(object)AudClip_Spray != (Object)null) { AudSource_Loop.clip = AudClip_Spray; AudSource_Loop.loop = true; AudSource_Loop.Play(); } } else if (!m_isSpraying && m_wasSpraying) { if (AudEvent_Tail != null && (Object)(object)Muzzle != (Object)null) { SM.PlayCoreSound((FVRPooledAudioType)10, AudEvent_Tail, Muzzle.position); } if ((Object)(object)AudSource_Loop != (Object)null) { AudSource_Loop.Stop(); } } m_wasSpraying = m_isSpraying; } private void TrySpawnPepperCloud(Vector3 pos, Vector3 forward) { //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_0040: 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_0093: 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) if (!((Object)(object)PepperCloudPrefab == (Object)null) && !(m_timeTilCloudSpawn > 0f)) { m_timeTilCloudSpawn = SprayCloudSpawnInterval; PowerUp_Cloud val = Object.Instantiate(PepperCloudPrefab, pos, Quaternion.LookRotation(forward)); val.CloudRadius = PepperCloudRadius; ((object)val).GetType().GetField("LifetimeSeconds")?.SetValue(val, PepperCloudLifetime); if (OverrideCloudParams) { val.SetParams(PepperType, PepperIntensity, PepperDuration, PepperIsPuke, PepperIsInverted); } } } private void RattleUpdate() { //IL_0033: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01af: 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_01d2: 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_0291: 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_01ff: 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_024b: 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_027f: Unknown result type (might be due to invalid IL or missing references) m_wasrattleSide = m_israttleSide; if (m_wasrattleSide) { m_rattleVel = ((FVRPhysicalObject)this).RootRigidbody.velocity; } else { m_rattleVel -= ((FVRPhysicalObject)this).RootRigidbody.GetPointVelocity(((Component)this).transform.TransformPoint(m_rattlePos)) * Time.deltaTime; } m_rattleVel += Vector3.up * -0.5f * Time.deltaTime; Vector3 val = ((Component)this).transform.InverseTransformDirection(m_rattleVel); m_rattlePos += val * Time.deltaTime; float num = m_rattlePos.y; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(m_rattlePos.x, m_rattlePos.z); m_israttleSide = false; float magnitude = ((Vector2)(ref val2)).magnitude; if (magnitude > RattleRadius) { float num2 = RattleRadius - magnitude; val2 = Vector2.op_Implicit(Vector3.ClampMagnitude(Vector2.op_Implicit(val2), RattleRadius)); num += num2 * Mathf.Sign(num); val = Vector3.ProjectOnPlane(val, new Vector3(val2.x, 0f, val2.y)); m_israttleSide = true; } if (Mathf.Abs(num) > RattleHeight) { num = RattleHeight * Mathf.Sign(num); val.y = 0f; m_israttleSide = true; } m_rattlePos = new Vector3(val2.x, num, val2.y); m_rattleVel = ((Component)this).transform.TransformDirection(val); if ((Object)(object)ballviz != (Object)null) { ballviz.localPosition = m_rattlePos; } if (m_israttleSide && !m_wasrattleSide) { float num3 = Mathf.Clamp(4f * (Vector3.Distance(m_rattlePos, m_rattleLastPos) / RattleRadius), 0f, 1f); if (AudEvent_Rattle != null) { SM.PlayCoreSoundOverrides((FVRPooledAudioType)40, AudEvent_Rattle, (!Object.op_Implicit((Object)(object)ballviz)) ? ((Component)this).transform.position : ballviz.position, new Vector2(num3 * 0.4f, num3 * 0.4f), new Vector2(1f, 1f)); } } m_rattleLastPos = m_rattlePos; } } public class PocketWatch : FVRPhysicalObject { [SerializeField] private GameObject secondsHandle; [SerializeField] private GameObject minutesHandle; [SerializeField] private GameObject hoursHandle; private float secondsMultiplier = 1f; public Transform WatchLid; public float openRotationX = 90f; public float openRotationY = 0f; public float openRotationZ = 0f; public float closeRotationX = 0f; public float closeRotationY = 0f; public float closeRotationZ = 0f; public float rotationSpeed = 5f; private bool isOpen = false; [SerializeField] private AudioSource openCloseAudioSource; [SerializeField] private AudioClip openClip; [SerializeField] private AudioClip closeClip; [SerializeField] private AudioSource tickingAudioSource; [SerializeField] private AudioClip tickingClip; private Coroutine tickingCoroutine; private bool isTouching = false; private Vector2 initTouch = Vector2.zero; private Vector2 LastTouchPoint = Vector2.zero; private void Update() { //IL_005c: 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_00a0: 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_00c7: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) DateTime now = DateTime.Now; int second = now.Second; int minute = now.Minute; int hour = now.Hour; float num = second * 6; float num2 = (float)(minute * 6) + (float)second * 0.1f; float num3 = (float)(hour * 30) + (float)minute * 0.5f; secondsHandle.transform.localRotation = Quaternion.Euler(0f - num, 0f, 0f); minutesHandle.transform.localRotation = Quaternion.Euler(0f - num2, 0f, 0f); hoursHandle.transform.localRotation = Quaternion.Euler(0f - num3, 0f, 0f); Quaternion val = ((!isOpen) ? Quaternion.Euler(closeRotationX, closeRotationY, closeRotationZ) : Quaternion.Euler(openRotationX, openRotationY, openRotationZ)); WatchLid.localRotation = Quaternion.Lerp(WatchLid.localRotation, val, Time.deltaTime * rotationSpeed); } public void ToggleLid() { isOpen = !isOpen; if (isOpen) { openCloseAudioSource.PlayOneShot(openClip); if (tickingCoroutine == null) { tickingCoroutine = ((MonoBehaviour)this).StartCoroutine(PlayTickingSound()); } return; } openCloseAudioSource.PlayOneShot(closeClip); if (tickingCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(tickingCoroutine); tickingCoroutine = null; } tickingAudioSource.Stop(); } private IEnumerator PlayTickingSound() { while (true) { tickingAudioSource.PlayOneShot(tickingClip); yield return (object)new WaitForSeconds(1f); } } public override void UpdateInteraction(FVRViveHand hand) { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonDown || hand.Input.AXButtonDown) { ToggleLid(); } return; } if (hand.Input.TouchpadTouched && !isTouching && hand.Input.TouchpadAxes != Vector2.zero) { isTouching = true; initTouch = hand.Input.TouchpadAxes; } if (hand.Input.TouchpadTouchUp && isTouching) { isTouching = false; Vector2 lastTouchPoint = LastTouchPoint; float y = (lastTouchPoint - initTouch).y; if (y > 0.5f || y < -0.5f) { ToggleLid(); } initTouch = Vector2.zero; lastTouchPoint = Vector2.zero; } LastTouchPoint = hand.Input.TouchpadAxes; } } public class ManualHammerBoltActionRifle : BoltActionRifle { [Header("Manual Hammer Settings")] public float HammerHalfCocked = 0.5f; public float HammerHalfCockedRot = 30f; public bool HammerUsesRotation = false; public Axis HammerRotationAxis = (Axis)2; public float HammerUncockedRot = 0f; public float HammerCockedRot = 60f; [Header("Hammer Animation Speed")] [Tooltip("Controls how fast the hammer moves to its target position/rotation.")] public float HammerAnimationSpeed = 15f; private bool m_isHammerHalfCocked = false; private bool m_wasBoltClosed = false; private const float kBoltClosedThreshold = 0.05f; public override void Awake() { //IL_0004: Unknown result type (might be due to invalid IL or missing references) base.CockType = (HammerCockType)99; ((BoltActionRifle)this).Awake(); } public override void FVRUpdate() { //IL_0008: 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_009d: 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_00b4: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArm)this).FVRUpdate(); bool flag = (int)base.CurBoltHandleState == 0 && base.BoltLerp <= 0.05f; if (!m_wasBoltClosed && flag) { SetHammerHalfCock(); } m_wasBoltClosed = flag; if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null) { if (((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode) { if (((FVRInteractiveObject)this).m_hand.Input.AXButtonDown) { TryManualCock(); } } else { Vector2 touchpadAxes = ((FVRInteractiveObject)this).m_hand.Input.TouchpadAxes; if (((FVRInteractiveObject)this).m_hand.Input.TouchpadDown && Vector2.Angle(touchpadAxes, Vector2.down) < 45f) { TryManualCock(); } } } UpdateHammerVisual(); } private void TryManualCock() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) if ((int)base.CurBoltHandleState == 0) { if (((BoltActionRifle)this).IsHammerCocked) { m_isHammerHalfCocked = false; return; } ((BoltActionRifle)this).CockHammer(); m_isHammerHalfCocked = false; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f); } } private void SetHammerHalfCock() { if (((BoltActionRifle)this).IsHammerCocked) { m_isHammerHalfCocked = false; return; } m_isHammerHalfCocked = true; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f); UpdateHammerVisualImmediate(); } private void UpdateHammerVisual() { //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 //IL_00f8: Unknown result type (might be due to invalid IL or missing references) if (!base.HasVisualHammer || (Object)(object)base.Hammer == (Object)null) { return; } if (HammerUsesRotation) { float num = HammerUncockedRot; if (((BoltActionRifle)this).IsHammerCocked) { num = HammerCockedRot; } else if (m_isHammerHalfCocked) { num = HammerHalfCockedRot; } Vector3 localEulerAngles = base.Hammer.localEulerAngles; Axis hammerRotationAxis = HammerRotationAxis; if ((int)hammerRotationAxis != 0) { if ((int)hammerRotationAxis == 1) { localEulerAngles.y = Mathf.LerpAngle(localEulerAngles.y, num, Time.deltaTime * HammerAnimationSpeed); } else { localEulerAngles.z = Mathf.LerpAngle(localEulerAngles.z, num, Time.deltaTime * HammerAnimationSpeed); } } else { localEulerAngles.x = Mathf.LerpAngle(localEulerAngles.x, num, Time.deltaTime * HammerAnimationSpeed); } base.Hammer.localEulerAngles = localEulerAngles; } else { float num2 = base.HammerUncocked; if (((BoltActionRifle)this).IsHammerCocked) { num2 = base.HammerCocked; } else if (m_isHammerHalfCocked) { num2 = HammerHalfCocked; } Vector3 localPosition = base.Hammer.localPosition; localPosition.z = Mathf.Lerp(localPosition.z, num2, Time.deltaTime * HammerAnimationSpeed); base.Hammer.localPosition = localPosition; } } private void UpdateHammerVisualImmediate() { //IL_00f9: 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_010e: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_007c: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) if (!base.HasVisualHammer || (Object)(object)base.Hammer == (Object)null) { return; } if (HammerUsesRotation) { float num = (m_isHammerHalfCocked ? HammerHalfCockedRot : ((!((BoltActionRifle)this).IsHammerCocked) ? HammerUncockedRot : HammerCockedRot)); Vector3 localEulerAngles = base.Hammer.localEulerAngles; Axis hammerRotationAxis = HammerRotationAxis; if ((int)hammerRotationAxis != 0) { if ((int)hammerRotationAxis == 1) { localEulerAngles.y = num; } else { localEulerAngles.z = num; } } else { localEulerAngles.x = num; } base.Hammer.localEulerAngles = localEulerAngles; } else { float z = (m_isHammerHalfCocked ? HammerHalfCocked : ((!((BoltActionRifle)this).IsHammerCocked) ? base.HammerUncocked : base.HammerCocked)); Vector3 localPosition = base.Hammer.localPosition; localPosition.z = z; base.Hammer.localPosition = localPosition; } } public override void EndInteraction(FVRViveHand hand) { ((BoltActionRifle)this).EndInteraction(hand); if (((BoltActionRifle)this).IsHammerCocked) { m_isHammerHalfCocked = false; } } } } namespace JerryComponent { public class ParentPlayer : MonoBehaviour { public FVRPhysicalObject ObjItself; public bool kicked = false; public float kickForceMul = 10f; public GameObject ParentObj; public GameObject PlayerRef; public float SteerMul = 100f; public float MaxX; public float MinX; public float MaxY; public float MinY; public float MaxZ; public float MinZ; public GameObject board; public WheelCollider WheelSteerL; public WheelCollider WheelSteerR; public WheelCollider WheelStaticL; public WheelCollider WheelStaticR; [NonSerialized] public float WFL; [NonSerialized] public float WFR; [NonSerialized] public float WRL; [NonSerialized] public float WRR; public GameObject Fsus; public GameObject Rsus; public GameObject WheelFrontL; public GameObject WheelFrontR; public GameObject WheelRearL; public GameObject WheelRearR; public GameObject navb; [NonSerialized] public float FY; [NonSerialized] public float RY; [NonSerialized] public float BZ; [NonSerialized] public float WSL; [NonSerialized] public float WSR; [NonSerialized] public float WSL2; [NonSerialized] public float WSR2; private void Start() { navb.transform.SetParent((Transform)null); } private void Update() { //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_003a: 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_007d: 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_00c0: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: 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_0702: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_072c: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_08b2: Unknown result type (might be due to invalid IL or missing references) //IL_08d6: Unknown result type (might be due to invalid IL or missing references) //IL_08fa: Unknown result type (might be due to invalid IL or missing references) //IL_081e: Unknown result type (might be due to invalid IL or missing references) //IL_0823: Unknown result type (might be due to invalid IL or missing references) //IL_0831: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Unknown result type (might be due to invalid IL or missing references) //IL_0756: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_077b: Unknown result type (might be due to invalid IL or missing references) //IL_0780: Unknown result type (might be due to invalid IL or missing references) //IL_044f: 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_07a5: Unknown result type (might be due to invalid IL or missing references) //IL_07aa: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_07cf: Unknown result type (might be due to invalid IL or missing references) //IL_07d4: 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_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_05ed: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Unknown result type (might be due to invalid IL or missing references) //IL_0677: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Unknown result type (might be due to invalid IL or missing references) WheelFrontL.transform.localEulerAngles = new Vector3(WheelFrontL.transform.localEulerAngles.x - WheelSteerL.rpm, 0f, 0f); WheelFrontR.transform.localEulerAngles = new Vector3(WheelFrontR.transform.localEulerAngles.x - WheelSteerR.rpm, 0f, 0f); WheelRearL.transform.localEulerAngles = new Vector3(WheelRearL.transform.localEulerAngles.x - WheelStaticL.rpm, 0f, 0f); WheelRearR.transform.localEulerAngles = new Vector3(WheelRearR.transform.localEulerAngles.x - WheelStaticR.rpm, 0f, 0f); WheelStaticL.motorTorque = Mathf.SmoothDamp(WheelStaticL.motorTorque, 0f, ref WSL, 5f); WheelStaticR.motorTorque = Mathf.SmoothDamp(WheelStaticR.motorTorque, 0f, ref WSR, 5f); WheelSteerL.motorTorque = Mathf.SmoothDamp(WheelSteerL.motorTorque, 0f, ref WSL2, 5f); WheelSteerR.motorTorque = Mathf.SmoothDamp(WheelSteerR.motorTorque, 0f, ref WSR2, 5f); if (((FVRInteractiveObject)ObjItself).IsHeld || (Object)(object)ObjItself.QuickbeltSlot != (Object)null) { WheelStaticL.motorTorque = 0f; WheelStaticR.motorTorque = 0f; WheelSteerL.motorTorque = 0f; WheelSteerR.motorTorque = 0f; navb.SetActive(false); ((Component)GM.CurrentMovementManager).gameObject.transform.SetParent((Transform)null); kicked = false; WheelSteerL.steerAngle = 0f; WheelSteerR.steerAngle = 0f; WheelStaticL.steerAngle = 0f; WheelStaticR.steerAngle = 0f; Fsus.transform.localEulerAngles = new Vector3(0f, 0f, 0f); Rsus.transform.localEulerAngles = new Vector3(0f, 0f, 0f); board.transform.localEulerAngles = new Vector3(0f, 0f, 0f); } else { if (((FVRInteractiveObject)ObjItself).IsHeld || !((Object)(object)ObjItself.QuickbeltSlot == (Object)null)) { return; } navb.SetActive(true); if (!((Object)(object)GM.CurrentMovementManager != (Object)null)) { return; } PlayerRef.transform.position = new Vector3(((Component)GM.CurrentPlayerBody.Head).gameObject.transform.position.x, ((Component)GM.CurrentMovementManager).gameObject.transform.position.y, ((Component)GM.CurrentPlayerBody.Head).gameObject.transform.position.z); if (PlayerRef.transform.localPosition.x < MaxX && PlayerRef.transform.localPosition.x > MinX && PlayerRef.transform.localPosition.y < MaxY && PlayerRef.transform.localPosition.y > MinY && PlayerRef.transform.localPosition.z < MaxZ && PlayerRef.transform.localPosition.z > MinZ) { if (!kicked) { WheelStaticL.motorTorque = ((Vector3)(ref GM.CurrentMovementManager.m_smoothLocoVelocity)).magnitude * kickForceMul; WheelStaticR.motorTorque = ((Vector3)(ref GM.CurrentMovementManager.m_smoothLocoVelocity)).magnitude * kickForceMul; WheelSteerL.motorTorque = ((Vector3)(ref GM.CurrentMovementManager.m_smoothLocoVelocity)).magnitude * kickForceMul; WheelSteerR.motorTorque = ((Vector3)(ref GM.CurrentMovementManager.m_smoothLocoVelocity)).magnitude * kickForceMul; kicked = true; } WheelSteerL.steerAngle = PlayerRef.transform.localPosition.x * SteerMul; WheelSteerR.steerAngle = PlayerRef.transform.localPosition.x * SteerMul; board.transform.localEulerAngles = new Vector3(PlayerRef.transform.localPosition.x * -73.3f, 0f, 0f); Fsus.transform.localEulerAngles = new Vector3(0f, PlayerRef.transform.localPosition.x * 100f, 0f); Rsus.transform.localEulerAngles = new Vector3(0f, PlayerRef.transform.localPosition.x * -100f, 0f); WheelStaticL.steerAngle = PlayerRef.transform.localPosition.x * (0f - SteerMul); WheelStaticR.steerAngle = PlayerRef.transform.localPosition.x * (0f - SteerMul); ((Component)GM.CurrentMovementManager).gameObject.transform.SetParent(ParentObj.transform); ((Component)GM.CurrentMovementManager).gameObject.transform.eulerAngles = new Vector3(0f, ((Component)GM.CurrentMovementManager).gameObject.transform.eulerAngles.y, 0f); } else if (PlayerRef.transform.localPosition.x > 2f * MaxX || PlayerRef.transform.localPosition.x < 2f * MinX || PlayerRef.transform.localPosition.y > 2f * MaxY || PlayerRef.transform.localPosition.y < 2f * MinY || PlayerRef.transform.localPosition.z > 2f * MaxZ || PlayerRef.transform.localPosition.z < 2f * MinZ) { if (kicked) { ((Component)GM.CurrentMovementManager).gameObject.transform.eulerAngles = new Vector3(0f, ((Component)GM.CurrentMovementManager).gameObject.transform.eulerAngles.y, 0f); ((Component)GM.CurrentMovementManager).gameObject.transform.SetParent((Transform)null); kicked = false; } WheelSteerL.steerAngle = 0f; WheelSteerR.steerAngle = 0f; WheelStaticL.steerAngle = 0f; WheelStaticR.steerAngle = 0f; Fsus.transform.localEulerAngles = new Vector3(0f, 0f, 0f); Rsus.transform.localEulerAngles = new Vector3(0f, 0f, 0f); board.transform.localEulerAngles = new Vector3(0f, 0f, 0f); } } } private void OnDestroy() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) Object.Destroy((Object)(object)navb); kicked = false; WheelSteerL.steerAngle = Mathf.Lerp(WheelSteerL.steerAngle, 0f, 0.1f); WheelSteerR.steerAngle = Mathf.Lerp(WheelSteerL.steerAngle, 0f, 0.1f); WheelStaticL.steerAngle = Mathf.Lerp(WheelStaticL.steerAngle, 0f, 0.1f); WheelStaticR.steerAngle = Mathf.Lerp(WheelStaticR.steerAngle, 0f, 0.1f); Fsus.transform.localEulerAngles = new Vector3(0f, Mathf.SmoothDamp(Fsus.transform.localEulerAngles.y, 0f, ref FY, 0.25f), 0f); Rsus.transform.localEulerAngles = new Vector3(0f, Mathf.SmoothDamp(Rsus.transform.localEulerAngles.y, 0f, ref RY, 0.25f), 0f); board.transform.localEulerAngles = new Vector3(Mathf.SmoothDamp(board.transform.localEulerAngles.x, 0f, ref BZ, 0.25f), 0f, 0f); ((Component)GM.CurrentMovementManager).gameObject.transform.SetParent((Transform)null); } } } namespace VolksScripts { public class WheelVisualSync : MonoBehaviour { public WheelCollider wheelCollider; public Transform wheelVisual; public Vector3 visualRotationOffset; public bool useLocalPose = false; private void Start() { if ((Object)(object)wheelCollider == (Object)null) { wheelCollider = ((Component)this).GetComponent(); } if ((Object)(object)wheelVisual == (Object)null) { wheelVisual = ((Component)this).transform; } } private void LateUpdate() { //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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b5: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)wheelCollider == (Object)null) && !((Object)(object)wheelVisual == (Object)null)) { Vector3 val = default(Vector3); Quaternion val2 = default(Quaternion); wheelCollider.GetWorldPose(ref val, ref val2); Quaternion val3 = Quaternion.Euler(visualRotationOffset); if (useLocalPose && (Object)(object)wheelVisual.parent != (Object)null) { wheelVisual.parent.InverseTransformPoint(val); wheelVisual.localPosition = wheelVisual.parent.InverseTransformPoint(val); wheelVisual.localRotation = Quaternion.Inverse(wheelVisual.parent.rotation) * val2 * val3; } else { wheelVisual.position = val; wheelVisual.rotation = val2 * val3; } } } } public class Stake : FVRPhysicalObject { [Header("Target matching")] [Tooltip("Case-insensitive substrings to match Sosig GameObject name.")] public string[] NameSubstrings = new string[2] { "zozig", "zosig" }; [Tooltip("Minimum collision relative velocity magnitude for effect to trigger")] public float MinCollisionVelocity = 1f; [Tooltip("If true, only trigger while this weapon is held")] public bool OnlyWhenHeld = true; [Header("Stun then kill")] [Tooltip("How long to stun the Zozig before killing it (seconds)")] public float StunDuration = 2f; [Tooltip("If true, also apply Confusion for the same duration (this is what shows the spinning icon above the Sosig head)")] public bool AlsoConfuse = true; [Tooltip("If true, also apply Shudder to knock the Sosig into ragdoll briefly")] public bool AlsoShudder = true; [Tooltip("Shudder intensity (higher = longer ragdoll recovery)")] public float ShudderAmount = 1.5f; [Tooltip("If true, attempt to lodge into the sosig link before/while stunned")] public bool AttemptLodge = true; [Tooltip("If true destroy this weapon after KillDestroyDelay seconds")] public bool DestroyWeaponAfter = true; [Tooltip("Delay before destroying this weapon after kill (seconds)")] public float KillDestroyDelay = 0.5f; [Header("Stun VFX")] [Tooltip("Optional particle prefab to spawn when stun is applied")] public GameObject StunVfxPrefab; [Tooltip("Delay in seconds before the stun VFX prefab is spawned after impact (0 = immediate)")] public float StunVfxDelay = 0f; [Tooltip("Optional transform on this weapon to use as the VFX spawn point and parent (e.g. the tip). If null, uses this weapon's transform.")] public Transform StunVfxSpawnPoint; [Tooltip("If > 0, auto-destroy the spawned VFX after this many seconds")] public float StunVfxLifetime = 5f; [Tooltip("Debug logging")] public bool DebugLogOnAction = false; [Header("Stab filter")] [Tooltip("If true, only trigger the stun/kill when the base melee system recognises this as a stab (MP.IsJointedToObject). Requires CanNewStab and stab colliders to be configured on this weapon.")] public bool RequireStab = true; private bool m_hasTriggered = false; private FixedJoint _createdLodgeJoint; private Transform _lodgeParentTransform; public override void OnCollisionEnter(Collision col) { //IL_0034: 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_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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).OnCollisionEnter(col); if (m_hasTriggered || (OnlyWhenHeld && !((FVRInteractiveObject)this).IsHeld)) { return; } Vector3 relativeVelocity = col.relativeVelocity; if (((Vector3)(ref relativeVelocity)).magnitude < MinCollisionVelocity) { return; } if (RequireStab && !base.MP.IsJointedToObject) { if (DebugLogOnAction) { Debug.Log((object)"Stake: RequireStab is true but MP.IsJointedToObject is false — ignoring collision."); } return; } ContactPoint[] contacts = col.contacts; for (int i = 0; i < contacts.Length; i++) { ContactPoint val = contacts[i]; Collider val2 = ((ContactPoint)(ref val)).otherCollider ?? ((ContactPoint)(ref val)).thisCollider ?? col.collider; if (!((Object)(object)val2 == (Object)null) && TryTriggerOnCollider(val2, col, ((ContactPoint)(ref val)).point, ((ContactPoint)(ref val)).normal)) { break; } } if (!m_hasTriggered && (Object)(object)col.collider != (Object)null) { Vector3 contactPoint = ((contacts.Length <= 0) ? col.collider.ClosestPoint(((Component)this).transform.position) : ((ContactPoint)(ref contacts[0])).point); Vector3 val3; if (contacts.Length > 0) { val3 = ((ContactPoint)(ref contacts[0])).normal; } else { Vector3 val4 = ((Component)this).transform.position - ((Component)col.collider).transform.position; val3 = ((Vector3)(ref val4)).normalized; } Vector3 contactNormal = val3; TryTriggerOnCollider(col.collider, col, contactPoint, contactNormal); } } private bool TryTriggerOnCollider(Collider hitCollider, Collision col, Vector3 contactPoint, Vector3 contactNormal) { //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hitCollider == (Object)null) { return false; } SosigLink componentInParent = ((Component)hitCollider).GetComponentInParent(); Sosig val = null; Rigidbody val2 = null; Transform linkTransform = null; if ((Object)(object)componentInParent != (Object)null) { val = componentInParent.S; val2 = componentInParent.R; linkTransform = ((Component)componentInParent).transform; } else { val = ((Component)hitCollider).GetComponentInParent(); if ((Object)(object)val != (Object)null) { SosigLink componentInChildren = ((Component)val).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { val2 = componentInChildren.R; linkTransform = ((Component)componentInChildren).transform; } } } if ((Object)(object)val == (Object)null) { return false; } string text = (((Object)((Component)val).gameObject).name ?? string.Empty).ToLowerInvariant(); bool flag = false; string[] nameSubstrings = NameSubstrings; foreach (string text2 in nameSubstrings) { if (!string.IsNullOrEmpty(text2) && text.IndexOf(text2.ToLowerInvariant(), StringComparison.Ordinal) >= 0) { flag = true; break; } } if (!flag) { return false; } m_hasTriggered = true; try { if ((Object)(object)GM.CurrentPlayerBody != (Object)null) { val.SetLastIFFDamageSource(GM.CurrentPlayerBody.GetPlayerIFF()); } } catch (Exception ex) { if (DebugLogOnAction) { Debug.LogWarning((object)("Stake: set IFF failed: " + ex)); } } if (contactPoint == Vector3.zero && (Object)(object)hitCollider != (Object)null) { contactPoint = hitCollider.ClosestPoint(((Component)this).transform.position); } if (contactNormal == Vector3.zero && (Object)(object)hitCollider != (Object)null) { Vector3 val3 = ((Component)this).transform.position - contactPoint; contactNormal = ((Vector3)(ref val3)).normalized; } try { val.Stun(StunDuration); if (DebugLogOnAction) { Debug.Log((object)("Stake: stunned '" + ((Object)((Component)val).gameObject).name + "' for " + StunDuration + "s")); } } catch (Exception ex2) { Debug.LogError((object)("Stake: stun exception: " + ex2)); } if (AlsoConfuse) { try { val.Confuse(StunDuration); if (DebugLogOnAction) { Debug.Log((object)("Stake: confused '" + ((Object)((Component)val).gameObject).name + "' for " + StunDuration + "s")); } } catch (Exception ex3) { if (DebugLogOnAction) { Debug.LogWarning((object)("Stake: confuse failed: " + ex3)); } } } if (AlsoShudder) { try { val.Shudder(ShudderAmount); if (DebugLogOnAction) { Debug.Log((object)("Stake: shuddered '" + ((Object)((Component)val).gameObject).name + "' with amount " + ShudderAmount)); } } catch (Exception ex4) { if (DebugLogOnAction) { Debug.LogWarning((object)("Stake: shudder failed: " + ex4)); } } } if ((Object)(object)StunVfxPrefab != (Object)null) { if (StunVfxDelay <= 0f) { SpawnStunVfxOnWeapon(); } else { ((MonoBehaviour)this).StartCoroutine(SpawnStunVfxOnWeaponDelayed(StunVfxDelay)); } } bool flag2 = false; if (AttemptLodge && (Object)(object)val2 != (Object)null) { try { flag2 = TryLodgeIntoTarget(val2, linkTransform, contactPoint, contactNormal); } catch (Exception ex5) { if (DebugLogOnAction) { Debug.LogWarning((object)("Stake: lodge failed: " + ex5)); } flag2 = false; } } ((MonoBehaviour)this).StartCoroutine(KillAfterDelayCoroutine(val, val2, linkTransform, contactPoint, contactNormal, StunDuration)); return true; } private void SpawnStunVfxOnWeapon() { //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_0050: 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) try { Transform val = ((!((Object)(object)StunVfxSpawnPoint != (Object)null)) ? ((Component)this).transform : StunVfxSpawnPoint); GameObject val2 = Object.Instantiate(StunVfxPrefab, val.position, val.rotation); val2.transform.SetParent(val, true); val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; if (StunVfxLifetime > 0f) { Object.Destroy((Object)(object)val2, StunVfxLifetime); } if (DebugLogOnAction) { Debug.Log((object)("Stake: VFX spawned on weapon at " + ((Object)val).name)); } } catch (Exception ex) { if (DebugLogOnAction) { Debug.LogWarning((object)("Stake: spawn stun vfx failed: " + ex)); } } } private IEnumerator SpawnStunVfxOnWeaponDelayed(float delay) { yield return (object)new WaitForSeconds(delay); if ((Object)(object)this != (Object)null && (Object)(object)((Component)this).gameObject != (Object)null) { SpawnStunVfxOnWeapon(); } } private IEnumerator KillAfterDelayCoroutine(Sosig sos, Rigidbody targetRB, Transform linkTransform, Vector3 contactPoint, Vector3 contactNormal, float delay) { //IL_0024: 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_002c: 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) if (delay > 0f) { yield return (object)new WaitForSeconds(delay); } if ((Object)(object)sos == (Object)null) { yield break; } if (AttemptLodge && (Object)(object)targetRB != (Object)null && (Object)(object)_createdLodgeJoint == (Object)null) { try { TryLodgeIntoTarget(targetRB, linkTransform, contactPoint, contactNormal); } catch { } } try { sos.SosigDies((DamageClass)3, (SosigDeathType)2); if (DebugLogOnAction) { Debug.Log((object)("Stake: killed '" + ((Object)((Component)sos).gameObject).name + "' after stun")); } } catch (Exception ex) { Debug.LogError((object)("Stake: kill exception: " + ex)); } if (DestroyWeaponAfter) { if (KillDestroyDelay <= 0f) { yield return null; TryRemoveLodgeJoint(); Object.Destroy((Object)(object)((Component)this).gameObject); } else { yield return (object)new WaitForSeconds(KillDestroyDelay); TryRemoveLodgeJoint(); Object.Destroy((Object)(object)((Component)this).gameObject); } } } private bool TryLodgeIntoTarget(Rigidbody targetRB, Transform linkTransform, Vector3 contactPoint, Vector3 contactNormal) { //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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_0148: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetRB == (Object)null) { return false; } if ((Object)(object)((FVRPhysicalObject)this).RootRigidbody == (Object)null) { if (DebugLogOnAction) { Debug.LogWarning((object)"Stake: no RootRigidbody to lodge with."); } return false; } if ((Object)(object)_createdLodgeJoint != (Object)null) { return true; } if (contactPoint != Vector3.zero) { ((Component)this).transform.position = contactPoint; } if (contactNormal != Vector3.zero) { ((Component)this).transform.rotation = Quaternion.LookRotation(-contactNormal, Vector3.up); } if ((Object)(object)linkTransform != (Object)null) { ((Component)this).transform.SetParent(linkTransform, true); _lodgeParentTransform = linkTransform; } try { _createdLodgeJoint = ((Component)targetRB).gameObject.AddComponent(); ((Joint)_createdLodgeJoint).enableCollision = false; ((Joint)_createdLodgeJoint).connectedBody = ((FVRPhysicalObject)this).RootRigidbody; } catch (Exception ex) { if (DebugLogOnAction) { Debug.LogWarning((object)("Stake: failed to create FixedJoint: " + ex)); } _createdLodgeJoint = null; return false; } try { ((FVRPhysicalObject)this).RootRigidbody.isKinematic = true; ((FVRPhysicalObject)this).RootRigidbody.velocity = Vector3.zero; ((FVRPhysicalObject)this).RootRigidbody.angularVelocity = Vector3.zero; } catch (Exception ex2) { if (DebugLogOnAction) { Debug.LogWarning((object)("Stake: couldn't set kinematic on RootRigidbody: " + ex2)); } } return true; } private void TryRemoveLodgeJoint() { if ((Object)(object)_createdLodgeJoint != (Object)null) { try { Object.Destroy((Object)(object)_createdLodgeJoint); _createdLodgeJoint = null; } catch { } } if (!((Object)(object)_lodgeParentTransform != (Object)null)) { return; } try { if ((Object)(object)((Component)this).transform != (Object)null && ((Component)this).transform.IsChildOf(_lodgeParentTransform)) { ((Component)this).transform.SetParent((Transform)null, true); } } catch { } _lodgeParentTransform = null; } } public class DestroyThenScale : MonoBehaviour { [Header("Target & Scaling")] [Tooltip("The GameObject whose scale will be increased when objects are destroyed. If left null, this GameObject will be used.")] public GameObject target; [Tooltip("The amount to add to the target's localScale each time an object is destroyed.")] public Vector3 scaleIncrement = new Vector3(0.1f, 0.1f, 0.1f); [Tooltip("If true, scaleIncrement's X/Y/Z will be applied uniformly using 'uniformScaleAmount' instead of the Vector3 above.")] public bool useUniformScale = false; [Tooltip("When useUniformScale is true, this value is added to each axis.")] public float uniformScaleAmount = 0.1f; [Header("Shrink Back (Optional)")] [Tooltip("If true, the target will slowly shrink back to its original scale after being increased.")] public bool shrinkBack = true; [Tooltip("How long (seconds) it should take to shrink back to the original scale. If 0 or negative, the shrink back is instant.")] public float shrinkBackDuration = 2f; [Tooltip("Optional delay (seconds) between the last increase and when shrinking begins.")] public float shrinkDelay = 0f; [Header("Audio (H3VR AudioEvent and/or Unity AudioClip)")] [Tooltip("Optional H3VR AudioEvent representing the 'destroy' sound.")] public AudioEvent destroyAudioEvent; [Tooltip("Fallback Unity AudioClip to play if AudioEvent is not used.")] public AudioClip destroyClip; [Tooltip("Volume for the fallback AudioClip playback (0..1).")] [Range(0f, 1f)] public float destroyClipVolume = 1f; [Tooltip("Random pitch variance applied to the fallback AudioClip (± value).")] [Range(0f, 0.5f)] public float randomPitchVariance = 0.05f; private Vector3 _originalScale; private Coroutine _shrinkCoroutine; private void Reset() { //IL_0011: 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) scaleIncrement = new Vector3(0.1f, 0.1f, 0.1f); uniformScaleAmount = 0.1f; shrinkBack = true; shrinkBackDuration = 2f; shrinkDelay = 0f; destroyClipVolume = 1f; randomPitchVariance = 0.05f; } private void Start() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null) { target = ((Component)this).gameObject; } _originalScale = target.transform.localScale; } private void OnValidate() { if (shrinkBackDuration < 0f) { shrinkBackDuration = 0f; } if (shrinkDelay < 0f) { shrinkDelay = 0f; } if (destroyClipVolume < 0f) { destroyClipVolume = 0f; } if (destroyClipVolume > 1f) { destroyClipVolume = 1f; } } private void OnTriggerEnter(Collider other) { HandleCandidateCollider(other); } private void HandleCandidateCollider(Collider col) { //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)col == (Object)null || ((Object)(object)GM.CurrentPlayerBody != (Object)null && ((Component)col).transform.IsChildOf(((Component)GM.CurrentPlayerBody).transform)) || (Object)(object)((Component)col).GetComponentInParent() != (Object)null) { return; } GameObject val = ((!((Object)(object)col.attachedRigidbody != (Object)null)) ? ((Component)col).gameObject : ((Component)col.attachedRigidbody).gameObject); if ((Object)(object)val == (Object)null || (Object)(object)target == (Object)null || (Object)(object)val == (Object)(object)target || (Object)(object)val == (Object)(object)((Component)this).gameObject) { return; } FVRPhysicalObject component = val.GetComponent(); if ((Object)(object)component != (Object)null) { if (!((Object)(object)component.QuickbeltSlot != (Object)null) && !component.m_isHardnessed && !((Object)(object)((Component)component).transform.parent != (Object)null) && !((Object)(object)((Component)((Component)component).transform).GetComponent() != (Object)null)) { ApplyScaleIncrease(); PlayDestroySound(val.transform.position); if (!((FVRInteractiveObject)component).IsHeld) { Object.Destroy((Object)(object)((Component)component).gameObject); return; } ((FVRInteractiveObject)component).ForceBreakInteraction(); Object.Destroy((Object)(object)((Component)component).gameObject); } } else { ApplyScaleIncrease(); PlayDestroySound(val.transform.position); Object.Destroy((Object)(object)val); } } private void ApplyScaleIncrease() { //IL_0022: 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_0017: 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_0044: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((!useUniformScale) ? scaleIncrement : (Vector3.one * uniformScaleAmount)); target.transform.localScale = target.transform.localScale + val; if (shrinkBack) { if (_shrinkCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_shrinkCoroutine); } _shrinkCoroutine = ((MonoBehaviour)this).StartCoroutine(ShrinkBackCoroutine()); } } private IEnumerator ShrinkBackCoroutine() { if (shrinkDelay > 0f) { yield return (object)new WaitForSeconds(shrinkDelay); } if (shrinkBackDuration <= 0f) { target.transform.localScale = _originalScale; _shrinkCoroutine = null; yield break; } Vector3 startScale = target.transform.localScale; float elapsed = 0f; while (elapsed < shrinkBackDuration) { elapsed += Time.deltaTime; float t = Mathf.Clamp01(elapsed / shrinkBackDuration); target.transform.localScale = Vector3.Lerp(startScale, _originalScale, t); yield return null; } target.transform.localScale = _originalScale; _shrinkCoroutine = null; } private void PlayDestroySound(Vector3 position) { //IL_0014: 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_0074: Expected O, but got Unknown //IL_007a: 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) if (destroyAudioEvent != null) { try { SM.PlayGenericSound(destroyAudioEvent, position); return; } catch { } } if ((Object)(object)destroyClip != (Object)null) { if (Mathf.Approximately(randomPitchVariance, 0f)) { AudioSource.PlayClipAtPoint(destroyClip, position, destroyClipVolume); return; } GameObject val = new GameObject("TempDestroySound"); val.transform.position = position; AudioSource val2 = val.AddComponent(); val2.clip = destroyClip; val2.spatialBlend = 1f; val2.volume = destroyClipVolume; float num2 = (val2.pitch = 1f + Random.Range(0f - randomPitchVariance, randomPitchVariance)); val2.Play(); float num3 = ((!(destroyClip.length > 0f)) ? 1f : (destroyClip.length / Mathf.Abs(num2))); Object.Destroy((Object)(object)val, num3 + 0.1f); } } } } public class GrenadeEmissionController : MonoBehaviour { [Tooltip("If left empty, will try to find an FVRCappedGrenade in parents.")] public FVRCappedGrenade grenade; [Tooltip("Renderers whose materials' emission will be animated.")] public Renderer[] renderers; public Color emissionColor = Color.red; [Tooltip("Final emission intensity multiplier (0..n). Use values > 1 for bloom glow.")] public float maxIntensity = 3f; [Tooltip("Seconds to ramp emission from 0 to maxIntensity.")] public float duration = 1f; [Tooltip("If true, ignores grenade state and triggers immediately on Start. Useful for testing.")] public bool triggerOnStart = false; [Tooltip("Logs diagnostic info to the console. Disable after confirming it works.")] public bool debugMode = true; private bool m_started = false; private Material[] m_materialInstances; private float m_debugLogTimer = 0f; private const float k_debugLogInterval = 1f; private void Start() { //IL_0248: Unknown result type (might be due to invalid IL or missing references) Log("Start called."); if ((Object)(object)grenade == (Object)null) { grenade = ((Component)this).GetComponentInParent(); if ((Object)(object)grenade != (Object)null) { Log("Found FVRCappedGrenade on parent: " + ((Object)((Component)grenade).gameObject).name); } else { LogWarn("No FVRCappedGrenade found in parents and none assigned. Emission will never trigger unless triggerOnStart is true."); } } else { Log("FVRCappedGrenade assigned manually: " + ((Object)((Component)grenade).gameObject).name); } if (renderers == null || renderers.Length == 0) { Renderer component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { renderers = (Renderer[])(object)new Renderer[1] { component }; Log("No renderers assigned — using Renderer on this GameObject: " + ((Object)component).name); } else { LogWarn("No renderers assigned and no Renderer found on this GameObject. Nothing will glow."); } } else { Log("Renderers assigned in Inspector: " + renderers.Length + " renderer(s)."); } if (renderers != null && renderers.Length > 0) { m_materialInstances = (Material[])(object)new Material[renderers.Length]; for (int i = 0; i < renderers.Length; i++) { if ((Object)(object)renderers[i] == (Object)null) { LogWarn("Renderer at index " + i + " is null — skipping."); continue; } Material material = renderers[i].material; Log("Renderer[" + i + "] (" + ((Object)renderers[i]).name + ") — shader: " + ((Object)material.shader).name); if (!material.HasProperty("_EmissionColor")) { LogWarn("Renderer[" + i + "] material '" + ((Object)material).name + "' does not have _EmissionColor. This shader does not support emission via this script. Use the Standard shader."); } material.EnableKeyword("_EMISSION"); material.SetColor("_EmissionColor", Color.black); m_materialInstances[i] = material; Log("Renderer[" + i + "] material instance created and emission zeroed."); } } if (triggerOnStart) { Log("triggerOnStart is true — starting emission ramp immediately."); m_started = true; ((MonoBehaviour)this).StartCoroutine(LerpEmission(0f, maxIntensity, duration)); } else { Log("Waiting for grenade cap conditions in Update."); } } private void Update() { if (m_started || (Object)(object)grenade == (Object)null) { return; } bool flag; if (grenade.UsesSecondaryCap) { flag = grenade.IsPrimaryCapRemoved && grenade.IsSecondaryCapRemoved; m_debugLogTimer -= Time.deltaTime; if (debugMode && m_debugLogTimer <= 0f) { m_debugLogTimer = 1f; Debug.Log((object)("[GrenadeEmission] UsesSecondaryCap=true | IsPrimaryCapRemoved=" + grenade.IsPrimaryCapRemoved + " | IsSecondaryCapRemoved=" + grenade.IsSecondaryCapRemoved), (Object)(object)this); } } else { flag = grenade.IsPrimaryCapRemoved; m_debugLogTimer -= Time.deltaTime; if (debugMode && m_debugLogTimer <= 0f) { m_debugLogTimer = 1f; Debug.Log((object)("[GrenadeEmission] UsesSecondaryCap=false | IsPrimaryCapRemoved=" + grenade.IsPrimaryCapRemoved), (Object)(object)this); } } if (flag) { Log("Cap condition met — starting emission ramp."); m_started = true; ((MonoBehaviour)this).StartCoroutine(LerpEmission(0f, maxIntensity, duration)); } } private IEnumerator LerpEmission(float from, float to, float dur) { Log("LerpEmission started — from " + from + " to " + to + " over " + dur + "s."); float t = 0f; while (t < dur) { t += Time.deltaTime; float v = Mathf.Lerp(from, to, (!(dur <= 0f)) ? (t / dur) : 1f); ApplyEmission(v); yield return null; } ApplyEmission(to); Log("LerpEmission complete — final intensity: " + to + " | final color: " + emissionColor * to); } private void ApplyEmission(float intensity) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (m_materialInstances == null) { return; } Color val = emissionColor * intensity; for (int i = 0; i < m_materialInstances.Length; i++) { if (!((Object)(object)m_materialInstances[i] == (Object)null)) { m_materialInstances[i].SetColor("_EmissionColor", val); } } } private void OnDestroy() { if (m_materialInstances == null) { return; } for (int i = 0; i < m_materialInstances.Length; i++) { if ((Object)(object)m_materialInstances[i] != (Object)null) { Object.Destroy((Object)(object)m_materialInstances[i]); } } } private void Log(string msg) { if (debugMode) { Debug.Log((object)("[GrenadeEmission] " + msg), (Object)(object)this); } } private void LogWarn(string msg) { Debug.LogWarning((object)("[GrenadeEmission] " + msg), (Object)(object)this); } } namespace GravyScripts.Components { public class AttachableFlammenwerfer : AttachableFirearm { [Header("FlameThrower Params")] public FlameThrowerValve Valve; public bool UsesValve = true; public MF2_FlamethrowerValve MF2Valve; public bool UsesMF2Valve; [Header("Trigger Config")] public Transform Trigger; public float TriggerFiringThreshold = 0.8f; public float Trigger_ForwardValue; public float Trigger_RearwardValue; public InterpStyle TriggerInterpStyle = (InterpStyle)1; private float m_triggerFloat; [Header("Special Audio Config")] public AudioEvent AudEvent_Ignite; public AudioEvent AudEvent_Extinguish; public AudioSource AudSource_FireLoop; private float m_triggerHasBeenHeldFor; private bool m_hasFiredStartSound; private bool m_isFiring; public ParticleSystem FireParticles; public Vector2 FireWidthRange; public Vector2 SpeedRangeMin; public Vector2 SpeedRangeMax; public Vector2 SizeRangeMin; public Vector2 SizeRangeMax; public Vector2 AudioPitchRange = new Vector2(1.5f, 0.5f); public float ParticleVolume = 40f; public bool UsesPilotLightSystem; public bool UsesAirBlastSystem; [Header("PilotLight")] public Transform PilotLight; private bool m_isPilotLightOn; public AudioEvent AudEvent_PilotOn; [Header("Airblast")] public bool UsesAirBlast; public Transform AirBlastCenter; public GameObject AirBlastGo; private float m_airBurstRecovery; public override void Awake() { ((AttachableFirearm)this).Awake(); if (UsesPilotLightSystem) { ((Component)PilotLight).gameObject.SetActive(false); } } private float GetVLerp() { if (UsesValve) { return Valve.ValvePos; } if (UsesMF2Valve) { return MF2Valve.Lerp; } return 0.5f; } public override void Update() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) ((AttachableFirearm)this).Update(); UpdateFire(); if (!UsesPilotLightSystem) { return; } if ((Object)(object)base.Magazine != (Object)null && base.Magazine.FuelAmountLeft > 0f) { if (!m_isPilotLightOn) { PilotOn(); } } else if (m_isPilotLightOn) { PilotOff(); } if (m_isPilotLightOn) { PilotLight.localScale = Vector3.one + Random.onUnitSphere * 0.05f; } } private void PilotOn() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) m_isPilotLightOn = true; if (AudEvent_PilotOn != null && (Object)(object)((AttachableFirearm)this).GetMuzzle() != (Object)null) { SM.PlayCoreSound((FVRPooledAudioType)10, AudEvent_PilotOn, ((AttachableFirearm)this).GetMuzzle().position); } ((Component)PilotLight).gameObject.SetActive(true); } private void PilotOff() { m_isPilotLightOn = false; ((Component)PilotLight).gameObject.SetActive(false); } private void AirBlast() { //IL_000d: 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) GameObject val = Object.Instantiate(AirBlastGo, AirBlastCenter.position, AirBlastCenter.rotation); val.GetComponent().IFF = GM.CurrentPlayerBody.GetPlayerIFF(); val.GetComponent().IFF = GM.CurrentPlayerBody.GetPlayerIFF(); } public void UpdateFire() { //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_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_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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) EmissionModule emission = FireParticles.emission; MinMaxCurve rateOverTime = ((EmissionModule)(ref emission)).rateOverTime; if (m_isFiring) { ((MinMaxCurve)(ref rateOverTime)).mode = (ParticleSystemCurveMode)0; ((MinMaxCurve)(ref rateOverTime)).constantMax = ParticleVolume; ((MinMaxCurve)(ref rateOverTime)).constantMin = ParticleVolume; float vLerp = GetVLerp(); MainModule main = FireParticles.main; MinMaxCurve startSpeed = ((MainModule)(ref main)).startSpeed; ((MinMaxCurve)(ref startSpeed)).mode = (ParticleSystemCurveMode)3; ((MinMaxCurve)(ref startSpeed)).constantMax = Mathf.Lerp(SpeedRangeMax.x, SpeedRangeMax.y, vLerp); ((MinMaxCurve)(ref startSpeed)).constantMin = Mathf.Lerp(SpeedRangeMin.x, SpeedRangeMin.y, vLerp); ((MainModule)(ref main)).startSpeed = startSpeed; MinMaxCurve startSize = ((MainModule)(ref main)).startSize; ((MinMaxCurve)(ref startSize)).mode = (ParticleSystemCurveMode)3; ((MinMaxCurve)(ref startSize)).constantMax = Mathf.Lerp(SizeRangeMax.x, SizeRangeMax.y, vLerp); ((MinMaxCurve)(ref startSize)).constantMin = Mathf.Lerp(SizeRangeMin.x, SizeRangeMin.y, vLerp); ((MainModule)(ref main)).startSize = startSize; ShapeModule shape = FireParticles.shape; ((ShapeModule)(ref shape)).angle = Mathf.Lerp(FireWidthRange.x, FireWidthRange.y, vLerp); } else { ((MinMaxCurve)(ref rateOverTime)).mode = (ParticleSystemCurveMode)0; ((MinMaxCurve)(ref rateOverTime)).constantMax = 0f; ((MinMaxCurve)(ref rateOverTime)).constantMin = 0f; } ((EmissionModule)(ref emission)).rateOverTime = rateOverTime; } private bool HasFuel() { return !((Object)(object)base.Magazine == (Object)null) && base.Magazine.FuelAmountLeft > 0f; } private void StopFiring() { if (m_isFiring && (Object)(object)AudSource_FireLoop != (Object)null) { AudSource_FireLoop.Stop(); AudSource_FireLoop.volume = 0f; } m_isFiring = false; m_hasFiredStartSound = false; } public override void ProcessInput(FVRViveHand hand, bool fromInterface, FVRInteractiveObject o) { //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Invalid comparison between Unknown and I4 //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: 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) ((AttachableFirearm)this).ProcessInput(hand, fromInterface, o); if ((Object)(object)o == (Object)null || (Object)(object)hand == (Object)null) { return; } if (o.IsHeld) { if (o.m_hasTriggeredUpSinceBegin) { m_triggerFloat = hand.Input.TriggerFloat; } else { m_triggerFloat = 0f; } if (UsesAirBlast && m_airBurstRecovery <= 0f && HasFuel() && ((hand.IsInStreamlinedMode && hand.Input.BYButtonDown) || (!hand.IsInStreamlinedMode && hand.Input.TouchpadDown))) { m_airBurstRecovery = 1f; AirBlast(); if ((Object)(object)base.Magazine != (Object)null) { base.Magazine.DrainFuel(5f); if (!m_hasFiredStartSound) { m_hasFiredStartSound = true; if (AudEvent_Ignite != null && (Object)(object)((AttachableFirearm)this).GetMuzzle() != (Object)null) { SM.PlayCoreSound((FVRPooledAudioType)10, AudEvent_Ignite, ((AttachableFirearm)this).GetMuzzle().position); } } } } if (m_airBurstRecovery > 0f) { m_airBurstRecovery -= Time.deltaTime; } if (m_triggerFloat > 0.2f && HasFuel() && m_airBurstRecovery <= 0f) { if (m_triggerHasBeenHeldFor < 2f) { m_triggerHasBeenHeldFor += Time.deltaTime; } m_isFiring = true; if (!m_hasFiredStartSound) { m_hasFiredStartSound = true; if (AudEvent_Ignite != null && (Object)(object)((AttachableFirearm)this).GetMuzzle() != (Object)null) { SM.PlayCoreSound((FVRPooledAudioType)10, AudEvent_Ignite, ((AttachableFirearm)this).GetMuzzle().position); } } if ((Object)(object)AudSource_FireLoop != (Object)null) { float volume = Mathf.Clamp(m_triggerHasBeenHeldFor * 2f, 0f, 0.4f); AudSource_FireLoop.volume = volume; float vLerp = GetVLerp(); AudSource_FireLoop.pitch = Mathf.Lerp(AudioPitchRange.x, AudioPitchRange.y, vLerp); if (!AudSource_FireLoop.isPlaying) { AudSource_FireLoop.Play(); } } if ((Object)(object)base.Magazine != (Object)null) { base.Magazine.DrainFuel(Time.deltaTime); } } else { m_triggerHasBeenHeldFor = 0f; StopFiring(); } } else { m_triggerFloat = 0f; } if (m_triggerFloat <= 0f) { StopFiring(); } if ((Object)(object)Trigger != (Object)null) { if ((int)TriggerInterpStyle == 0) { Trigger.localPosition = new Vector3(0f, 0f, Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat)); } else if ((int)TriggerInterpStyle == 1) { Trigger.localEulerAngles = new Vector3(Mathf.Lerp(Trigger_ForwardValue, Trigger_RearwardValue, m_triggerFloat), 0f, 0f); } } } } } public class UBFlameTankRelease : FVRInteractiveObject { public AttachableFirearm AFireArm; public override bool IsInteractable() { return (Object)(object)AFireArm != (Object)null && (Object)(object)AFireArm.Magazine != (Object)null; } public override void BeginInteraction(FVRViveHand hand) { if (!((Object)(object)AFireArm == (Object)null) && (Object)(object)AFireArm.Magazine != (Object)null) { FVRFireArmMagazine magazine = AFireArm.Magazine; AFireArm.EjectMag(false); hand.ForceSetInteractable((FVRInteractiveObject)(object)magazine); ((FVRInteractiveObject)magazine).BeginInteraction(hand); } } } namespace FistVR { public class UnderbarrelMagLatch : MonoBehaviour { public AttachableFirearm AttachableFireArm; public HingeJoint Joint; public float Threshold = -35f; private float timeSinceLastCollision = 6f; private void FixedUpdate() { if (timeSinceLastCollision < 5f) { timeSinceLastCollision += Time.deltaTime; } if ((Object)(object)AttachableFireArm.Magazine != (Object)null && timeSinceLastCollision < 0.03f && Joint.angle < Threshold) { AttachableFireArm.EjectMag(true); } } private void OnCollisionStay(Collision col) { Rigidbody attachedRigidbody = col.collider.attachedRigidbody; if ((Object)(object)attachedRigidbody != (Object)null && (Object)(object)attachedRigidbody != (Object)(object)((Component)AttachableFireArm).GetComponent()) { FVRPhysicalObject component = ((Component)attachedRigidbody).GetComponent(); if ((Object)(object)component != (Object)null && ((FVRInteractiveObject)component).IsHeld) { timeSinceLastCollision = 0f; } } } } } namespace VolksScripts { public class AttachableClosedBoltHandle : ClosedBoltHandle { public override void Awake() { ((ClosedBoltHandle)this).Awake(); AttachableClosedBoltWeapon componentInParent = ((Component)this).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { ClosedBoltWeapon componentInParent2 = ((Component)componentInParent).GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null) { base.Weapon = componentInParent2; } } else { ClosedBoltWeapon componentInParent3 = ((Component)this).GetComponentInParent(); if ((Object)(object)componentInParent3 != (Object)null) { base.Weapon = componentInParent3; } } } protected virtual void OnValidate() { if (!((Object)(object)base.Weapon == (Object)null)) { return; } AttachableClosedBoltWeapon componentInParent = ((Component)this).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { ClosedBoltWeapon componentInParent2 = ((Component)componentInParent).GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null) { base.Weapon = componentInParent2; } } else { ClosedBoltWeapon componentInParent3 = ((Component)this).GetComponentInParent(); if ((Object)(object)componentInParent3 != (Object)null) { base.Weapon = componentInParent3; } } } } public class AttachableClosedBoltHandleInstaller : MonoBehaviour { private void Start() { AttachableClosedBoltWeapon[] array = Object.FindObjectsOfType(); AttachableClosedBoltWeapon[] array2 = array; foreach (AttachableClosedBoltWeapon weapon in array2) { TryUpgradeHandle(weapon); } } private void TryUpgradeHandle(AttachableClosedBoltWeapon weapon) { if ((Object)(object)weapon == (Object)null) { return; } ClosedBoltHandle handle = weapon.Handle; if ((Object)(object)handle == (Object)null || handle is AttachableClosedBoltHandle) { return; } GameObject gameObject = ((Component)handle).gameObject; AttachableClosedBoltHandle attachableClosedBoltHandle = gameObject.AddComponent(); try { Type typeFromHandle = typeof(ClosedBoltHandle); FieldInfo[] fields = typeFromHandle.GetFields(BindingFlags.Instance | BindingFlags.Public); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { try { object value = fieldInfo.GetValue(handle); fieldInfo.SetValue(attachableClosedBoltHandle, value); } catch { } } weapon.Handle = (ClosedBoltHandle)(object)attachableClosedBoltHandle; Object.Destroy((Object)(object)handle); Debug.Log((object)("[AttachableClosedBoltHandleInstaller] Upgraded handle for weapon '" + ((Object)weapon).name + "'.")); } catch (Exception ex) { Debug.LogError((object)("[AttachableClosedBoltHandleInstaller] Failed to upgrade handle on '" + ((Object)weapon).name + "': " + ex)); } } } public class CigarCase : FVRPhysicalObject { private bool isOpen = false; private bool isTouching = false; private Vector2 initTouch = Vector2.zero; private Vector2 LastTouchPoint = Vector2.zero; public Transform CaseLid; public float openRotationX = 90f; public float openRotationY = 0f; public float openRotationZ = 0f; public float closeRotationX = 0f; public float closeRotationY = 0f; public float closeRotationZ = 0f; public float rotationSpeed = 5f; public AudioSource audioSource; public AudioClip openSound; public AudioClip closeSound; public GameObject objectToToggle; public List Dings; public int m_numDings; public CigarCaseTrigger cigarCaseTrigger; private Quaternion targetRotation; public override void Start() { //IL_0019: 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) CaseLid.localRotation = Quaternion.Euler(closeRotationX, closeRotationY, closeRotationZ); targetRotation = CaseLid.localRotation; } private void Update() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) CaseLid.localRotation = Quaternion.Lerp(CaseLid.localRotation, targetRotation, Time.deltaTime * rotationSpeed); } public override void UpdateInteraction(FVRViveHand hand) { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonDown || hand.Input.AXButtonDown) { ToggleLid(); } return; } if (hand.Input.TouchpadTouched && !isTouching && hand.Input.TouchpadAxes != Vector2.zero) { isTouching = true; initTouch = hand.Input.TouchpadAxes; } if (hand.Input.TouchpadTouchUp && isTouching) { isTouching = false; Vector2 lastTouchPoint = LastTouchPoint; float y = (lastTouchPoint - initTouch).y; if (y > 0.5f || y < -0.5f) { ToggleLid(); } initTouch = Vector2.zero; lastTouchPoint = Vector2.zero; } LastTouchPoint = hand.Input.TouchpadAxes; } private void ToggleLid() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) isOpen = !isOpen; targetRotation = ((!isOpen) ? Quaternion.Euler(closeRotationX, closeRotationY, closeRotationZ) : Quaternion.Euler(openRotationX, openRotationY, openRotationZ)); if (isOpen) { if ((Object)(object)audioSource != (Object)null && (Object)(object)openSound != (Object)null) { audioSource.PlayOneShot(openSound); } if ((Object)(object)objectToToggle != (Object)null) { objectToToggle.SetActive(true); } Open(); } else { if ((Object)(object)audioSource != (Object)null && (Object)(object)closeSound != (Object)null) { audioSource.PlayOneShot(closeSound); } if ((Object)(object)objectToToggle != (Object)null) { objectToToggle.SetActive(false); } Close(); } } public bool IsOpen() { return isOpen; } public bool HasADing() { return m_numDings > 0; } public override void FVRUpdate() { ((FVRPhysicalObject)this).FVRUpdate(); } public void Open() { isOpen = true; if ((Object)(object)audioSource != (Object)null && (Object)(object)openSound != (Object)null) { audioSource.PlayOneShot(openSound); } UpdateDingDisplay(); } public void Close() { isOpen = false; if ((Object)(object)audioSource != (Object)null && (Object)(object)closeSound != (Object)null) { audioSource.PlayOneShot(closeSound); } UpdateDingDisplay(); } public void RemoveDing() { if (m_numDings > 0) { m_numDings--; UpdateDingDisplay(); } } private void UpdateDingDisplay() { for (int i = 0; i < Dings.Count; i++) { if (i < m_numDings) { ((Component)Dings[i]).gameObject.SetActive(true); } else { ((Component)Dings[i]).gameObject.SetActive(false); } } } } } public class CigarCaseTrigger : FVRInteractiveObject { public CigarCase cigarCase; public GameObject cigarPrefab; public override bool IsInteractable() { return cigarCase.HasADing() && ((FVRInteractiveObject)this).IsInteractable(); } public override void BeginInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); } public override void SimpleInteraction(FVRViveHand hand) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).SimpleInteraction(hand); if (cigarCase.IsOpen()) { cigarCase.RemoveDing(); GameObject val = Object.Instantiate(cigarPrefab, ((HandInput)(ref hand.Input)).Pos, ((HandInput)(ref hand.Input)).Rot); FVRPhysicalObject component = val.GetComponent(); hand.ForceSetInteractable((FVRInteractiveObject)(object)component); ((FVRInteractiveObject)component).BeginInteraction(hand); } else { cigarCase.Open(); } } } public class FVRCigar : QBArmorHelmet { public GameObject FireGO; public GameObject LinkedObject; public AudioSource fireAud; public float BurnDuration = 120f; public float DestructionDelay = 10f; public MeshFilter cigarMeshFilter; public MeshRenderer cigarRenderer; public Mesh burntMesh; public Material burntMaterial; public float damageInterval = 1f; private float damageTimer = 0f; private bool m_isBurning = false; private bool m_hasBeenLit = false; private float m_burnTimer; private bool m_isEquipped = false; private float m_unequippedTimer = 0f; private bool m_hasBurntOut = false; private FVRPlayerBody playerBody; public float damageAmount = 1f; public override void Awake() { ((QBArmorHelmet)this).Awake(); if ((Object)(object)FireGO != (Object)null) { fireAud = FireGO.GetComponent(); FireGO.SetActive(false); } if ((Object)(object)LinkedObject != (Object)null) { LinkedObject.SetActive(false); } playerBody = Object.FindObjectOfType(); } public override void FVRUpdate() { ((QBArmorPiece)this).FVRUpdate(); if (m_isBurning) { m_burnTimer -= Time.deltaTime; if ((Object)(object)fireAud != (Object)null) { fireAud.volume = Mathf.Lerp(fireAud.volume, 0f, Time.deltaTime / BurnDuration); } if (m_burnTimer <= 0f) { StopBurning(); } if (m_isEquipped && (Object)(object)playerBody != (Object)null) { damageTimer += Time.deltaTime; if (damageTimer >= damageInterval) { playerBody.RegisterPlayerHit(1f, false, playerBody.GetPlayerIFF()); damageTimer = 0f; } } } if (m_hasBurntOut && !m_isEquipped && !((FVRInteractiveObject)this).IsHeld) { m_unequippedTimer += Time.deltaTime; if (m_unequippedTimer >= DestructionDelay) { Debug.Log((object)"Cigar destroyed after being unequipped and left alone."); Object.Destroy((Object)(object)((Component)this).gameObject); } } else { m_unequippedTimer = 0f; } } public void Ignite() { if (!m_hasBeenLit) { m_hasBeenLit = true; m_isBurning = true; m_burnTimer = BurnDuration; if ((Object)(object)FireGO != (Object)null) { FireGO.SetActive(true); } if ((Object)(object)fireAud != (Object)null) { fireAud.Play(); } if ((Object)(object)LinkedObject != (Object)null) { LinkedObject.SetActive(true); } } } private void StopBurning() { m_isBurning = false; m_hasBurntOut = true; if ((Object)(object)FireGO != (Object)null) { FireGO.SetActive(false); } if ((Object)(object)fireAud != (Object)null) { fireAud.Stop(); } if ((Object)(object)cigarMeshFilter != (Object)null && (Object)(object)burntMesh != (Object)null) { cigarMeshFilter.mesh = burntMesh; } if ((Object)(object)cigarRenderer != (Object)null && (Object)(object)burntMaterial != (Object)null) { ((Renderer)cigarRenderer).material = burntMaterial; } Debug.Log((object)"Cigar has burnt out."); } public override void SetQuickBeltSlot(FVRQuickBeltSlot slot) { ((QBArmorHelmet)this).SetQuickBeltSlot(slot); if ((Object)(object)slot != (Object)null) { m_isEquipped = true; m_unequippedTimer = 0f; } else { m_isEquipped = false; } } } namespace VolksScripts { public class MatchStick : FVRPhysicalObject { private bool m_isLit; private bool m_hasBurntOut; private bool isTouching; private Vector2 initTouch = Vector2.zero; private Vector2 LastTouchPoint = Vector2.zero; public Transform Flame; private float m_flame_min = 0.1f; private float m_flame_max = 0.85f; private float m_flame_cur = 0.1f; public AudioSource Audio_Lighter; public AudioClip AudioClip_Strike; public AudioClip AudioClip_Extinguish; public Transform[] FlameJoints; public float[] FlameWeights; public ParticleSystem Sparks; public AlloyAreaLight AlloyLight; public LayerMask LM_FireDamage; private RaycastHit m_hit; public float BurnDuration = 10f; private float burnTimer = 0f; public float DestructionDelay = 5f; private float destructionTimer = 0f; public MeshFilter matchstickMeshFilter; public MeshRenderer matchstickRenderer; public Mesh burntMesh; public Material burntMaterial; public override void UpdateInteraction(FVRViveHand hand) { //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); if (hand.IsInStreamlinedMode) { if ((hand.Input.BYButtonDown || hand.Input.AXButtonDown) && !m_hasBurntOut) { Light(); } return; } if (hand.Input.TouchpadTouched && !isTouching && hand.Input.TouchpadAxes != Vector2.zero) { isTouching = true; initTouch = hand.Input.TouchpadAxes; } if (hand.Input.TouchpadTouchUp && isTouching) { isTouching = false; Vector2 lastTouchPoint = LastTouchPoint; float y = (lastTouchPoint - initTouch).y; if ((y > 0.5f || y < -0.5f) && !m_hasBurntOut) { Light(); } initTouch = Vector2.zero; lastTouchPoint = Vector2.zero; } LastTouchPoint = hand.Input.TouchpadAxes; } public override void FVRUpdate() { //IL_00e8: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_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_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0228: 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_02a6: Expected O, but got Unknown //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).FVRUpdate(); if (m_isLit) { burnTimer += Time.deltaTime; if (burnTimer >= BurnDuration) { BurnOut(); } m_flame_cur = Mathf.Lerp(m_flame_cur, m_flame_max, Time.deltaTime * 2f); AlloyLight.Intensity = m_flame_cur * (Mathf.PerlinNoise(Time.time * 10f, ((Component)AlloyLight).transform.position.y) * 0.05f + 0.5f); } else { m_flame_cur = Mathf.Lerp(m_flame_cur, m_flame_min, Time.deltaTime * 7f); } Flame.localScale = new Vector3(m_flame_cur, m_flame_cur, m_flame_cur); Quaternion val = Quaternion.Inverse(((Component)this).transform.rotation); val = Quaternion.Slerp(val, Random.rotation, Mathf.PerlinNoise(Time.time * 5f, 0f) * 0.3f); for (int i = 0; i < FlameJoints.Length; i++) { Quaternion val2 = Quaternion.Slerp(Quaternion.identity, val, FlameWeights[i] + Random.Range(-0.05f, 0.05f)); FlameJoints[i].localScale = new Vector3(Random.Range(0.95f, 1.05f), Random.Range(0.98f, 1.02f), Random.Range(0.95f, 1.05f)); FlameJoints[i].localRotation = Quaternion.Slerp(FlameJoints[i].localRotation, val2, Time.deltaTime * 6f); } if (m_isLit) { Vector3 position = FlameJoints[0].position; Vector3 position2 = FlameJoints[FlameJoints.Length - 1].position; Vector3 val3 = position2 - position; if (Physics.Raycast(position, ((Vector3)(ref val3)).normalized, ref m_hit, ((Vector3)(ref val3)).magnitude, LayerMask.op_Implicit(LM_FireDamage), (QueryTriggerInteraction)2)) { IFVRDamageable component = ((Component)((RaycastHit)(ref m_hit)).collider).gameObject.GetComponent(); if (component == null && (Object)(object)((RaycastHit)(ref m_hit)).collider.attachedRigidbody != (Object)null) { component = ((Component)((RaycastHit)(ref m_hit)).collider.attachedRigidbody).gameObject.GetComponent(); } if (component != null) { IFVRDamageable obj = component; Damage val4 = new Damage(); val4.Class = (DamageClass)2; val4.Dam_Thermal = 50f; val4.Dam_TotalEnergetic = 50f; val4.point = ((RaycastHit)(ref m_hit)).point; val4.hitNormal = ((RaycastHit)(ref m_hit)).normal; val4.strikeDir = ((Component)this).transform.forward; obj.Damage(val4); } FVRIgnitable component2 = ((Component)((Component)((RaycastHit)(ref m_hit)).collider).transform).gameObject.GetComponent(); if ((Object)(object)component2 == (Object)null && (Object)(object)((RaycastHit)(ref m_hit)).collider.attachedRigidbody != (Object)null) { ((Component)((RaycastHit)(ref m_hit)).collider.attachedRigidbody).gameObject.GetComponent(); } if ((Object)(object)component2 != (Object)null) { FXM.Ignite(component2, 0.1f); } } } if (m_hasBurntOut && !((FVRInteractiveObject)this).IsHeld) { destructionTimer += Time.deltaTime; if (destructionTimer >= DestructionDelay) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } public override void EndInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).EndInteraction(hand); if (m_hasBurntOut) { destructionTimer = 0f; } } private void Light() { if (!m_isLit && !m_hasBurntOut) { Sparks.Emit(Random.Range(2, 3)); m_isLit = true; burnTimer = 0f; Audio_Lighter.PlayOneShot(AudioClip_Strike, 0.3f); ((Component)Flame).gameObject.SetActive(true); } } private void BurnOut() { m_isLit = false; m_hasBurntOut = true; Audio_Lighter.PlayOneShot(AudioClip_Extinguish, 0.3f); ((Component)Flame).gameObject.SetActive(false); if ((Object)(object)matchstickMeshFilter != (Object)null && (Object)(object)burntMesh != (Object)null) { matchstickMeshFilter.mesh = burntMesh; } if ((Object)(object)matchstickRenderer != (Object)null && (Object)(object)burntMaterial != (Object)null) { ((Renderer)matchstickRenderer).material = burntMaterial; } destructionTimer = 0f; } } public class Multiround : FVRInteractiveObject { [Header("FireArm Chamber Config")] public FVRFireArm Firearm; public FVRFirearmAudioSet OverrideAudioSet; [Header("Chamber Params")] public bool IsManuallyExtractable = true; public bool IsManuallyChamberable = true; public float ChamberVelocityMultiplier = 1f; [Header("Chamber State")] public bool IsAccessible = true; public bool IsFull; public bool IsSpent; [Header("Proxy Stuff")] public GameObject LoadedPhys; public Transform ProxyRound; public MeshFilter ProxyMesh; public MeshRenderer ProxyRenderer; public GameObject ShowOnSpent; public GameObject ShowOnUnspent; [Header("Autochamber (template-driven, no type checks)")] public bool DoesAutoChamber; public FVRFireArmRound AutoChamberTemplate; public FireArmRoundType RoundType = (FireArmRoundType)0; private FVRFireArmRound _round; private ObjectTemperature geoTemp; private bool _usesShotOnSpent; private bool _usesShotOnUnspent; public FVRFireArmRound GetRound() { return _round; } [ContextMenu("checkmult")] public void CheckMult() { if (ChamberVelocityMultiplier != 1f) { Debug.Log((object)(((Object)((Component)((Component)this).transform.root).gameObject).name + " has mult of " + ChamberVelocityMultiplier)); } } public override void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0035: 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_0055: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).Awake(); GameObject val = new GameObject("Proxy"); ProxyRound = val.transform; ProxyRound.SetParent(((Component)this).transform); ProxyRound.localPosition = Vector3.zero; ProxyRound.localEulerAngles = Vector3.zero; ProxyRound.localScale = Vector3.one; ProxyMesh = val.AddComponent(); ProxyRenderer = val.AddComponent(); geoTemp = ((Component)ProxyRound).gameObject.AddComponent(); geoTemp.renderers.Add((Renderer)(object)ProxyRenderer); if ((Object)(object)ShowOnSpent != (Object)null) { _usesShotOnSpent = true; } if ((Object)(object)ShowOnUnspent != (Object)null) { _usesShotOnUnspent = true; } } public override void Start() { ((FVRInteractiveObject)this).Start(); if (DoesAutoChamber) { AutochamberAny(AutoChamberTemplate); } } public override bool IsInteractable() { return IsManuallyExtractable && IsAccessible && IsFull; } public void AutochamberAny(FVRFireArmRound template) { //IL_0013: 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) if (!((Object)(object)template == (Object)null)) { GameObject gameObject = ((AnvilAsset)AM.GetRoundSelfPrefab(template.RoundType, template.RoundClass)).GetGameObject(); SetRoundAny(gameObject.GetComponent(), animate: false); } } public void Unload() { SetRoundAny(null, animate: false); } public void SetRoundAny(FVRFireArmRound round, bool animate) { ApplyRound(round); } public void UpdateProxyDisplay() { //IL_0100: 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_0126: 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_00d4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_round == (Object)null) { ProxyMesh.mesh = null; ((Renderer)ProxyRenderer).material = null; ((Renderer)ProxyRenderer).enabled = false; if (_usesShotOnSpent) { ShowOnSpent.SetActive(false); } if (_usesShotOnUnspent) { ShowOnUnspent.SetActive(false); } return; } if (IsSpent) { if ((Object)(object)_round.FiredRenderer != (Object)null) { ProxyMesh.mesh = ((Component)_round.FiredRenderer).gameObject.GetComponent().sharedMesh; ((Renderer)ProxyRenderer).material = _round.FiredRenderer.sharedMaterial; geoTemp.thermalIntensityProfile = (ThermalProfile)8; } else { ProxyMesh.mesh = null; } } else { ProxyMesh.mesh = AM.GetRoundMesh(_round.RoundType, _round.RoundClass); ((Renderer)ProxyRenderer).material = AM.GetRoundMaterial(_round.RoundType, _round.RoundClass); } ((Renderer)ProxyRenderer).enabled = true; if (IsSpent) { if (_usesShotOnSpent) { ShowOnSpent.SetActive(true); } if (_usesShotOnUnspent) { ShowOnUnspent.SetActive(false); } } else { if (_usesShotOnSpent) { ShowOnSpent.SetActive(false); } if (_usesShotOnUnspent) { ShowOnUnspent.SetActive(true); } } } public void PlayChamberingAudio() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Firearm != (Object)null) { Firearm.PlayAudioEvent((FirearmAudioEventType)42, 1f); } else if ((Object)(object)OverrideAudioSet != (Object)null) { SM.PlayCoreSound((FVRPooledAudioType)10, OverrideAudioSet.ChamberManual, ((Component)this).transform.position); } } private void ApplyRound(FVRFireArmRound round) { //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) if ((Object)(object)round != (Object)null) { IsFull = true; IsSpent = round.IsSpent; _round = ((AnvilAsset)AM.GetRoundSelfPrefab(round.RoundType, round.RoundClass)).GetGameObject().GetComponent(); if ((Object)(object)LoadedPhys != (Object)null) { LoadedPhys.SetActive(true); } } else { IsFull = false; IsSpent = false; _round = null; if ((Object)(object)LoadedPhys != (Object)null) { LoadedPhys.SetActive(false); } } UpdateProxyDisplay(); } } public class Shellholder : FVRInteractiveObject { [Header("Shellholder Config")] public bool IsManuallyExtractable; public bool IsAccessible; private FVRFireArmRound m_round; public bool IsFull; [Header("Proxy Display")] public Transform ProxyRound; public MeshFilter ProxyMesh; public MeshRenderer ProxyRenderer; private ObjectTemperature geoTemp; public FVRFireArmRound GetRound() { return m_round; } protected void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0035: 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_0055: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).Awake(); GameObject val = new GameObject("Proxy"); ProxyRound = val.transform; ProxyRound.SetParent(((Component)this).transform); ProxyRound.localPosition = Vector3.zero; ProxyRound.localEulerAngles = Vector3.zero; ProxyRound.localScale = Vector3.one; ProxyMesh = val.AddComponent(); ProxyRenderer = val.AddComponent(); geoTemp = ((Component)ProxyRound).gameObject.AddComponent(); geoTemp.renderers.Add((Renderer)(object)ProxyRenderer); } public void UpdateProxyDisplay() { if ((Object)(object)m_round == (Object)null) { ProxyMesh.mesh = null; ((Renderer)ProxyRenderer).material = null; ((Renderer)ProxyRenderer).enabled = false; return; } if ((Object)(object)m_round.FiredRenderer != (Object)null) { ProxyMesh.mesh = ((Component)m_round.FiredRenderer).gameObject.GetComponent().sharedMesh; ((Renderer)ProxyRenderer).material = m_round.FiredRenderer.sharedMaterial; } else { ProxyMesh.mesh = null; ((Renderer)ProxyRenderer).material = null; } ((Renderer)ProxyRenderer).enabled = true; } public void SetRound(FVRFireArmRound round) { if ((Object)(object)round == (Object)null) { Debug.LogWarning((object)"Attempting to set a null round in Shellholder."); } m_round = round; IsFull = (Object)(object)round != (Object)null; UpdateProxyDisplay(); } public void Unload() { SetRound(null); } public override void BeginInteraction(FVRViveHand hand) { if (IsManuallyExtractable && IsAccessible && IsFull) { FVRFireArmRound round = m_round; SetRound(null); if ((Object)(object)round != (Object)null) { ((FVRInteractiveObject)round).BeginInteraction(hand); hand.ForceSetInteractable((FVRInteractiveObject)(object)round); } } } private void OnTriggerEnter(Collider other) { FVRFireArmRound component = ((Component)other).GetComponent(); if ((Object)(object)component != (Object)null && !IsFull) { SetRound(component); Object.Destroy((Object)(object)((Component)component).gameObject); Debug.Log((object)"Round stored in shellholder (proxy only)."); } } } } public class TorchTrigger : MonoBehaviour { public FVRCigar Torch; public Collider collider; private void OnTriggerEnter(Collider col) { collider.enabled = false; ((Component)collider).gameObject.layer = LayerMask.NameToLayer("NoCol"); Torch.Ignite(); } } public class FVRSmokingPipe : QBArmorHelmet { public GameObject FireGO; public GameObject LinkedObject; public AudioSource fireAud; public float BurnDuration = 120f; private bool m_isBurning = false; private float m_burnTimer; [Header("Trigger Reset")] public GameObject RelightTrigger; public bool IsBurning => m_isBurning; public override void Awake() { ((QBArmorHelmet)this).Awake(); if ((Object)(object)FireGO != (Object)null) { FireGO.SetActive(false); } if ((Object)(object)LinkedObject != (Object)null) { LinkedObject.SetActive(false); } } public override void FVRUpdate() { ((QBArmorPiece)this).FVRUpdate(); if (m_isBurning) { m_burnTimer -= Time.deltaTime; if (m_burnTimer <= 0f) { StopBurning(); } } } public void Ignite() { if (!m_isBurning) { m_isBurning = true; m_burnTimer = BurnDuration; if ((Object)(object)FireGO != (Object)null) { FireGO.SetActive(true); } if ((Object)(object)fireAud != (Object)null) { fireAud.Play(); } if ((Object)(object)LinkedObject != (Object)null) { LinkedObject.SetActive(true); } } } private void StopBurning() { m_isBurning = false; if ((Object)(object)FireGO != (Object)null) { FireGO.SetActive(false); } if ((Object)(object)fireAud != (Object)null) { fireAud.Stop(); } if ((Object)(object)LinkedObject != (Object)null) { LinkedObject.SetActive(false); } if ((Object)(object)RelightTrigger != (Object)null) { RelightTrigger.SetActive(true); } Debug.Log((object)"Pipe burnt out. Ready to be reignited."); } } public class SmokingPipeTrigger : MonoBehaviour { public FVRSmokingPipe SmokingPipe; public Collider collider; public float ResetDelay = 2f; private bool isActive = true; private void OnTriggerEnter(Collider col) { if (isActive && !SmokingPipe.IsBurning) { isActive = false; SmokingPipe.Ignite(); collider.enabled = false; ((Component)this).gameObject.layer = LayerMask.NameToLayer("NoCol"); ((MonoBehaviour)this).StartCoroutine(ResetTriggerAfterDelay()); } } private IEnumerator ResetTriggerAfterDelay() { yield return (object)new WaitForSeconds(ResetDelay); collider.enabled = true; ((Component)this).gameObject.layer = LayerMask.NameToLayer("Default"); isActive = true; } } public class FlamingSword : FVRMeleeWeapon { [Header("Fire Effects")] public GameObject fireVisuals; public ParticleSystem fireParticles; public AudioSource audioSource; public AudioClip startClip; public AudioClip loopClip; public AudioClip endClip; [Header("Glow Emission")] public Renderer glowRenderer; public Color glowColor = Color.red; public float glowIntensity = 2f; [Header("Timing")] public float extinguishDelay = 2f; private bool isOn = false; private Coroutine extinguishCoroutine; protected void Start() { SetFireState(on: false); } private void Update() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) if (!((FVRInteractiveObject)this).IsHeld || (Object)(object)((FVRInteractiveObject)this).m_hand == (Object)null) { if (isOn && extinguishCoroutine == null) { extinguishCoroutine = ((MonoBehaviour)this).StartCoroutine(ExtinguishAfterDelay()); } return; } if (extinguishCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(extinguishCoroutine); extinguishCoroutine = null; } HandInput input = ((FVRInteractiveObject)this).m_hand.Input; bool flag = false; if ((!((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode) ? (input.TouchpadDown && ((Vector2)(ref input.TouchpadAxes)).magnitude > 0.2f && Vector2.Angle(input.TouchpadAxes, Vector2.down) < 45f) : input.BYButtonDown) { isOn = !isOn; SetFireState(isOn); } } private void SetFireState(bool on) { //IL_00d2: 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_009c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)fireVisuals != (Object)null) { fireVisuals.SetActive(on); } if ((Object)(object)fireParticles != (Object)null) { if (on) { fireParticles.Play(); } else { fireParticles.Stop(); } } if ((Object)(object)glowRenderer != (Object)null) { if (on) { glowRenderer.material.EnableKeyword("_EMISSION"); glowRenderer.material.SetColor("_EmissionColor", glowColor * glowIntensity); } else { glowRenderer.material.DisableKeyword("_EMISSION"); glowRenderer.material.SetColor("_EmissionColor", Color.black); } } if ((Object)(object)audioSource != (Object)null) { audioSource.Stop(); if (on && (Object)(object)startClip != (Object)null) { audioSource.clip = startClip; audioSource.loop = false; audioSource.Play(); ((MonoBehaviour)this).StartCoroutine(PlayLoopAfterDelay(startClip.length)); } else if (!on && (Object)(object)endClip != (Object)null) { audioSource.clip = endClip; audioSource.loop = false; audioSource.Play(); } } } private IEnumerator PlayLoopAfterDelay(float delay) { yield return (object)new WaitForSeconds(delay); if (isOn && (Object)(object)loopClip != (Object)null) { audioSource.clip = loopClip; audioSource.loop = true; audioSource.Play(); } } private IEnumerator ExtinguishAfterDelay() { yield return (object)new WaitForSeconds(extinguishDelay); isOn = false; SetFireState(on: false); extinguishCoroutine = null; } }