using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using FistVR; using HarmonyLib; using OpenScripts2; using OtherLoader; using Sodalite; using Sodalite.Api; using UnityEngine; using theWNbotMods; [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 theWNbotMods { public class RemoteFire : FVRPhysicalObject { [Header("Binding")] [Tooltip("The firearm to control. Can be assigned in Inspector or at runtime via BindFirearm().")] public FVRFireArm targetFirearm; [Tooltip("If true and targetFirearm is null, will try to auto-find a FVRFireArm on the same GameObject or its children in Start().")] public bool autoFindFirearm = true; [Header("Trigger Settings")] [Tooltip("If true, a single TriggerDown will attempt a single fire call.")] public bool fireOnTriggerDown = true; [Tooltip("If true, holding trigger will repeatedly call the fire method each frame while held (use with caution).")] public bool continuousWhileHeld = false; [Header("Debug")] [Tooltip("In Inspector, toggle to simulate a trigger press (auto-resets).")] public bool DebugTriggerOnce = false; private bool _wasTriggerHeld = false; private void Start() { if ((Object)(object)targetFirearm == (Object)null && autoFindFirearm) { targetFirearm = ((Component)this).GetComponentInChildren(); } } private void OnValidate() { if (!Application.isPlaying && DebugTriggerOnce) { DebugTriggerOnce = false; } } private void Update() { if (DebugTriggerOnce) { DebugTriggerOnce = false; TryTriggerFire(); } if (!((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)) { return; } if (fireOnTriggerDown && ((FVRInteractiveObject)this).m_hand.Input.TriggerDown) { TryTriggerFire(); } if (continuousWhileHeld) { bool triggerPressed = ((FVRInteractiveObject)this).m_hand.Input.TriggerPressed; if (triggerPressed && !_wasTriggerHeld) { TryTriggerFire(); } else if (triggerPressed && _wasTriggerHeld) { TryTriggerFire(); } _wasTriggerHeld = triggerPressed; } } public void BindFirearm(FVRFireArm firearm) { targetFirearm = firearm; } public void UnbindFirearm() { targetFirearm = null; } private void TryTriggerFire() { if ((Object)(object)targetFirearm == (Object)null) { return; } Type type = ((object)targetFirearm).GetType(); MethodInfo method = type.GetMethod("Fire", BindingFlags.Instance | BindingFlags.Public); if ((object)method != null) { try { method.Invoke(targetFirearm, null); return; } catch (Exception) { } } MethodInfo method2 = type.GetMethod("DropHammer", BindingFlags.Instance | BindingFlags.Public); if ((object)method2 != null) { try { method2.Invoke(targetFirearm, null); return; } catch (Exception) { } } MethodInfo method3 = type.GetMethod("CockHammer", BindingFlags.Instance | BindingFlags.Public); if ((object)method3 != null) { try { ParameterInfo[] parameters = method3.GetParameters(); if (parameters.Length == 1 && (object)parameters[0].ParameterType == typeof(bool)) { method3.Invoke(targetFirearm, new object[1] { true }); } else { method3.Invoke(targetFirearm, null); } method2?.Invoke(targetFirearm, null); return; } catch (Exception) { } } try { ((Component)targetFirearm).gameObject.SendMessage("Fire", (SendMessageOptions)1); } catch (Exception) { } } } public class AC130TabletLeftHand : FVRInteractiveObject { [Header("平板主控制器")] public AC130TabletRightHand tabletController; [Header("干扰弹 Prefab")] public GameObject countermeasurePrefab; [Header("Debug 模拟输入")] public bool SimTrigger = false; public bool SimStickLeft = false; public bool SimStickRight = false; public bool SimStickUp = false; public bool SimStickDown = false; private Vector2 _lAxes; public override void UpdateInteraction(FVRViveHand hand) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //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) ((FVRInteractiveObject)this).UpdateInteraction(hand); if ((int)hand.HandSource != 1) { return; } if ((int)hand.CMode == 3 || (int)hand.CMode == 1) { _lAxes = hand.Input.Secondary2AxisInputAxes; } else { _lAxes = hand.Input.TouchpadAxes; } if (SimStickLeft) { _lAxes.x = -1f; SimStickLeft = false; } if (SimStickRight) { _lAxes.x = 1f; SimStickRight = false; } if (SimStickUp) { _lAxes.y = 1f; SimStickUp = false; } if (SimStickDown) { _lAxes.y = -1f; SimStickDown = false; } if (_lAxes.x > 0.8f) { tabletController.CurrentIndex++; } else if (_lAxes.x < -0.8f) { tabletController.CurrentIndex--; } if (hand.Input.TriggerDown || SimTrigger) { if ((Object)(object)countermeasurePrefab != (Object)null) { countermeasurePrefab.SetActive(true); } SimTrigger = false; } } } public class AC130TabletRightHand : FVRPhysicalObject { [Header("炮艇控制器")] public OrbitalStrikeController[] strikeControllers; public GameObject[] cannonUIPrefabs; [Header("摄像头角度限制")] public Transform cameraPivot; public float yawLimit = 60f; public float pitchLimit = 30f; public float rotationSpeed = 2f; [Header("Debug 模拟输入")] public bool SimTrigger = false; public bool SimStickLeft = false; public bool SimStickRight = false; public bool SimStickUp = false; public bool SimStickDown = false; private Vector2 _rAxes; private int currentIndex = 0; public int CurrentIndex { get { return currentIndex; } set { currentIndex = Mathf.Clamp(value, 0, strikeControllers.Length - 1); UpdateUI(); } } public override void UpdateInteraction(FVRViveHand hand) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //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_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_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_0163: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); if ((int)hand.HandSource != 2) { return; } if ((int)hand.CMode == 3 || (int)hand.CMode == 1) { _rAxes = hand.Input.Secondary2AxisInputAxes; } else { _rAxes = hand.Input.TouchpadAxes; } if (SimStickLeft) { _rAxes.x = -1f; SimStickLeft = false; } if (SimStickRight) { _rAxes.x = 1f; SimStickRight = false; } if (SimStickUp) { _rAxes.y = 1f; SimStickUp = false; } if (SimStickDown) { _rAxes.y = -1f; SimStickDown = false; } float num = Mathf.Clamp(cameraPivot.localEulerAngles.y + _rAxes.x * rotationSpeed, 0f - yawLimit, yawLimit); float num2 = Mathf.Clamp(cameraPivot.localEulerAngles.x - _rAxes.y * rotationSpeed, 0f - pitchLimit, pitchLimit); cameraPivot.localRotation = Quaternion.Euler(num2, num, 0f); if (!hand.Input.TriggerDown && !SimTrigger) { return; } if (strikeControllers != null && strikeControllers.Length > 0) { OrbitalStrikeController orbitalStrikeController = strikeControllers[currentIndex]; if ((Object)(object)orbitalStrikeController != (Object)null) { orbitalStrikeController.shouldFire = true; } } SimTrigger = false; } public void UpdateUI() { for (int i = 0; i < cannonUIPrefabs.Length; i++) { if ((Object)(object)cannonUIPrefabs[i] != (Object)null) { cannonUIPrefabs[i].SetActive(i == currentIndex); } } } public void SetCurrentIndex(int index) { CurrentIndex = index; } } public class AirstrikeBinocular : FVRPhysicalObject { [Header("望远镜镜头中心(Ray 起点)")] public Transform RayOrigin; [Header("默认空袭 Prefab")] public GameObject defaultAirstrikePrefab; [Header("最大射程")] public float MaxDistance = 500f; [Header("可命中的层(地面、环境等)")] public LayerMask HitLayers; [Header("菜单 UI Canvas")] public GameObject menuCanvas; [Header("音效播放")] public AudioSource audioSource; private GameObject currentAirstrikePrefab; private AudioClip[] currentAirstrikeClips; [Header("调试信息")] [SerializeField] private string currentTypeName = "None"; [Header("部署方向设置")] [SerializeField] private Vector3 rotationOffsetEuler = Vector3.zero; [Header("冷却时间设置")] [SerializeField] private float cooldownTime = 5f; private float lastDeployTime = -999f; [Header("调试开关")] [SerializeField] private bool debugTrigger = false; private void Start() { currentAirstrikePrefab = defaultAirstrikePrefab; currentTypeName = ((!((Object)(object)defaultAirstrikePrefab != (Object)null)) ? "None" : ((Object)defaultAirstrikePrefab).name); if ((Object)(object)menuCanvas != (Object)null) { menuCanvas.SetActive(false); } Debug.Log((object)("AirstrikeBinocular当前空袭类型: " + currentTypeName)); } private void Update() { if (debugTrigger) { Debug.Log((object)("调试Inspector触发空袭 → " + currentTypeName)); DeployAirstrike(null); debugTrigger = false; } } public void ToggleMenu(bool isOpen) { if ((Object)(object)menuCanvas != (Object)null) { menuCanvas.SetActive(isOpen); } } public void SetAirstrikeType(GameObject prefab, AudioClip[] clips) { currentAirstrikePrefab = prefab; currentAirstrikeClips = clips; currentTypeName = ((!((Object)(object)prefab != (Object)null)) ? "None" : ((Object)prefab).name); Debug.Log((object)("当前空袭类型切换为: " + currentTypeName)); } public override void UpdateInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).UpdateInteraction(hand); if (hand.Input.TriggerFloat > 0.8f) { DeployAirstrike(hand); } } public void DeployAirstrike(FVRViveHand hand) { //IL_0058: 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_0071: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c1: 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_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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_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) RaycastHit val = default(RaycastHit); if (Time.time - lastDeployTime < cooldownTime) { Debug.Log((object)("冷却中,剩余时间: " + (cooldownTime - (Time.time - lastDeployTime)).ToString("F1") + " 秒")); } else if (Physics.Raycast(RayOrigin.position, RayOrigin.forward, ref val, MaxDistance, LayerMask.op_Implicit(HitLayers))) { Vector3 forward = RayOrigin.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { forward = Vector3.forward; } Quaternion val2 = Quaternion.LookRotation(forward, Vector3.up); Quaternion val3 = val2 * Quaternion.Euler(rotationOffsetEuler); Object.Instantiate(currentAirstrikePrefab, ((RaycastHit)(ref val)).point, val3); Debug.Log((object)string.Concat("释放空袭: ", currentTypeName, " 于位置 ", ((RaycastHit)(ref val)).point, ",旋转: ", ((Quaternion)(ref val3)).eulerAngles)); lastDeployTime = Time.time; if ((Object)(object)audioSource != (Object)null && currentAirstrikeClips != null && currentAirstrikeClips.Length > 0) { AudioClip val4 = currentAirstrikeClips[Random.Range(0, currentAirstrikeClips.Length)]; audioSource.PlayOneShot(val4); } if ((Object)(object)hand != (Object)null) { hand.Buzz(hand.Buzzer.Buzz_OnHoverInteractive); } } } } public class AirstrikeDebugger : MonoBehaviour { [Header("移动速度")] public float moveSpeed = 5f; [Header("鼠标灵敏度")] public float mouseSensitivity = 2f; [Header("头部对象(联动 UILookAtPlayer)")] public Transform headTransform; private float rotationX = 0f; private float rotationY = 0f; private void Start() { Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; } private void Update() { //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) //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_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_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_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_0061: 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_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_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_0131: Unknown result type (might be due to invalid IL or missing references) float axis = Input.GetAxis("Horizontal"); float axis2 = Input.GetAxis("Vertical"); Vector3 val = (((Component)this).transform.right * axis + ((Component)this).transform.forward * axis2) * moveSpeed * Time.deltaTime; Transform transform = ((Component)this).transform; transform.position += val; float num = Input.GetAxis("Mouse X") * mouseSensitivity; float num2 = Input.GetAxis("Mouse Y") * mouseSensitivity; rotationY += num; rotationX -= num2; rotationX = Mathf.Clamp(rotationX, -80f, 80f); ((Component)this).transform.rotation = Quaternion.Euler(rotationX, rotationY, 0f); if ((Object)(object)headTransform != (Object)null) { headTransform.position = ((Component)this).transform.position + Vector3.up * 1.6f; headTransform.rotation = ((Component)this).transform.rotation; } } } public class ChangeTypeWhenAwake : MonoBehaviour { public GameObject airstrikePrefab; public AudioClip[] airstrikeClips; public AirstrikeBinocular binocular; private void OnEnable() { if ((Object)(object)binocular != (Object)null && (Object)(object)airstrikePrefab != (Object)null) { binocular.SetAirstrikeType(airstrikePrefab, airstrikeClips); } } } } public class ScopeScript : MonoBehaviour { [SerializeField] [Range(0f, 1f)] private float zoom; [SerializeField] private float minFOV; [SerializeField] private float maxFOV; [SerializeField] private Camera myCamera; [SerializeField] private Transform myCrossHair; [SerializeField] private float minCrossHairScale; [SerializeField] private float maxCrossHairScale; [SerializeField] private Material imageMat; [SerializeField] private float minDistortion; [SerializeField] private float maxDistortion; private void Start() { } private void Update() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) myCamera.fieldOfView = Mathf.Lerp(maxFOV, minFOV, zoom); float num = Mathf.Lerp(minCrossHairScale, maxCrossHairScale, zoom); myCrossHair.localScale = new Vector3(num, num, 1f); imageMat.SetFloat("_Constant", Mathf.Lerp(minDistortion, maxDistortion, zoom)); } } namespace theWNbotMods { public class scopeFocusScript : MonoBehaviour { [Header("眼睛位置(VR Head 或 Debug Head)")] [SerializeField] private Transform eye; [Header("瞄具参考点(通常是镜片中心)")] [SerializeField] private Transform eyeDistPos; [Header("聚焦参数")] [SerializeField] private float fadedDist = 0.2f; [SerializeField] private float maxAngle = 15f; [Header("材质控制")] [SerializeField] private Material focusMat; [SerializeField] private float minMult = 0f; [SerializeField] private float maxMult = 1f; private Vector2 posInput; private float circleCenterMovement; private void LateUpdate() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) //IL_00b9: 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_00de: 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) if (!((Object)(object)eye == (Object)null) && !((Object)(object)eyeDistPos == (Object)null) && !((Object)(object)focusMat == (Object)null)) { float num = Vector3.Distance(eyeDistPos.position, eye.position); float num2 = num / fadedDist; num2 = Mathf.Clamp(num2, minMult, maxMult); Vector3 val = ((Component)this).transform.position - eye.position; float num3 = Vector3.Angle(val, ((Component)this).transform.forward); circleCenterMovement = num3 / maxAngle; Vector3 val2 = ((Component)this).transform.InverseTransformDirection(val); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(val2.x, val2.y); posInput = ((Vector2)(ref val3)).normalized * circleCenterMovement / 2f; focusMat.SetFloat("_Mult", num2); focusMat.SetFloat("_XPos", 0.5f + posInput.x); focusMat.SetFloat("_YPos", 0.5f + posInput.y); } } } } [HelpURL("https://geom.io/bakery/wiki/index.php?title=Manual#Bakery_Light_Filter")] [DisallowMultipleComponent] public class BakeryLightFilter : MonoBehaviour { public Texture2D texture; [HideInInspector] public int lmid = 0; } namespace theWNbotMods { public class MWStim : MonoBehaviour { [Header("References")] public FVRPhysicalObject fvrObject; public KillAfter ka; public GameObject stimneedle; public GameObject torsoref; public AudioEvent inject; [Header("Rot Objects")] public GameObject[] rot1s; public GameObject[] rot2s; [Header("Rotation Settings")] public float rotSpeed = 5f; [Header("Cap Settings")] public GameObject capObject; public GameObject capRemovedPrefab; public Transform capSpawnPoint; public bool destroyCapObject = true; [Header("Mouth Bite Settings")] public float biteDistance = 0.2f; public GameObject biteFXPrefab; public Vector3 biteFXOffset = new Vector3(0f, -0.05f, 0.1f); private bool isTriggerHeld = false; private bool hasInjected = false; private bool capRemoved = false; private Transform headTransform; private void Awake() { if ((Object)(object)GM.CurrentPlayerBody != (Object)null && (Object)(object)GM.CurrentPlayerBody.Head != (Object)null) { headTransform = GM.CurrentPlayerBody.Head; } if ((Object)(object)fvrObject == (Object)null) { fvrObject = ((Component)this).GetComponent(); } } private void Update() { //IL_00c8: 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_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_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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_01a6: 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_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GM.CurrentPlayerBody != (Object)null && (Object)(object)GM.CurrentPlayerBody.Torso != (Object)null && (Object)(object)torsoref != (Object)null && (Object)(object)stimneedle != (Object)null) { torsoref.transform.position = new Vector3(GM.CurrentPlayerBody.Torso.position.x, stimneedle.transform.position.y, GM.CurrentPlayerBody.Torso.position.z); } if (!capRemoved && (Object)(object)headTransform != (Object)null) { float num = Vector3.Distance(((Component)this).transform.position, headTransform.position); if (num <= biteDistance) { BiteCap(); SpawnBiteFX(); } } if ((Object)(object)fvrObject != (Object)null && ((FVRInteractiveObject)fvrObject).m_isHeld && (Object)(object)((FVRInteractiveObject)fvrObject).m_hand != (Object)null) { if (((FVRInteractiveObject)fvrObject).m_hand.Input.TriggerFloat >= 0.5f || ((FVRInteractiveObject)fvrObject).m_hand.Input.AXButtonDown || ((FVRInteractiveObject)fvrObject).m_hand.Input.BYButtonDown) { stimneedle.transform.localPosition = new Vector3(0f, -0.1f, 0f); if (!capRemoved) { RemoveCap(); return; } isTriggerHeld = true; if (Vector3.Distance(torsoref.transform.position, stimneedle.transform.position) <= 0.25f && !hasInjected) { ((FVRInteractiveObject)fvrObject).m_hand.m_buzztime = 1f; ((FVRInteractiveObject)fvrObject).IsSimpleInteract = true; fvrObject.DistantGrabbable = false; SM.PlayCoreSound((FVRPooledAudioType)41, inject, stimneedle.transform.position); GM.CurrentPlayerBody.ActivatePower((PowerupType)0, (PowerUpIntensity)1, (PowerUpDuration)1, false, false, -1f); hasInjected = true; if ((Object)(object)ka != (Object)null) { ((Behaviour)ka).enabled = true; } } } else { stimneedle.transform.localPosition = Vector3.zero; isTriggerHeld = false; } } else { isTriggerHeld = false; } UpdateRotations(); } private void UpdateRotations() { //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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) if (rot1s != null) { GameObject[] array = rot1s; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { float num = ((!isTriggerHeld) ? 0f : 90f); float num2 = Mathf.Lerp(val.transform.localEulerAngles.x, num, Time.deltaTime * rotSpeed); val.transform.localEulerAngles = new Vector3(num2, 0f, 0f); } } } if (rot2s == null) { return; } GameObject[] array2 = rot2s; foreach (GameObject val2 in array2) { if ((Object)(object)val2 != (Object)null) { float num3 = ((!hasInjected) ? 0f : 90f); float num4 = Mathf.Lerp(val2.transform.localEulerAngles.x, num3, Time.deltaTime * rotSpeed); val2.transform.localEulerAngles = new Vector3(num4, 0f, 0f); } } } private void RemoveCap() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (capRemoved) { return; } capRemoved = true; if ((Object)(object)capObject != (Object)null) { if (destroyCapObject) { Object.Destroy((Object)(object)capObject); } else { capObject.SetActive(false); } } if ((Object)(object)capRemovedPrefab != (Object)null) { Vector3 val = ((!((Object)(object)capSpawnPoint != (Object)null)) ? ((Component)this).transform.position : capSpawnPoint.position); Quaternion val2 = ((!((Object)(object)capSpawnPoint != (Object)null)) ? ((Component)this).transform.rotation : capSpawnPoint.rotation); Object.Instantiate(capRemovedPrefab, val, val2); } } private void BiteCap() { if (!capRemoved) { capRemoved = true; if ((Object)(object)capObject != (Object)null) { capObject.SetActive(false); } } } private void SpawnBiteFX() { //IL_002a: 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_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_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) if ((Object)(object)biteFXPrefab != (Object)null && (Object)(object)headTransform != (Object)null) { Vector3 val = headTransform.position + headTransform.TransformVector(biteFXOffset); GameObject val2 = Object.Instantiate(biteFXPrefab, val, headTransform.rotation); val2.transform.SetParent(headTransform, true); } } } public class CQCFists : MonoBehaviour { [Header("CQC Settings")] public float GrabRange = 1f; public float FollowStrength = 10f; public float ThrowForce = 10f; public float DownSwingThreshold = 1.2f; public float ReleaseDistance = 0.8f; [Header("Audio Settings")] public AudioClip CQC_GrabSFX; public AudioClip CQC_ThrowSFX; [Header("Effect Durations")] public float HostageConfuseDuration = 999f; public float UnconsciousDuration = 5f; private FVRViveHand hand; private bool isGrabbing = false; private bool readyToThrow = false; private SosigLink grabbedLink = null; private Vector3 grabOffset; private Vector3 initialGrabPos; private void Update() { if (!((Component)this).gameObject.activeSelf) { return; } hand = FindHand(); if (!((Object)(object)hand == (Object)null)) { float triggerFloat = hand.Input.TriggerFloat; if (triggerFloat > 0.75f && !isGrabbing) { TryGrabNearestLink(); } if (isGrabbing && (Object)(object)grabbedLink != (Object)null) { FollowHandMovement(); DetectDownSwing(); DetectPullRelease(); } if (isGrabbing && triggerFloat <= 0.75f) { PerformThrow(); } } } private FVRViveHand FindHand() { if ((Object)(object)((Component)this).transform.parent == (Object)(object)((Component)GM.CurrentPlayerBody.LeftHand).transform) { return GM.CurrentMovementManager.Hands[0]; } if ((Object)(object)((Component)this).transform.parent == (Object)(object)((Component)GM.CurrentPlayerBody.RightHand).transform) { return GM.CurrentMovementManager.Hands[1]; } return null; } private void TryGrabNearestLink() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_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) //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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0129: Unknown result type (might be due to invalid IL or missing references) SosigLink[] array = Object.FindObjectsOfType(); float num = float.PositiveInfinity; SosigLink val = null; SosigLink[] array2 = array; foreach (SosigLink val2 in array2) { float num2 = Vector3.Distance(((Component)val2).transform.position, ((Component)this).transform.position); if (num2 < GrabRange && num2 < num) { num = num2; val = val2; } } if (!((Object)(object)val != (Object)null)) { return; } grabbedLink = val; isGrabbing = true; grabOffset = ((Component)grabbedLink).transform.position - ((Component)this).transform.position; initialGrabPos = ((Component)grabbedLink).transform.position; Sosig s = val.S; if ((Object)(object)s != (Object)null) { s.m_isConfused = true; s.m_confusedTime = HostageConfuseDuration; s.SetBodyPose((SosigBodyPose)0); s.ObjectUsageFocus = (SosigObjectUsageFocus)0; if ((Object)(object)s.Agent != (Object)null) { ((Behaviour)s.Agent).enabled = false; } s.SetCurrentOrder((SosigOrder)0); s.FallbackOrder = (SosigOrder)0; } if ((Object)(object)CQC_GrabSFX != (Object)null) { AudioSource.PlayClipAtPoint(CQC_GrabSFX, ((Component)val).transform.position); } } private void FollowHandMovement() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_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_0040: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position + grabOffset; ((Component)grabbedLink).transform.position = Vector3.Lerp(((Component)grabbedLink).transform.position, val, Time.deltaTime * FollowStrength); } private void DetectDownSwing() { //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) Vector3 throwLinearVelWorld = hand.GetThrowLinearVelWorld(); if (Vector3.Dot(((Vector3)(ref throwLinearVelWorld)).normalized, Vector3.down) > 0.6f && ((Vector3)(ref throwLinearVelWorld)).magnitude > DownSwingThreshold) { readyToThrow = true; } } private void DetectPullRelease() { //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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0083: 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_00be: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(((Component)grabbedLink).transform.position, ((Component)this).transform.position); if (!(num > ReleaseDistance)) { return; } Vector3 val = ((Component)grabbedLink).transform.position - initialGrabPos; Vector3 normalized = ((Vector3)(ref val)).normalized; Sosig s = grabbedLink.S; if ((Object)(object)s != (Object)null && (Object)(object)s.CoreRB != (Object)null) { s.CoreRB.AddForce(normalized * ThrowForce, (ForceMode)2); s.KnockUnconscious(UnconsciousDuration); if ((Object)(object)CQC_ThrowSFX != (Object)null) { AudioSource.PlayClipAtPoint(CQC_ThrowSFX, ((Component)s).transform.position); } } ResetCQC(); } private void PerformThrow() { //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_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_0080: 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 (!readyToThrow || (Object)(object)grabbedLink == (Object)null) { ResetCQC(); return; } Sosig s = grabbedLink.S; if ((Object)(object)s == (Object)null) { ResetCQC(); return; } Vector3 throwLinearVelWorld = hand.GetThrowLinearVelWorld(); Vector3 normalized = ((Vector3)(ref throwLinearVelWorld)).normalized; if ((Object)(object)s.CoreRB != (Object)null) { s.CoreRB.AddForce(normalized * ThrowForce, (ForceMode)2); } s.KnockUnconscious(UnconsciousDuration); if ((Object)(object)CQC_ThrowSFX != (Object)null) { AudioSource.PlayClipAtPoint(CQC_ThrowSFX, ((Component)s).transform.position); } ResetCQC(); } private void ResetCQC() { //IL_004c: 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) isGrabbing = false; readyToThrow = false; if ((Object)(object)grabbedLink != (Object)null && (Object)(object)grabbedLink.S != (Object)null) { Sosig s = grabbedLink.S; s.m_isConfused = false; s.ObjectUsageFocus = (SosigObjectUsageFocus)1; if ((Object)(object)s.Agent != (Object)null) { ((Behaviour)s.Agent).enabled = true; } s.SetCurrentOrder((SosigOrder)9); s.FallbackOrder = (SosigOrder)9; } grabbedLink = null; } private void OnDrawGizmosSelected() { //IL_0001: 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_0021: 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) Gizmos.color = Color.red; Gizmos.DrawWireSphere(((Component)this).transform.position, GrabRange); Gizmos.color = Color.yellow; Gizmos.DrawWireSphere(((Component)this).transform.position, ReleaseDistance); } } public class CQCFistsSystem : MonoBehaviour { [Header("Prefabs")] public GameObject CQCHandLeftPrefab; public GameObject CQCHandRightPrefab; private GameObject leftHandObj; private GameObject rightHandObj; private void Update() { if ((Object)(object)GM.CurrentPlayerBody == (Object)null) { return; } if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null && GM.CurrentMovementManager.Hands[0].Input.TriggerPressed) { if ((Object)(object)leftHandObj == (Object)null) { leftHandObj = Object.Instantiate(CQCHandLeftPrefab, ((Component)GM.CurrentPlayerBody.LeftHand).transform); } leftHandObj.SetActive(true); } else if ((Object)(object)leftHandObj != (Object)null) { leftHandObj.SetActive(false); } if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null && GM.CurrentMovementManager.Hands[1].Input.TriggerPressed) { if ((Object)(object)rightHandObj == (Object)null) { rightHandObj = Object.Instantiate(CQCHandRightPrefab, ((Component)GM.CurrentPlayerBody.RightHand).transform); } rightHandObj.SetActive(true); } else if ((Object)(object)rightHandObj != (Object)null) { rightHandObj.SetActive(false); } } private void OnDestroy() { if ((Object)(object)leftHandObj != (Object)null) { Object.Destroy((Object)(object)leftHandObj); } if ((Object)(object)rightHandObj != (Object)null) { Object.Destroy((Object)(object)rightHandObj); } } } [BepInProcess("h3vr.exe")] [BepInPlugin("theWNbotMods.CQCFistsToggle", "CQCFistsToggle", "1.0.0")] public class CQCFistsToggle : BaseUnityPlugin { private static class CQCFistsPatch { [HarmonyPatch(typeof(FVRWristMenu2), "Awake")] [HarmonyPostfix] public static void MenuButton(FVRWristMenu2 __instance) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown if ((Object)(object)__instance == (Object)null) { Logger.LogMessage((object)"No FVRWristMenu2"); return; } bool flag = false; foreach (WristMenuButton button in WristMenuAPI.Buttons) { if (button.Text == "CQCFistsToggle") { flag = true; break; } } if (!flag) { WristMenuAPI.Buttons.Add(new WristMenuButton("CQCFistsToggle", new ButtonClickEvent(ToggleCQCFistsSystem))); Logger.LogMessage((object)"CQCFistsToggle button added to wrist menu!"); } } public static void ToggleCQCFistsSystem(object sender, ButtonClickEventArgs args) { GameObject val = GameObject.Find("CQCFistsSystem(Clone)"); if ((Object)(object)val != (Object)null) { Logger.LogMessage((object)"CQCFistsSystem found, destroying..."); Object.Destroy((Object)(object)val); return; } Logger.LogMessage((object)"Spawning CQCFistsSystem from Inspector reference..."); CQCFistsToggle component = Chainloader.ManagerObject.GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.CQCFistsSystemPrefab != (Object)null) { GameObject val2 = Object.Instantiate(component.CQCFistsSystemPrefab); Object.DontDestroyOnLoad((Object)(object)val2); ((Object)val2).name = "CQCFistsSystem(Clone)"; } else { Logger.LogMessage((object)"CQCFistsSystem Prefab not assigned in Inspector!"); } } } public GameObject CQCFistsSystemPrefab; internal static ManualLogSource Logger { get; private set; } public void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Harmony.CreateAndPatchAll(typeof(CQCFistsPatch), (string)null); Logger.LogMessage((object)"CQCFistsToggle loaded!"); } } public class CQCMelee : MonoBehaviour { [Header("CQC Settings")] public float GrabRange = 1f; public float FollowStrength = 10f; public float ThrowForce = 10f; public float DownSwingThreshold = 1.2f; public float ReleaseDistance = 0.8f; [Header("Audio Settings")] public AudioClip CQC_GrabSFX; public AudioClip CQC_ThrowSFX; [Header("Effect Durations")] public float HostageConfuseDuration = 999f; public float UnconsciousDuration = 5f; [Header("Disable Prefabs on Grab")] public GameObject[] disableOnGrab; private FVRMeleeWeapon weapon; private FVRViveHand hand; private bool isGrabbing = false; private bool readyToThrow = false; private SosigLink grabbedLink = null; private Vector3 grabOffset; private Vector3 initialGrabPos; private void Start() { weapon = ((Component)this).GetComponent(); } private void Update() { if ((Object)(object)weapon == (Object)null || !((FVRInteractiveObject)weapon).IsHeld) { return; } hand = ((FVRInteractiveObject)weapon).m_hand; if (!((Object)(object)hand == (Object)null)) { float triggerFloat = hand.Input.TriggerFloat; if (triggerFloat > 0.75f && !isGrabbing) { TryGrabNearestLink(); } if (isGrabbing && (Object)(object)grabbedLink != (Object)null) { FollowWeaponMovement(); DetectDownSwing(); DetectPullRelease(); } if (isGrabbing && triggerFloat <= 0.75f) { PerformThrow(); } } } private void TryGrabNearestLink() { //IL_0028: 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_0099: 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_00b3: 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_00c9: 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_0156: 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) SosigLink[] array = Object.FindObjectsOfType(); float num = float.PositiveInfinity; SosigLink val = null; SosigLink[] array2 = array; foreach (SosigLink val2 in array2) { float num2 = Vector3.Distance(((Component)val2).transform.position, ((Component)weapon).transform.position); if (num2 < GrabRange && num2 < num) { num = num2; val = val2; } } if (!((Object)(object)val != (Object)null)) { return; } grabbedLink = val; isGrabbing = true; grabOffset = ((Component)grabbedLink).transform.position - ((Component)weapon).transform.position; initialGrabPos = ((Component)grabbedLink).transform.position; Sosig s = val.S; if ((Object)(object)s != (Object)null) { s.m_isConfused = true; s.m_confusedTime = HostageConfuseDuration; s.SetBodyPose((SosigBodyPose)0); s.ObjectUsageFocus = (SosigObjectUsageFocus)0; if ((Object)(object)s.Agent != (Object)null) { ((Behaviour)s.Agent).enabled = false; } s.SetCurrentOrder((SosigOrder)0); s.FallbackOrder = (SosigOrder)0; } if ((Object)(object)CQC_GrabSFX != (Object)null) { AudioSource.PlayClipAtPoint(CQC_GrabSFX, ((Component)val).transform.position); } if (disableOnGrab == null) { return; } GameObject[] array3 = disableOnGrab; foreach (GameObject val3 in array3) { if ((Object)(object)val3 != (Object)null) { val3.SetActive(false); } } } private void FollowWeaponMovement() { //IL_000c: 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) //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_0045: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)weapon).transform.position + grabOffset; ((Component)grabbedLink).transform.position = Vector3.Lerp(((Component)grabbedLink).transform.position, val, Time.deltaTime * FollowStrength); } private void DetectDownSwing() { //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) Vector3 throwLinearVelWorld = hand.GetThrowLinearVelWorld(); if (Vector3.Dot(((Vector3)(ref throwLinearVelWorld)).normalized, Vector3.down) > 0.6f && ((Vector3)(ref throwLinearVelWorld)).magnitude > DownSwingThreshold) { readyToThrow = true; } } private void DetectPullRelease() { //IL_000c: 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_003f: 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_0052: 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_0088: 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_00c3: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(((Component)grabbedLink).transform.position, ((Component)weapon).transform.position); if (!(num > ReleaseDistance)) { return; } Vector3 val = ((Component)grabbedLink).transform.position - initialGrabPos; Vector3 normalized = ((Vector3)(ref val)).normalized; Sosig s = grabbedLink.S; if ((Object)(object)s != (Object)null && (Object)(object)s.CoreRB != (Object)null) { s.CoreRB.AddForce(normalized * ThrowForce, (ForceMode)2); s.KnockUnconscious(UnconsciousDuration); if ((Object)(object)CQC_ThrowSFX != (Object)null) { AudioSource.PlayClipAtPoint(CQC_ThrowSFX, ((Component)s).transform.position); } } ResetCQC(); } private void PerformThrow() { //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_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_0080: 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 (!readyToThrow || (Object)(object)grabbedLink == (Object)null) { ResetCQC(); return; } Sosig s = grabbedLink.S; if ((Object)(object)s == (Object)null) { ResetCQC(); return; } Vector3 throwLinearVelWorld = hand.GetThrowLinearVelWorld(); Vector3 normalized = ((Vector3)(ref throwLinearVelWorld)).normalized; if ((Object)(object)s.CoreRB != (Object)null) { s.CoreRB.AddForce(normalized * ThrowForce, (ForceMode)2); } s.KnockUnconscious(UnconsciousDuration); if ((Object)(object)CQC_ThrowSFX != (Object)null) { AudioSource.PlayClipAtPoint(CQC_ThrowSFX, ((Component)s).transform.position); } ResetCQC(); } private void ResetCQC() { //IL_004c: 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) isGrabbing = false; readyToThrow = false; if ((Object)(object)grabbedLink != (Object)null && (Object)(object)grabbedLink.S != (Object)null) { Sosig s = grabbedLink.S; s.m_isConfused = false; s.ObjectUsageFocus = (SosigObjectUsageFocus)1; if ((Object)(object)s.Agent != (Object)null) { ((Behaviour)s.Agent).enabled = true; } s.SetCurrentOrder((SosigOrder)9); s.FallbackOrder = (SosigOrder)9; } grabbedLink = null; if (disableOnGrab == null) { return; } GameObject[] array = disableOnGrab; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { val.SetActive(true); } } } private void OnDrawGizmosSelected() { //IL_0001: 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_0021: 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) Gizmos.color = Color.red; Gizmos.DrawWireSphere(((Component)this).transform.position, GrabRange); Gizmos.color = Color.yellow; Gizmos.DrawWireSphere(((Component)this).transform.position, ReleaseDistance); } } public class CigaretteAttach : MonoBehaviour { [Header("Attach Settings")] public float attachDistance = 0.2f; public Vector3 positionOffset = new Vector3(0f, -0.05f, 0.05f); public Vector3 rotationOffsetEuler = new Vector3(0f, 0f, 0f); [Header("Smoke Settings")] public GameObject PuffedSmokePrefab; public float puffDelay = 3f; public float puffCooldown = 2f; public Vector3 smokeOffset = new Vector3(0f, -0.1f, 0.1f); [Header("References")] public FVRCigarette cigarette; [Header("Attach Prefab Control")] public GameObject[] enableOnAttach; public GameObject[] disableOnAttach; [Header("Detach Prefab Control")] public GameObject[] enableOnDetach; public GameObject[] disableOnDetach; private bool isAttachedToHead = false; private Transform headTransform; private FVRPhysicalObject fvrObject; private Rigidbody rb; private float puffTimer = 0f; private bool inCooldown = false; private void Awake() { if ((Object)(object)GM.CurrentPlayerBody != (Object)null && (Object)(object)GM.CurrentPlayerBody.Head != (Object)null) { headTransform = GM.CurrentPlayerBody.Head; } fvrObject = ((Component)this).GetComponent(); rb = ((Component)this).GetComponent(); } private void Update() { //IL_0029: 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) if ((Object)(object)headTransform == (Object)null) { return; } if (!isAttachedToHead) { float num = Vector3.Distance(((Component)this).transform.position, headTransform.position); if (num <= attachDistance) { AttachToHead(); } } if (isAttachedToHead) { if ((Object)(object)fvrObject != (Object)null && ((FVRInteractiveObject)fvrObject).m_isHeld) { DetachFromHead(); } else { HandleSmokeLogic(); } } } private void AttachToHead() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) isAttachedToHead = true; ((Component)this).transform.SetParent(headTransform); ((Component)this).transform.localPosition = positionOffset; ((Component)this).transform.localRotation = Quaternion.Euler(rotationOffsetEuler); if ((Object)(object)rb != (Object)null) { rb.isKinematic = true; rb.useGravity = false; } puffTimer = 0f; inCooldown = false; GameObject[] array = enableOnAttach; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { val.SetActive(true); } } GameObject[] array2 = disableOnAttach; foreach (GameObject val2 in array2) { if ((Object)(object)val2 != (Object)null) { val2.SetActive(false); } } } private void DetachFromHead() { isAttachedToHead = false; ((Component)this).transform.SetParent((Transform)null); if ((Object)(object)rb != (Object)null) { rb.isKinematic = false; rb.useGravity = true; } puffTimer = 0f; inCooldown = false; GameObject[] array = enableOnDetach; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { val.SetActive(true); } } GameObject[] array2 = disableOnDetach; foreach (GameObject val2 in array2) { if ((Object)(object)val2 != (Object)null) { val2.SetActive(false); } } } private void HandleSmokeLogic() { //IL_006e: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cigarette == (Object)null || !cigarette.IsBurning()) { return; } puffTimer += Time.deltaTime; if (!inCooldown && puffTimer >= puffDelay) { if ((Object)(object)PuffedSmokePrefab != (Object)null) { Vector3 val = headTransform.position + headTransform.TransformVector(smokeOffset); Object.Instantiate(PuffedSmokePrefab, val, headTransform.rotation); } inCooldown = true; puffTimer = 0f; } else if (inCooldown && puffTimer >= puffCooldown) { inCooldown = false; puffTimer = 0f; } } } public class CigaretteBox : FVRPhysicalObject { private bool triggerPressedLastFrame = false; 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 CigaretteBoxTrigger cigaretteBoxTrigger; 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_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_00c7: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_012b: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //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) ((FVRPhysicalObject)this).UpdateInteraction(hand); if (hand.Input.TriggerFloat > 0.8f && !triggerPressedLastFrame && (Object)(object)hand.CurrentInteractable == (Object)(object)this) { ToggleLid(); triggerPressedLastFrame = true; } else if (hand.Input.TriggerFloat < 0.2f) { triggerPressedLastFrame = false; } 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(openRotationX, openRotationY, openRotationZ) : Quaternion.Euler(closeRotationX, closeRotationY, closeRotationZ)); 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 CigaretteBoxTrigger : FVRInteractiveObject { public CigaretteBox cigaretteBox; public GameObject cigarPrefab; public override bool IsInteractable() { return cigaretteBox.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 (cigaretteBox.IsOpen()) { cigaretteBox.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 { cigaretteBox.Open(); } } } namespace theWNbotMods { [Serializable] public class MotionPart { public GameObject motionPrefab; public GameObject startPrefab; public GameObject endPrefab; } public class FVRCigarette : QBArmorHelmet { [Header("Visual Prefabs")] public GameObject Unlit; public GameObject Lit; [Header("Motion Parts")] public MotionPart[] motionParts; [Header("Animation Settings")] public float burnAnimDuration = 10f; private float burnAnimTimer = 0f; private bool animPlaying = false; [Header("Burn Settings")] public float BurnDuration = 120f; public float DestructionDelay = 10f; private bool m_isBurning = false; private bool m_hasBeenLit = false; private float m_burnTimer; [Header("Fire Prefabs Control")] public GameObject[] fireOnPrefabs; public GameObject[] fireOffPrefabs; [Header("Torch Prefab Control")] public GameObject torchPrefab; [Header("Extinguish Collider")] public Collider ExtinguishCollider; [Header("Extinguish Settings")] public LayerMask ExtinguishLayers; [Header("Audio Settings")] public AudioSource audioSource; public AudioClip extinguishSound; public override void Awake() { ((QBArmorHelmet)this).Awake(); if ((Object)(object)Unlit != (Object)null) { Unlit.SetActive(true); } if ((Object)(object)Lit != (Object)null) { Lit.SetActive(false); } if (motionParts == null) { return; } MotionPart[] array = motionParts; foreach (MotionPart motionPart in array) { if ((Object)(object)motionPart.motionPrefab != (Object)null) { motionPart.motionPrefab.SetActive(false); } } } public override void FVRUpdate() { //IL_00b4: 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_00ca: 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_00fa: 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_0120: 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_0136: Unknown result type (might be due to invalid IL or missing references) ((QBArmorPiece)this).FVRUpdate(); if (!m_isBurning) { return; } m_burnTimer -= Time.deltaTime; if (animPlaying) { burnAnimTimer += Time.deltaTime; float num = Mathf.Clamp01(burnAnimTimer / burnAnimDuration); MotionPart[] array = motionParts; foreach (MotionPart motionPart in array) { if ((Object)(object)motionPart.motionPrefab != (Object)null && (Object)(object)motionPart.startPrefab != (Object)null && (Object)(object)motionPart.endPrefab != (Object)null) { motionPart.motionPrefab.transform.position = Vector3.Lerp(motionPart.startPrefab.transform.position, motionPart.endPrefab.transform.position, num); motionPart.motionPrefab.transform.rotation = Quaternion.Lerp(motionPart.startPrefab.transform.rotation, motionPart.endPrefab.transform.rotation, num); motionPart.motionPrefab.transform.localScale = Vector3.Lerp(motionPart.startPrefab.transform.localScale, motionPart.endPrefab.transform.localScale, num); } } if (num >= 1f) { animPlaying = false; } } if (m_burnTimer <= 0f) { StopBurning(); } } public void Ignite() { if (m_isBurning) { return; } m_hasBeenLit = true; m_isBurning = true; if (m_burnTimer <= 0f) { m_burnTimer = BurnDuration; } if ((Object)(object)Unlit != (Object)null) { Unlit.SetActive(false); } if ((Object)(object)Lit != (Object)null) { Lit.SetActive(true); } animPlaying = true; if (motionParts != null) { MotionPart[] array = motionParts; foreach (MotionPart motionPart in array) { if ((Object)(object)motionPart.motionPrefab != (Object)null && (Object)(object)motionPart.startPrefab != (Object)null) { motionPart.motionPrefab.SetActive(true); } } } GameObject[] array2 = fireOnPrefabs; foreach (GameObject val in array2) { if ((Object)(object)val != (Object)null) { val.SetActive(true); } } if ((Object)(object)torchPrefab != (Object)null) { torchPrefab.SetActive(false); } } private void Extinguish() { if (!m_isBurning) { return; } m_isBurning = false; animPlaying = false; if ((Object)(object)Lit != (Object)null) { Lit.SetActive(true); } if ((Object)(object)Unlit != (Object)null) { Unlit.SetActive(false); } GameObject[] array = fireOffPrefabs; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { val.SetActive(false); } } if ((Object)(object)torchPrefab != (Object)null) { torchPrefab.SetActive(true); } if ((Object)(object)audioSource != (Object)null && (Object)(object)extinguishSound != (Object)null) { audioSource.PlayOneShot(extinguishSound); } } private void StopBurning() { m_isBurning = false; animPlaying = false; if (motionParts == null) { return; } MotionPart[] array = motionParts; foreach (MotionPart motionPart in array) { if ((Object)(object)motionPart.motionPrefab != (Object)null) { motionPart.motionPrefab.SetActive(false); } } } private void OnCollisionEnter(Collision collision) { //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_0062: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ExtinguishCollider == (Object)null) { return; } ContactPoint[] contacts = collision.contacts; for (int i = 0; i < contacts.Length; i++) { ContactPoint val = contacts[i]; if ((Object)(object)((ContactPoint)(ref val)).thisCollider == (Object)(object)ExtinguishCollider && ((1 << ((Component)collision.collider).gameObject.layer) & LayerMask.op_Implicit(ExtinguishLayers)) != 0) { Extinguish(); break; } } } public bool IsBurning() { return m_isBurning; } } public class TorchCigaretteTrigger : MonoBehaviour { [Header("Cigarette Reference")] public FVRCigarette Cigarette; [Header("Torch Prefab")] public GameObject torchPrefab; private void OnTriggerEnter(Collider col) { if ((Object)(object)Cigarette != (Object)null) { Cigarette.Ignite(); if ((Object)(object)torchPrefab != (Object)null) { torchPrefab.SetActive(false); } } } } public class DelayedActive : MonoBehaviour { [Header("延迟多少秒后激活 Prefab")] public float delay = 1f; [Header("要激活的 Prefab 列表")] public GameObject[] prefabsToActivate; private void OnEnable() { ((MonoBehaviour)this).StartCoroutine(ActivateAfterDelay()); } private IEnumerator ActivateAfterDelay() { if (delay > 0f) { yield return (object)new WaitForSeconds(delay); } for (int i = 0; i < prefabsToActivate.Length; i++) { if ((Object)(object)prefabsToActivate[i] != (Object)null) { prefabsToActivate[i].SetActive(true); } } } } public class SpamConsle : MonoBehaviour { [Header("Spam Settings")] public float spamInterval = 0.2f; private float timer = 0f; private string[] horrorMessages = new string[10] { "ITS ME", "HIDE", "SAVE THEM", "STRING LOST", "ITS ME", "ERROR331", "ERROR115", "LEFT TO ROT", "ERROR130", "ITS ME" }; private void Update() { timer += Time.deltaTime; if (timer >= spamInterval) { timer = 0f; string text = horrorMessages[Random.Range(0, horrorMessages.Length)]; Debug.Log((object)text); if (Random.value > 0.85f) { Debug.LogError((object)("!!! CRITICAL ERROR: " + text + " !!!")); } } } } public class AR15FlipSightUniversalTrigger : MonoBehaviour { public enum AnimationType { OneWay, Lever, Button } [Serializable] public class AnimatedTarget { [Header("目标设置")] public Transform target; public GameObject startPrefab; public GameObject endPrefab; [Header("动画类型")] public AnimationType animationType = AnimationType.OneWay; [Header("动画参数")] public float delayBeforeStart = 0f; public float durationToEnd = 1f; public float delayBeforeReturn = 0f; public float durationToStart = 1f; [HideInInspector] public bool hasPlayed = false; [HideInInspector] public bool isAtEnd = false; [HideInInspector] public Vector3 startPos; [HideInInspector] public Vector3 endPos; [HideInInspector] public Vector3 startRot; [HideInInspector] public Vector3 endRot; [HideInInspector] public Vector3 startScale; [HideInInspector] public Vector3 endScale; } [Header("触发事件:生成 Prefab")] public GameObject prefabToSpawn; public Transform spawnPoint; [Header("动画目标列表")] public List animatedTargets = new List(); private AR15HandleSightFlipper flipper; private bool lastState; private void Start() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_0114: 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_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) flipper = ((Component)this).GetComponent(); if ((Object)(object)flipper == (Object)null) { Debug.LogError((object)"[UniversalTrigger] 找不到 AR15HandleSightFlipper!"); ((Behaviour)this).enabled = false; return; } if ((Object)(object)spawnPoint == (Object)null) { spawnPoint = ((Component)this).transform; } foreach (AnimatedTarget animatedTarget in animatedTargets) { if ((Object)(object)animatedTarget.target == (Object)null || (Object)(object)animatedTarget.startPrefab == (Object)null || (Object)(object)animatedTarget.endPrefab == (Object)null) { Debug.LogWarning((object)"[UniversalTrigger] 有动画目标未设置完整!"); continue; } animatedTarget.startPos = animatedTarget.startPrefab.transform.localPosition; animatedTarget.startRot = animatedTarget.startPrefab.transform.localEulerAngles; animatedTarget.startScale = animatedTarget.startPrefab.transform.localScale; animatedTarget.endPos = animatedTarget.endPrefab.transform.localPosition; animatedTarget.endRot = animatedTarget.endPrefab.transform.localEulerAngles; animatedTarget.endScale = animatedTarget.endPrefab.transform.localScale; } lastState = flipper.m_isLargeAperture; } private void Update() { if (flipper.m_isLargeAperture != lastState) { TriggerEvent(); lastState = flipper.m_isLargeAperture; } } public void TriggerEvent() { //IL_001e: 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)prefabToSpawn != (Object)null) { Object.Instantiate(prefabToSpawn, spawnPoint.position, spawnPoint.rotation); } foreach (AnimatedTarget animatedTarget in animatedTargets) { if ((Object)(object)animatedTarget.target == (Object)null) { continue; } switch (animatedTarget.animationType) { case AnimationType.OneWay: if (!animatedTarget.hasPlayed) { ((MonoBehaviour)this).StartCoroutine(Animate(animatedTarget, toEnd: true)); animatedTarget.hasPlayed = true; } break; case AnimationType.Lever: ((MonoBehaviour)this).StartCoroutine(Animate(animatedTarget, !animatedTarget.isAtEnd)); animatedTarget.isAtEnd = !animatedTarget.isAtEnd; break; case AnimationType.Button: ((MonoBehaviour)this).StartCoroutine(Animate(animatedTarget, toEnd: true)); ((MonoBehaviour)this).StartCoroutine(Animate(animatedTarget, toEnd: false, animatedTarget.delayBeforeStart + animatedTarget.durationToEnd + animatedTarget.delayBeforeReturn)); break; } } } private IEnumerator Animate(AnimatedTarget target, bool toEnd, float extraDelay = 0f) { float delay = ((!toEnd) ? target.delayBeforeReturn : target.delayBeforeStart); float duration = ((!toEnd) ? target.durationToStart : target.durationToEnd); if (extraDelay > 0f) { yield return (object)new WaitForSeconds(extraDelay); } if (delay > 0f) { yield return (object)new WaitForSeconds(delay); } float t = 0f; while (t < duration) { float lerp = t / duration; Vector3 pos = Vector3.Lerp((!toEnd) ? target.endPos : target.startPos, (!toEnd) ? target.startPos : target.endPos, lerp); Vector3 rot = Vector3.Lerp((!toEnd) ? target.endRot : target.startRot, (!toEnd) ? target.startRot : target.endRot, lerp); Vector3 scale = Vector3.Lerp((!toEnd) ? target.endScale : target.startScale, (!toEnd) ? target.startScale : target.endScale, lerp); target.target.localPosition = pos; target.target.localEulerAngles = rot; target.target.localScale = scale; t += Time.deltaTime; yield return null; } target.target.localPosition = ((!toEnd) ? target.startPos : target.endPos); target.target.localEulerAngles = ((!toEnd) ? target.startRot : target.endRot); target.target.localScale = ((!toEnd) ? target.startScale : target.endScale); } } } public class Nuclear_bomb : MonoBehaviour { [Range(1f, 256f)] public float NukeDuration = 40f; private float CurrentDuration; public AnimationCurve SizeCurve; [Range(1f, 1024f)] public float SizeCurve_multiply; public float LightRadius = 2048f; public AnimationCurve LightRadius_curve; public float LightPower = 64f; public AnimationCurve LightPower_curve; private float FinalCurveVaue; private Vector3 finalShockWaveSize; public float sizeSpeed = 1f; private float finalShockSizeF; public Transform ShockWaveTransform; public Light BlastLight; public ParticleSystem blowPart; public MeshRenderer Mushrom; public float Emmis_mush; public float Emmis_steam; public AnimationCurve Mat_SizeCurve; public float _mat_SizeCurve_multiply; private void Start() { //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) finalShockWaveSize = new Vector3(0f, 0f, 0f); CurrentDuration = 0f; finalShockSizeF = 0f; } private void Update() { //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_003e: Unknown result type (might be due to invalid IL or missing references) finalShockSizeF += Time.deltaTime * sizeSpeed; finalShockWaveSize = new Vector3(finalShockSizeF, finalShockSizeF, finalShockSizeF); ShockWaveTransform.localScale = finalShockWaveSize; CurrentDuration += Time.deltaTime; FinalCurveVaue = Mathf.Clamp01(CurrentDuration / NukeDuration); BlastLight.intensity = LightPower * LightPower_curve.Evaluate(FinalCurveVaue); BlastLight.range = Mathf.Lerp(LightRadius, 0f, LightRadius_curve.Evaluate(FinalCurveVaue)); if (CurrentDuration > 40f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } public class NukeBomb : MonoBehaviour { public GameObject Prefab; private void Start() { } private void Update() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (Input.GetButtonDown("Fire1")) { Object.Instantiate(Prefab, ((Component)this).transform.position, ((Component)this).transform.rotation); } } } public class ShockWave : MonoBehaviour { public AudioSource shockwaveSound; private void Start() { } private void Update() { } private void OnTriggerEnter(Collider other) { if (((Component)other).gameObject.tag == "Player") { shockwaveSound.Play(); } } } namespace theWNbotMods { public class AirStrikeController : MonoBehaviour { [Serializable] public class BombConfig { public Transform dropPoint; public GameObject prefab; public float delay = 2f; public float forwardForce = 50f; [Header("额外参数")] public Vector3 spawnRotationOffset; public float downwardForce = 20f; } [Header("飞行参数")] public float flightSpeed = 80f; public Transform pos1; public Transform pos2; [Header("贝塞尔控制点")] public bool useAutoControlPoint = true; public float bendHeight = 50f; public float bendSide = 0f; public Transform controlPoint; [Header("多少个boomboom炸弹")] public BombConfig[] bombs; [Header("Flare 参数(机身自带隐藏的 Flare 对象)")] public GameObject flareObject; public float flareDelay = 5f; [Header("生命周期")] public float cleanupDelayAfterFlare = 5f; private float elapsedTime = 0f; private float totalTime = 0f; private Vector3 p0; private Vector3 p1; private Vector3 p2; private bool flareReleased = false; private void Awake() { if ((Object)(object)pos1 == (Object)null || (Object)(object)pos2 == (Object)null) { Debug.LogError((object)"[AirStrikeController] 请在 Inspector 设置 pos1 和 pos2。脚本已禁用。"); ((Behaviour)this).enabled = false; } else if ((Object)(object)flareObject != (Object)null) { flareObject.SetActive(false); } } private void Start() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_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_005c: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_00c8: 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_00d9: Unknown result type (might be due to invalid IL or missing references) p0 = pos1.position; p2 = pos2.position; if (useAutoControlPoint) { Vector3 val = (p0 + p2) * 0.5f; Vector3 val2 = Vector3.right * bendSide; Vector3 val3 = Vector3.up * bendHeight; p1 = val + val3 + val2; } else { if ((Object)(object)controlPoint == (Object)null) { Debug.LogError((object)"[AirStrikeController] useAutoControlPoint = false 时必须指定 controlPoint。脚本已禁用。"); ((Behaviour)this).enabled = false; return; } p1 = controlPoint.position; } ((Component)this).transform.position = p0; float num = Vector3.Distance(p0, p2); totalTime = Mathf.Max(0.01f, num / Mathf.Max(0.01f, flightSpeed)); BombConfig[] array = bombs; foreach (BombConfig bombConfig in array) { if (bombConfig != null && (Object)(object)bombConfig.prefab != (Object)null && (Object)(object)bombConfig.dropPoint != (Object)null) { ((MonoBehaviour)this).StartCoroutine(DropBombWithDelay(bombConfig)); } } } private void Update() { //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_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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_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_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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) elapsedTime += Time.deltaTime; float num = Mathf.Clamp01(elapsedTime / totalTime); Vector3 position = (1f - num) * (1f - num) * p0 + 2f * (1f - num) * num * p1 + num * num * p2; ((Component)this).transform.position = position; Vector3 val = 2f * (1f - num) * (p1 - p0) + 2f * num * (p2 - p1); if (((Vector3)(ref val)).sqrMagnitude > 1E-06f) { ((Component)this).transform.forward = ((Vector3)(ref val)).normalized; } if (!flareReleased && elapsedTime >= flareDelay) { flareReleased = true; DeployFlare(); if (cleanupDelayAfterFlare > 0f) { Object.Destroy((Object)(object)((Component)this).gameObject, cleanupDelayAfterFlare); } } } private IEnumerator DropBombWithDelay(BombConfig bomb) { yield return (object)new WaitForSeconds(bomb.delay); Quaternion spawnRot = bomb.dropPoint.rotation * Quaternion.Euler(bomb.spawnRotationOffset); GameObject newBomb = Object.Instantiate(bomb.prefab, bomb.dropPoint.position, spawnRot); Rigidbody rb = newBomb.GetComponent(); if ((Object)(object)rb != (Object)null) { rb.velocity = ((Component)this).transform.forward * bomb.forwardForce; rb.AddForce(Vector3.down * bomb.downwardForce, (ForceMode)2); } } private void DeployFlare() { if ((Object)(object)flareObject == (Object)null) { Debug.LogWarning((object)"[AirStrikeController] 未设置 flareObject,跳过 Flare 释放。"); return; } flareObject.SetActive(true); flareObject.SendMessage("StartDeploy", (SendMessageOptions)1); } private void OnValidate() { flightSpeed = Mathf.Max(0.01f, flightSpeed); flareDelay = Mathf.Max(0f, flareDelay); cleanupDelayAfterFlare = Mathf.Max(0f, cleanupDelayAfterFlare); } } public class AirburstClusterScripts : MonoBehaviour { public enum StrikeMode { Airburst, Cluster } [Header("General Settings")] public StrikeMode mode = StrikeMode.Airburst; public GameObject fragmentPrefab; public GameObject subBombPrefab; public int count = 10; public float delay = 2f; public float initialSpeed = 20f; [Header("Cone Settings (for Airburst)")] public Transform pos1; public Transform pos2; public float coneRadius = 10f; private bool triggered = false; private void Start() { ((MonoBehaviour)this).StartCoroutine(SpawnRoutine()); } private IEnumerator SpawnRoutine() { yield return (object)new WaitForSeconds(delay); TriggerSpawn(); } public void TriggerSpawn() { if (!triggered) { triggered = true; if (mode == StrikeMode.Airburst) { SpawnAirburst(); } else if (mode == StrikeMode.Cluster) { SpawnCluster(); } } } private void SpawnAirburst() { //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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00ec: 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_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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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) if ((Object)(object)pos1 == (Object)null || (Object)(object)pos2 == (Object)null) { Debug.LogError((object)"Airburst mode requires pos1 and pos2 to define cone."); return; } Vector3 val = pos2.position - pos1.position; Vector3 normalized = ((Vector3)(ref val)).normalized; float num = Vector3.Distance(pos1.position, pos2.position); float num2 = Mathf.Atan2(coneRadius, num); OrthonormalBasis(normalized, out var u, out var v); for (int i = 0; i < count; i++) { float num3 = Mathf.Lerp(1f, Mathf.Cos(num2), Random.value); float num4 = Mathf.Sqrt(1f - num3 * num3); float num5 = Random.Range(0f, (float)Math.PI * 2f); Vector3 val2 = normalized * num3 + (u * Mathf.Cos(num5) + v * Mathf.Sin(num5)) * num4; ((Vector3)(ref val2)).Normalize(); GameObject val3 = Object.Instantiate(fragmentPrefab, pos1.position, Quaternion.identity); Rigidbody component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { component.velocity = val2 * initialSpeed; } } } private void SpawnCluster() { //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_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) for (int i = 0; i < count; i++) { GameObject val = Object.Instantiate(subBombPrefab, ((Component)this).transform.position, Quaternion.identity); Rigidbody component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.velocity = Random.insideUnitSphere * initialSpeed; } } } private static void OrthonormalBasis(Vector3 axis, out Vector3 u, out Vector3 v) { //IL_0021: 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_0026: 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) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) Vector3 val = ((!(Mathf.Abs(axis.y) < 0.99f)) ? Vector3.right : Vector3.up); u = Vector3.Normalize(Vector3.Cross(val, axis)); v = Vector3.Normalize(Vector3.Cross(axis, u)); } private void OnDrawGizmosSelected() { //IL_0028: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_009b: 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_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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_00f9: 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_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) if (!((Object)(object)pos1 == (Object)null) && !((Object)(object)pos2 == (Object)null)) { Gizmos.color = Color.yellow; Gizmos.DrawLine(pos1.position, pos2.position); Vector3 val = pos2.position - pos1.position; Vector3 normalized = ((Vector3)(ref val)).normalized; OrthonormalBasis(normalized, out var u, out var v); int num = 36; Vector3 val2 = pos2.position + u * coneRadius; for (int i = 1; i <= num; i++) { float num2 = (float)i / (float)num * (float)Math.PI * 2f; Vector3 val3 = pos2.position + (u * Mathf.Cos(num2) + v * Mathf.Sin(num2)) * coneRadius; Gizmos.DrawLine(val2, val3); Gizmos.DrawLine(pos1.position, val3); val2 = val3; } } } } } public class Clustershit : MonoBehaviour { public FVRDestroyableObject DO; public string bname; private void OnCollisionEnter(Collision collision) { if (((Object)((Component)collision.collider).gameObject).name != bname) { DO.m_isDestroyed = true; } } } namespace theWNbotMods { public class DSSEagleStorm : MonoBehaviour { [Header("生成设置")] public GameObject[] eaglePrefabs; public Transform floorPos; public float spawnRadius = 50f; public float spawnInterval = 1f; public float stormDuration = 10f; [Header("角度设置")] public bool randomRotation = true; public Vector3 fixedRotationEuler; private void Start() { ((MonoBehaviour)this).StartCoroutine(StormRoutine()); } private IEnumerator StormRoutine() { float startTime = Time.time; while (Time.time - startTime < stormDuration) { SpawnEagle(); yield return (object)new WaitForSeconds(spawnInterval); } } private void SpawnEagle() { //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_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_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_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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) if (eaglePrefabs != null && eaglePrefabs.Length != 0 && !((Object)(object)floorPos == (Object)null)) { GameObject val = eaglePrefabs[Random.Range(0, eaglePrefabs.Length)]; float num = Random.Range(0f, 360f); float num2 = Random.Range(0f, spawnRadius); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(Mathf.Cos(num * ((float)Math.PI / 180f)) * num2, 0f, Mathf.Sin(num * ((float)Math.PI / 180f)) * num2); Vector3 val3 = floorPos.position + val2; Quaternion val4 = ((!randomRotation) ? Quaternion.Euler(fixedRotationEuler) : Quaternion.Euler(0f, Random.Range(0f, 360f), 0f)); Object.Instantiate(val, val3, val4); } } } public class DelayedExplosion : MonoBehaviour { [Header("爆炸参数")] public float delay = 0.5f; public GameObject[] explosionPrefabs; public Transform spawnPoint; [Header("插入地表参数")] public float embedDepth = 0.5f; private void Start() { ((MonoBehaviour)this).StartCoroutine(ExplodeAfterDelay()); } private IEnumerator ExplodeAfterDelay() { yield return (object)new WaitForSeconds(delay); Transform transform = ((Component)this).transform; transform.position += Vector3.down * embedDepth; GameObject[] array = explosionPrefabs; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { Vector3 val2 = ((!((Object)(object)spawnPoint != (Object)null)) ? ((Component)this).transform.position : spawnPoint.position); Quaternion val3 = ((!((Object)(object)spawnPoint != (Object)null)) ? Quaternion.identity : spawnPoint.rotation); GameObject val4 = Object.Instantiate(val, val2, val3); ParticleSystem[] componentsInChildren = val4.GetComponentsInChildren(); foreach (ParticleSystem val5 in componentsInChildren) { val5.Play(); } AudioSource[] componentsInChildren2 = val4.GetComponentsInChildren(); foreach (AudioSource val6 in componentsInChildren2) { val6.Play(); } } } Object.Destroy((Object)(object)((Component)this).gameObject); } } public class DestroyerMover : MonoBehaviour { [Header("路径点")] public Transform entryPos; public Transform stayPoint; public Transform exitPos; public Transform strikePos; [Header("速度设置")] public float entrySpeed = 300f; public float exitSpeed = 400f; public float rotateSpeed = 90f; [Header("时间设置")] public float waitBeforeStrike = 1f; public float strikeDuration = 2f; public float waitAfterExit = 3f; [Header("Prefab 设置")] public GameObject strikePrefab; [Header("音效控制")] public GameObject arriveStayPrefab; public float arriveSoundDuration = 2f; public GameObject leaveStayPrefab; public float leaveSoundLeadTime = 0.5f; [Header("驱逐舰模型设置")] public Transform destroyerRoot; public Vector3 modelForwardOffsetEuler; public bool yawOnly = true; private void Start() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)destroyerRoot == (Object)null) { Debug.LogError((object)"[DestroyerMover] 请在 Inspector 指定 destroyerRoot(驱逐舰模型子物体)"); ((Behaviour)this).enabled = false; return; } if ((Object)(object)entryPos != (Object)null) { destroyerRoot.position = entryPos.position; } ((MonoBehaviour)this).StartCoroutine(DestroyerRoutine()); } private IEnumerator DestroyerRoutine() { if ((Object)(object)arriveStayPrefab != (Object)null) { arriveStayPrefab.SetActive(true); AudioSource audio2 = arriveStayPrefab.GetComponent(); if ((Object)(object)audio2 != (Object)null) { audio2.Play(); } yield return (object)new WaitForSeconds(arriveSoundDuration); } yield return MoveToPoint(stayPoint.position, entrySpeed); yield return (object)new WaitForSeconds(waitBeforeStrike); if ((Object)(object)strikePrefab != (Object)null && (Object)(object)strikePos != (Object)null) { Object.Instantiate(strikePrefab, strikePos.position, strikePos.rotation); } if ((Object)(object)leaveStayPrefab != (Object)null) { yield return (object)new WaitForSeconds(Mathf.Max(0f, strikeDuration - leaveSoundLeadTime)); leaveStayPrefab.SetActive(true); AudioSource audio = leaveStayPrefab.GetComponent(); if ((Object)(object)audio != (Object)null) { audio.Play(); } yield return (object)new WaitForSeconds(leaveSoundLeadTime); } else { yield return (object)new WaitForSeconds(strikeDuration); } yield return MoveToPoint(exitPos.position, exitSpeed); yield return (object)new WaitForSeconds(waitAfterExit); Object.Destroy((Object)(object)((Component)this).gameObject); } private IEnumerator MoveToPoint(Vector3 targetPos, float speed) { //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) Quaternion forwardOffset = Quaternion.Euler(modelForwardOffsetEuler); while (Vector3.Distance(destroyerRoot.position, targetPos) > 0.1f) { destroyerRoot.position = Vector3.MoveTowards(destroyerRoot.position, targetPos, speed * Time.deltaTime); Vector3 moveDir = targetPos - destroyerRoot.position; if (yawOnly) { moveDir.y = 0f; } if (((Vector3)(ref moveDir)).sqrMagnitude > 0.001f) { Quaternion val = Quaternion.LookRotation(((Vector3)(ref moveDir)).normalized, Vector3.up) * forwardOffset; destroyerRoot.rotation = Quaternion.RotateTowards(destroyerRoot.rotation, val, rotateSpeed * Time.deltaTime); } yield return null; } } } public class OneWayMover : MonoBehaviour { [Header("移动点")] public Transform pos1; public Transform pos2; public Transform targetObject; [Header("移动设置")] public float moveDuration = 2f; [Header("音效设置")] public AudioSource audioAtStart; public AudioSource audioAtEnd; [Header("新功能")] public bool EveryActiveMove = false; private Coroutine moveRoutine; private void Start() { if ((Object)(object)targetObject == (Object)null) { targetObject = ((Component)this).transform; } if (!EveryActiveMove) { moveRoutine = ((MonoBehaviour)this).StartCoroutine(MoveRoutine()); } } private void OnEnable() { if (EveryActiveMove) { if ((Object)(object)targetObject == (Object)null) { targetObject = ((Component)this).transform; } moveRoutine = ((MonoBehaviour)this).StartCoroutine(MoveRoutine()); } } private IEnumerator MoveRoutine() { if ((Object)(object)audioAtStart != (Object)null) { ((Component)audioAtStart).gameObject.SetActive(true); audioAtStart.Play(); } yield return MoveBetween(pos1.position, pos2.position, moveDuration); if ((Object)(object)audioAtEnd != (Object)null) { ((Component)audioAtEnd).gameObject.SetActive(true); audioAtEnd.Play(); } moveRoutine = null; } private IEnumerator MoveBetween(Vector3 start, Vector3 end, float duration) { //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) //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) float elapsed = 0f; while (elapsed < duration) { elapsed += Time.deltaTime; float t = Mathf.Clamp01(elapsed / duration); targetObject.position = Vector3.Lerp(start, end, t); yield return null; } targetObject.position = end; } } public class OrbitalStrikeController : MonoBehaviour { [Header("炮击参数")] public GameObject shellPrefab; public GameObject explosionPrefab; public float fireInterval = 0.2f; public float duration = 10f; public float shellSpeed = 100f; [Header("锥形散布参数")] [Range(0f, 45f)] public float coneAngle = 5f; public Transform firePos; public Transform landPos; [Header("三连发模式参数")] public bool burstMode = false; public int burstCount = 3; public float burstInterval = 0.1f; [Header("启动延迟")] public float startDelay = 0f; [Header("状态变量")] public bool ispublicFiring = false; private bool isFiring = false; public bool shouldFire = true; private void Start() { if ((Object)(object)shellPrefab == (Object)null || (Object)(object)firePos == (Object)null || (Object)(object)landPos == (Object)null) { Debug.LogError((object)"[OrbitalStrikeController] 请在 Inspector 设置 shellPrefab、firePos 和 landPos。"); ((Behaviour)this).enabled = false; } else { ((MonoBehaviour)this).StartCoroutine(DelayedStart()); } } private IEnumerator DelayedStart() { shouldFire = false; yield return (object)new WaitForSeconds(startDelay); shouldFire = true; } private void FixedUpdate() { ispublicFiring = isFiring; if (shouldFire) { ((MonoBehaviour)this).StartCoroutine(FireShells()); shouldFire = false; } } private IEnumerator FireShells() { isFiring = true; for (float elapsed = 0f; elapsed < duration; elapsed += fireInterval) { if (burstMode) { for (int i = 0; i < burstCount; i++) { SpawnShell(); yield return (object)new WaitForSeconds(burstInterval); } } else { SpawnShell(); } yield return (object)new WaitForSeconds(fireInterval); } isFiring = false; } private void SpawnShell() { //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) //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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) Vector3 val = landPos.position - firePos.position; Vector3 normalized = ((Vector3)(ref val)).normalized; Quaternion val2 = Quaternion.AngleAxis(Random.Range(0f, coneAngle), Random.onUnitSphere); Vector3 val3 = val2 * normalized; GameObject val4 = Object.Instantiate(shellPrefab, firePos.position, Quaternion.LookRotation(val3)); Rigidbody component = val4.GetComponent(); if ((Object)(object)component != (Object)null) { component.velocity = val3 * shellSpeed; } if ((Object)(object)explosionPrefab != (Object)null) { Object.Instantiate(explosionPrefab, val4.transform.position, Quaternion.identity); } } } public class PlayRandomAudioWhenSpawn : MonoBehaviour { [Header("音频源 (挂在物体上的 AudioSource)")] public AudioSource audioSource; [Header("可选音频剪辑列表")] public AudioClip[] audioClips; private void Start() { if ((Object)(object)audioSource != (Object)null && audioClips != null && audioClips.Length > 0) { int num = Random.Range(0, audioClips.Length); AudioClip val = audioClips[num]; audioSource.PlayOneShot(val); } else { Debug.LogWarning((object)"[RandomAudioOnSpawn] 缺少 AudioSource 或音频剪辑,无法播放。"); } } } public class ShredderMissileController : MonoBehaviour { [Header("路径点设置")] public Transform launchPos; public Transform targetPos; [Header("导弹设置")] public GameObject missilePrefab; public float flightTime = 3f; public float rotateSpeed = 180f; public float warningDuration = 2f; [Header("音效设置")] public AudioSource warningAudio; private GameObject missileInstance; private void Start() { ((MonoBehaviour)this).StartCoroutine(MissileRoutine()); } private IEnumerator MissileRoutine() { if ((Object)(object)warningAudio != (Object)null) { ((Component)warningAudio).gameObject.SetActive(true); warningAudio.Play(); } yield return (object)new WaitForSeconds(warningDuration); if ((Object)(object)missilePrefab != (Object)null && (Object)(object)launchPos != (Object)null) { missileInstance = Object.Instantiate(missilePrefab, launchPos.position, Quaternion.identity); ((MonoBehaviour)this).StartCoroutine(FlyMissile()); } } private IEnumerator FlyMissile() { Vector3 start = launchPos.position; Vector3 end = targetPos.position; float elapsed = 0f; while (elapsed < flightTime) { elapsed += Time.deltaTime; float t = elapsed / flightTime; Vector3 pos = Vector3.Lerp(start, end, t); pos.y += Mathf.Sin(t * (float)Math.PI) * 20f; missileInstance.transform.position = pos; Vector3 val = end - missileInstance.transform.position; Vector3 dir = ((Vector3)(ref val)).normalized; Quaternion targetRot = Quaternion.LookRotation(dir, Vector3.up); missileInstance.transform.rotation = Quaternion.RotateTowards(missileInstance.transform.rotation, targetRot, rotateSpeed * Time.deltaTime); yield return null; } Object.Destroy((Object)(object)missileInstance); } } public class SuperKillAfter : MonoBehaviour { [Header("销毁延迟时间 (秒)")] public float killDelay = 5f; private void Start() { Object.Destroy((Object)(object)((Component)this).gameObject, killDelay); } } } public class LightFlicker : MonoBehaviour { public bool flicker = true; public float flickerIntensity = 0.5f; private float baseIntensity; private Light lightComp; private void Awake() { lightComp = ((Component)this).gameObject.GetComponent(); baseIntensity = lightComp.intensity; } private void Update() { if (flicker) { float num = Mathf.PerlinNoise(Random.Range(0f, 1000f), Time.time); lightComp.intensity = Mathf.Lerp(baseIntensity - flickerIntensity, baseIntensity, num); } } } namespace thewnbot.MW22_Stim { [BepInPlugin("thewnbot.MW22_Stim", "MW22_Stim", "1.0.0")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class MW22_StimPlugin : 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(), "thewnbot.MW22_Stim"); OtherLoader.RegisterDirectLoad(BasePath, "thewnbot.MW22_Stim", "", "", "mw22stim", ""); } } } namespace theWNbotMods { [DisallowMultipleComponent] public class QuastarCannon : FVRFireArm { [Serializable] public class ChargeSlot { public GameObject animatedObject; public Transform startTransform; public Transform endTransform; [NonSerialized] public Vector3 startPos; [NonSerialized] public Quaternion startRot; [NonSerialized] public Vector3 startScale; [NonSerialized] public Vector3 endPos; [NonSerialized] public Quaternion endRot; [NonSerialized] public Vector3 endScale; } [Serializable] public class TimedParticleEvent { public float triggerTime = 1f; public List particlePrefabs = new List(); public int countPerPrefab = 1; public Transform spawnPoint; public float spawnRadius = 0f; [NonSerialized] public bool triggered = false; } public enum TriggerAxis { X, Y, Z } [Header("Charge / Cooldown")] public float chargeTime = 4f; public float cooldownTime = 10f; public bool revertOnEarlyRelease = true; [Header("Projectile")] public GameObject projectilePrefab; public float projectileSpeed = 80f; public Transform projectileSpawnPoint; [Header("Charge Visuals")] public ParticleSystem muzzleChargeParticles; public float particleMinScale = 0.25f; public float particleMaxScale = 1.5f; [Header("Haptics")] public bool enableHaptics = true; public float chargeHapticInterval = 0.12f; public float chargeHapticPulseDuration = 0.06f; public int fireHapticStrengthScale = 7; [Header("Haptic Profiles (H3VR Buzz)")] public FVRHapticBuzzProfile chargeBuzzProfile; public FVRHapticBuzzProfile fireBuzzProfile; [Header("Charge Slots (progress bars / animated elements)")] public List chargeSlots = new List(); [Header("Timed Particle Events")] public List timedParticleEvents = new List(); [Header("Animation Timing")] public float revertDuration = 0.5f; [Header("Audio")] public AudioSource sfxSource; public AudioClip chargeStartSound; public AudioClip chargeCompleteSound; public AudioClip fireSound; [Range(0f, 1f)] public float chargeStartVolume = 1f; [Range(0f, 1f)] public float chargeCompleteVolume = 1f; [Range(0f, 1f)] public float fireSoundVolume = 1f; [Header("Charge Audio (dedicated)")] public AudioSource chargeAudioSource; public bool autoCreateChargeAudioSource = true; [Header("Charge Cancel Audio")] public AudioClip chargeHalfSound; public AudioClip chargeCancelSound; [Range(0f, 1f)] public float chargeHalfVolume = 1f; [Range(0f, 1f)] public float chargeCancelVolume = 1f; private bool _halfSoundPlayed = false; [Header("Trigger Animation")] public Transform triggerAnimatedObject; public TriggerAxis triggerAxis = TriggerAxis.Z; public Vector3 triggerStartLocalPos = Vector3.zero; public Vector3 triggerPressedLocalPos = Vector3.zero; public bool useAutoCachePressedOffset = true; public Vector3 autoPressedOffset = new Vector3(0f, 0f, -0.02f); [NonSerialized] private bool _triggerPositionsCached = false; [Header("Charge Light (optional)")] public Light chargeLight; public float lightStartIntensity = 0f; public float lightEndIntensity = 1f; [NonSerialized] private float _cachedLightStartIntensity = 0f; [NonSerialized] private bool _lightCached = false; [Header("Editor Debug")] public bool DebugTriggerHold = false; private float _chargeTimer = 0f; private bool _isCharging = false; private bool _isCooling = false; private bool _hasFiredThisCharge = false; private bool _chargeCompletePlayed = false; private Vector3 _muzzleParticleBaseScale = Vector3.one; private float _muzzleParticleBaseStartSize = 1f; private MainModule _muzzleMainModule; private bool _muzzleHasMain = false; private Coroutine _revertCoroutine = null; private Coroutine _cooldownCoroutine = null; private Coroutine _cooldownVisualCoroutine = null; private Coroutine _hapticChargeCoroutine = null; private void Start() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) CacheSlotTransforms(); CacheMuzzleParticle(); CacheTriggerTransforms(); CacheLight(); if ((Object)(object)sfxSource == (Object)null) { sfxSource = ((Component)this).GetComponent(); } if ((Object)(object)sfxSource == (Object)null && ((Object)(object)chargeStartSound != (Object)null || (Object)(object)chargeCompleteSound != (Object)null || (Object)(object)fireSound != (Object)null)) { sfxSource = ((Component)this).gameObject.AddComponent(); sfxSource.playOnAwake = false; } if ((Object)(object)chargeAudioSource == (Object)null && autoCreateChargeAudioSource) { GameObject val = new GameObject("ChargeAudioSource"); val.transform.SetParent(((Component)this).transform, false); chargeAudioSource = val.AddComponent(); chargeAudioSource.playOnAwake = false; chargeAudioSource.loop = false; if ((Object)(object)sfxSource != (Object)null) { chargeAudioSource.spatialBlend = sfxSource.spatialBlend; chargeAudioSource.rolloffMode = sfxSource.rolloffMode; chargeAudioSource.minDistance = sfxSource.minDistance; chargeAudioSource.maxDistance = sfxSource.maxDistance; } } if ((Object)(object)chargeAudioSource != (Object)null && (Object)(object)chargeStartSound != (Object)null) { chargeAudioSource.clip = chargeStartSound; chargeAudioSource.volume = chargeStartVolume; chargeAudioSource.loop = false; } } private void CacheLight() { if ((Object)(object)chargeLight == (Object)null) { _lightCached = true; return; } if (lightStartIntensity == 0f) { _cachedLightStartIntensity = chargeLight.intensity; } else { _cachedLightStartIntensity = lightStartIntensity; } _lightCached = true; chargeLight.intensity = _cachedLightStartIntensity; } private void OnValidate() { if (chargeTime <= 0f) { chargeTime = 0.1f; } if (cooldownTime < 0f) { cooldownTime = 0f; } if (projectileSpeed < 0f) { projectileSpeed = 0f; } if (timedParticleEvents != null) { foreach (TimedParticleEvent timedParticleEvent in timedParticleEvents) { if (timedParticleEvent.countPerPrefab < 0) { timedParticleEvent.countPerPrefab = 0; } if (timedParticleEvent.triggerTime < 0f) { timedParticleEvent.triggerTime = 0f; } if (timedParticleEvent.spawnRadius < 0f) { timedParticleEvent.spawnRadius = 0f; } } } if (chargeHapticInterval < 0.01f) { chargeHapticInterval = 0.01f; } if (chargeHapticPulseDuration < 0f) { chargeHapticPulseDuration = 0f; } if (fireHapticStrengthScale < 0) { fireHapticStrengthScale = 0; } if (fireHapticStrengthScale > 10) { fireHapticStrengthScale = 10; } } private void CacheSlotTransforms() { //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_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_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_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_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_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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_0188: Unknown result type (might be due to invalid IL or missing references) foreach (ChargeSlot chargeSlot in chargeSlots) { if (!((Object)(object)chargeSlot.animatedObject == (Object)null)) { if ((Object)(object)chargeSlot.startTransform != (Object)null) { chargeSlot.startPos = chargeSlot.startTransform.localPosition; chargeSlot.startRot = chargeSlot.startTransform.localRotation; chargeSlot.startScale = chargeSlot.startTransform.localScale; } else { chargeSlot.startPos = chargeSlot.animatedObject.transform.localPosition; chargeSlot.startRot = chargeSlot.animatedObject.transform.localRotation; chargeSlot.startScale = chargeSlot.animatedObject.transform.localScale; } if ((Object)(object)chargeSlot.endTransform != (Object)null) { chargeSlot.endPos = chargeSlot.endTransform.localPosition; chargeSlot.endRot = chargeSlot.endTransform.localRotation; chargeSlot.endScale = chargeSlot.endTransform.localScale; } else { chargeSlot.endPos = chargeSlot.animatedObject.transform.localPosition; chargeSlot.endRot = chargeSlot.animatedObject.transform.localRotation; chargeSlot.endScale = chargeSlot.animatedObject.transform.localScale; } chargeSlot.animatedObject.transform.localPosition = chargeSlot.startPos; chargeSlot.animatedObject.transform.localRotation = chargeSlot.startRot; chargeSlot.animatedObject.transform.localScale = chargeSlot.startScale; } } } private void CacheMuzzleParticle() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_004d: 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) if ((Object)(object)muzzleChargeParticles == (Object)null) { return; } _muzzleParticleBaseScale = ((Component)muzzleChargeParticles).transform.localScale; try { _muzzleMainModule = muzzleChargeParticles.main; MinMaxCurve startSize = ((MainModule)(ref _muzzleMainModule)).startSize; if ((int)((MinMaxCurve)(ref startSize)).mode == 0) { MinMaxCurve startSize2 = ((MainModule)(ref _muzzleMainModule)).startSize; _muzzleParticleBaseStartSize = ((MinMaxCurve)(ref startSize2)).constant; } else { _muzzleParticleBaseStartSize = 1f; } _muzzleHasMain = true; } catch { _muzzleHasMain = false; } } private void CacheTriggerTransforms() { //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_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_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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)triggerAnimatedObject == (Object)null) { _triggerPositionsCached = true; return; } if (triggerStartLocalPos == Vector3.zero) { triggerStartLocalPos = triggerAnimatedObject.localPosition; } if (triggerPressedLocalPos == Vector3.zero && useAutoCachePressedOffset) { triggerPressedLocalPos = triggerStartLocalPos + autoPressedOffset; } _triggerPositionsCached = true; } private void UpdateTriggerAnimation(float triggerFloat) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00d3: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)triggerAnimatedObject == (Object)null)) { if (!_triggerPositionsCached) { CacheTriggerTransforms(); } float num = Mathf.Clamp01(triggerFloat); Vector3 val = triggerStartLocalPos; Vector3 val2 = triggerPressedLocalPos; Vector3 localPosition = triggerAnimatedObject.localPosition; switch (triggerAxis) { case TriggerAxis.X: localPosition.x = Mathf.Lerp(val.x, val2.x, num); break; case TriggerAxis.Y: localPosition.y = Mathf.Lerp(val.y, val2.y, num); break; case TriggerAxis.Z: localPosition.z = Mathf.Lerp(val.z, val2.z, num); break; } triggerAnimatedObject.localPosition = localPosition; } } public override void FVRUpdate() { ((FVRFireArm)this).FVRUpdate(); if (_isCooling) { return; } bool flag = (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null; bool flag2 = flag && ((FVRInteractiveObject)this).m_hand.Input.TriggerDown; bool flag3 = flag && ((FVRInteractiveObject)this).m_hand.Input.TriggerPressed; bool flag4 = flag && ((FVRInteractiveObject)this).m_hand.Input.TriggerUp; bool flag5 = flag3 || DebugTriggerHold; float triggerFloat = 0f; if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null) { triggerFloat = ((FVRInteractiveObject)this).m_hand.Input.TriggerFloat; } UpdateTriggerAnimation(triggerFloat); if (flag5 && !_isCharging && !_isCooling) { StartCharging(); } if (_isCharging && flag5) { _chargeTimer += Time.deltaTime; float num = Mathf.Clamp01(_chargeTimer / chargeTime); UpdateChargeVisuals(num); CheckAndTriggerTimedParticles(); if (!_chargeCompletePlayed && num >= 1f) { _chargeCompletePlayed = true; if ((Object)(object)sfxSource != (Object)null && (Object)(object)chargeCompleteSound != (Object)null) { sfxSource.PlayOneShot(chargeCompleteSound, chargeCompleteVolume); } } if (!_hasFiredThisCharge && num >= 1f) { FireChargedShot(); } if (!_halfSoundPlayed && num >= 0.5f) { _halfSoundPlayed = true; if ((Object)(object)sfxSource != (Object)null && (Object)(object)chargeHalfSound != (Object)null) { sfxSource.PlayOneShot(chargeHalfSound, chargeHalfVolume); } } } if (_isCharging && !flag5) { if (!_hasFiredThisCharge) { if (revertOnEarlyRelease) { StartRevertAnimation(); } else { ResetChargeVisuals(); } } StopCharging(); } if (flag2 && !_isCharging && _isCooling) { } } private void StartCharging() { _isCharging = true; _chargeTimer = 0f; _hasFiredThisCharge = false; _chargeCompletePlayed = false; _halfSoundPlayed = false; if ((Object)(object)muzzleChargeParticles != (Object)null && !muzzleChargeParticles.isPlaying) { muzzleChargeParticles.Play(); } if (timedParticleEvents != null) { foreach (TimedParticleEvent timedParticleEvent in timedParticleEvents) { timedParticleEvent.triggered = false; } } if ((Object)(object)chargeAudioSource != (Object)null && (Object)(object)chargeStartSound != (Object)null) { chargeAudioSource.clip = chargeStartSound; chargeAudioSource.volume = chargeStartVolume; chargeAudioSource.loop = false; try { if (!chargeAudioSource.isPlaying) { chargeAudioSource.Play(); } } catch { } } else if ((Object)(object)sfxSource != (Object)null && (Object)(object)chargeStartSound != (Object)null) { sfxSource.PlayOneShot(chargeStartSound, chargeStartVolume); } if (enableHaptics && _hapticChargeCoroutine == null) { _hapticChargeCoroutine = ((MonoBehaviour)this).StartCoroutine(HapticChargeRoutine()); } } private void StopCharging() { _isCharging = false; if (!_hasFiredThisCharge && _chargeTimer > 0f) { if ((Object)(object)chargeAudioSource != (Object)null) { try { if (chargeAudioSource.isPlaying) { chargeAudioSource.Stop(); } } catch { } try { chargeAudioSource.clip = null; } catch { } } if ((Object)(object)sfxSource != (Object)null && (Object)(object)chargeCancelSound != (Object)null) { sfxSource.PlayOneShot(chargeCancelSound, chargeCancelVolume); } } else if ((Object)(object)chargeAudioSource != (Object)null) { try { if (chargeAudioSource.isPlaying) { chargeAudioSource.Stop(); } } catch { } try { chargeAudioSource.clip = null; } catch { } } _chargeTimer = 0f; _chargeCompletePlayed = false; _halfSoundPlayed = false; if (timedParticleEvents != null) { foreach (TimedParticleEvent timedParticleEvent in timedParticleEvents) { timedParticleEvent.triggered = false; } } StopHaptics(); if ((Object)(object)chargeLight != (Object)null && _lightCached) { chargeLight.intensity = _cachedLightStartIntensity; } } private IEnumerator HapticChargeRoutine() { while (true) { float progress = Mathf.Clamp01(_chargeTimer / chargeTime); if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null && enableHaptics) { bool flag = false; if ((Object)(object)chargeBuzzProfile != (Object)null) { try { MethodInfo method = ((object)((FVRInteractiveObject)this).m_hand).GetType().GetMethod("Buzz", new Type[1] { typeof(FVRHapticBuzzProfile) }); if ((object)method != null) { method.Invoke(((FVRInteractiveObject)this).m_hand, new object[1] { chargeBuzzProfile }); flag = true; } else { MethodInfo[] methods = ((object)((FVRInteractiveObject)this).m_hand).GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { if (methodInfo.Name == "Buzz") { ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length == 1 && parameters[0].ParameterType.IsAssignableFrom(typeof(FVRHapticBuzzProfile))) { methodInfo.Invoke(((FVRInteractiveObject)this).m_hand, new object[1] { chargeBuzzProfile }); flag = true; break; } } } } } catch (Exception ex) { Debug.LogWarning((object)("[QuastarCannon] Buzz reflection failed: " + ex.Message)); flag = false; } } if (!flag) { try { int num = Mathf.Clamp(Mathf.RoundToInt(Mathf.Lerp(1f, 5f, progress) * 2f / 10f * 255f), 1, 255); byte b = (byte)num; float num2 = Mathf.Max(0.001f, chargeHapticPulseDuration); ((FVRInteractiveObject)this).m_hand.ForceTubeRumble(b, num2); if ((Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand != (Object)null) { ((FVRInteractiveObject)this).m_hand.OtherHand.ForceTubeRumble((byte)Mathf.Clamp(num / 2, 1, 255), num2); } } catch { } } } yield return (object)new WaitForSeconds(Mathf.Max(0.01f, chargeHapticInterval)); } } private void StopHaptics() { if (_hapticChargeCoroutine != null) { try { ((MonoBehaviour)this).StopCoroutine(_hapticChargeCoroutine); } catch { } _hapticChargeCoroutine = null; } } private void UpdateChargeVisuals(float progress) { //IL_003a: 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_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_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_006c: 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_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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_0106: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_0150: Unknown result type (might be due to invalid IL or missing references) progress = Mathf.Clamp01(progress); if ((Object)(object)muzzleChargeParticles != (Object)null) { float num = Mathf.Lerp(particleMinScale, particleMaxScale, progress); ((Component)muzzleChargeParticles).transform.localScale = _muzzleParticleBaseScale * num; if (_muzzleHasMain) { MainModule main = muzzleChargeParticles.main; MinMaxCurve startSize = ((MainModule)(ref main)).startSize; if ((int)((MinMaxCurve)(ref startSize)).mode == 0) { float num2 = Mathf.Lerp(_muzzleParticleBaseStartSize * particleMinScale, _muzzleParticleBaseStartSize * particleMaxScale, progress); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(num2); } } } foreach (ChargeSlot chargeSlot in chargeSlots) { if (!((Object)(object)chargeSlot.animatedObject == (Object)null)) { Vector3 localPosition = Vector3.Lerp(chargeSlot.startPos, chargeSlot.endPos, progress); Quaternion localRotation = Quaternion.Slerp(chargeSlot.startRot, chargeSlot.endRot, progress); Vector3 localScale = Vector3.Lerp(chargeSlot.startScale, chargeSlot.endScale, progress); chargeSlot.animatedObject.transform.localPosition = localPosition; chargeSlot.animatedObject.transform.localRotation = localRotation; chargeSlot.animatedObject.transform.localScale = localScale; } } if ((Object)(object)chargeLight != (Object)null) { if (!_lightCached) { CacheLight(); } float cachedLightStartIntensity = _cachedLightStartIntensity; float num3 = lightEndIntensity; chargeLight.intensity = Mathf.Lerp(cachedLightStartIntensity, num3, progress); } } private void CheckAndTriggerTimedParticles() { if (timedParticleEvents == null || timedParticleEvents.Count == 0) { return; } foreach (TimedParticleEvent timedParticleEvent in timedParticleEvents) { if (timedParticleEvent != null && !timedParticleEvent.triggered && _chargeTimer + Mathf.Epsilon >= timedParticleEvent.triggerTime) { timedParticleEvent.triggered = true; SpawnTimedParticles(timedParticleEvent); } } } private void SpawnTimedParticles(TimedParticleEvent e) { //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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_025c: 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_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) if (e == null || e.particlePrefabs == null || e.particlePrefabs.Count == 0) { return; } Transform val = (((Object)(object)e.spawnPoint != (Object)null) ? e.spawnPoint : ((!((Object)(object)projectileSpawnPoint != (Object)null)) ? ((FVRFireArm)this).GetMuzzle() : projectileSpawnPoint)); if ((Object)(object)val == (Object)null) { val = ((Component)this).transform; } for (int i = 0; i < e.particlePrefabs.Count; i++) { GameObject val2 = e.particlePrefabs[i]; if ((Object)(object)val2 == (Object)null) { continue; } for (int j = 0; j < Mathf.Max(1, e.countPerPrefab); j++) { GameObject val3 = Object.Instantiate(val2, val.position, val.rotation, val); if (e.spawnRadius > 0f) { Vector3 localPosition = Random.insideUnitSphere * e.spawnRadius; val3.transform.localPosition = localPosition; val3.transform.localRotation = Quaternion.Euler(Random.Range(-10f, 10f), Random.Range(0f, 360f), 0f); } else { val3.transform.localPosition = Vector3.zero; val3.transform.localRotation = Quaternion.identity; } ParticleSystem component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { try { component.Stop(true, (ParticleSystemStopBehavior)0); } catch { } component.Play(true); MainModule main = component.main; float duration = ((MainModule)(ref main)).duration; float num = 0f; MainModule main2 = component.main; MinMaxCurve startLifetime = ((MainModule)(ref main2)).startLifetime; if ((int)((MinMaxCurve)(ref startLifetime)).mode == 0) { MinMaxCurve startLifetime2 = ((MainModule)(ref main2)).startLifetime; num = ((MinMaxCurve)(ref startLifetime2)).constant; } else { MinMaxCurve startLifetime3 = ((MainModule)(ref main2)).startLifetime; num = ((MinMaxCurve)(ref startLifetime3)).constantMax; } Object.Destroy((Object)(object)val3, duration + num + 0.5f); continue; } ParticleSystem[] componentsInChildren = val3.GetComponentsInChildren(); if (componentsInChildren != null && componentsInChildren.Length > 0) { float num2 = 0f; ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val4 in array) { try { val4.Stop(true, (ParticleSystemStopBehavior)0); } catch { } val4.Play(true); MainModule main3 = val4.main; float duration2 = ((MainModule)(ref main3)).duration; float num3 = 0f; MainModule main4 = val4.main; MinMaxCurve startLifetime4 = ((MainModule)(ref main4)).startLifetime; if ((int)((MinMaxCurve)(ref startLifetime4)).mode == 0) { MinMaxCurve startLifetime5 = ((MainModule)(ref main4)).startLifetime; num3 = ((MinMaxCurve)(ref startLifetime5)).constant; } else { MinMaxCurve startLifetime6 = ((MainModule)(ref main4)).startLifetime; num3 = ((MinMaxCurve)(ref startLifetime6)).constantMax; } float num4 = duration2 + num3; if (num4 > num2) { num2 = num4; } } Object.Destroy((Object)(object)val3, num2 + 0.5f); } else { Object.Destroy((Object)(object)val3, 5f); } } } } private void StartRevertAnimation() { if (_revertCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_revertCoroutine); } float fromProgress = Mathf.Clamp01(_chargeTimer / chargeTime); if (revertDuration <= 0f) { ResetChargeVisuals(); } else { _revertCoroutine = ((MonoBehaviour)this).StartCoroutine(RevertRoutine(fromProgress)); } } private IEnumerator RevertRoutine(float fromProgress) { float elapsed = 0f; float dur = Mathf.Max(0.0001f, revertDuration * fromProgress * chargeTime); while (elapsed < dur) { elapsed += Time.deltaTime; float t = Mathf.Clamp01(elapsed / dur); float p = Mathf.Lerp(fromProgress, 0f, t); UpdateChargeVisuals(p); yield return null; } UpdateChargeVisuals(0f); _revertCoroutine = null; } private void ResetChargeVisuals() { //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_00ac: 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_00b4: 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_010f: 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_013b: Unknown result type (might be due to invalid IL or missing references) if (_revertCoroutine != null) { try { ((MonoBehaviour)this).StopCoroutine(_revertCoroutine); } catch { } _revertCoroutine = null; } if (_cooldownVisualCoroutine != null) { try { ((MonoBehaviour)this).StopCoroutine(_cooldownVisualCoroutine); } catch { } _cooldownVisualCoroutine = null; } if ((Object)(object)muzzleChargeParticles != (Object)null) { muzzleChargeParticles.Stop(); ((Component)muzzleChargeParticles).transform.localScale = _muzzleParticleBaseScale; if (_muzzleHasMain) { MainModule main = muzzleChargeParticles.main; MinMaxCurve startSize = ((MainModule)(ref main)).startSize; if ((int)((MinMaxCurve)(ref startSize)).mode == 0) { ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(_muzzleParticleBaseStartSize); } } } foreach (ChargeSlot chargeSlot in chargeSlots) { if (!((Object)(object)chargeSlot.animatedObject == (Object)null)) { chargeSlot.animatedObject.transform.localPosition = chargeSlot.startPos; chargeSlot.animatedObject.transform.localRotation = chargeSlot.startRot; chargeSlot.animatedObject.transform.localScale = chargeSlot.startScale; } } if (timedParticleEvents != null) { foreach (TimedParticleEvent timedParticleEvent in timedParticleEvents) { timedParticleEvent.triggered = false; } } _chargeCompletePlayed = false; } private void FireChargedShot() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_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) _hasFiredThisCharge = true; _isCharging = false; UpdateChargeVisuals(1f); Transform val = ((!((Object)(object)projectileSpawnPoint != (Object)null)) ? ((FVRFireArm)this).GetMuzzle() : projectileSpawnPoint); if ((Object)(object)projectilePrefab != (Object)null && (Object)(object)val != (Object)null) { GameObject val2 = Object.Instantiate(projectilePrefab, val.position, val.rotation); Rigidbody component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; component.AddForce(val.forward * projectileSpeed, (ForceMode)2); } } if ((Object)(object)chargeAudioSource != (Object)null) { try { if (chargeAudioSource.isPlaying) { chargeAudioSource.Stop(); } } catch { } try { chargeAudioSource.clip = null; } catch { } } if ((Object)(object)sfxSource != (Object)null && (Object)(object)fireSound != (Object)null) { sfxSource.PlayOneShot(fireSound, fireSoundVolume); } try { ((FVRFireArm)this).FireMuzzleSmoke(); } catch { } StopHaptics(); if (enableHaptics && (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null) { bool flag = false; if ((Object)(object)fireBuzzProfile != (Object)null) { try { MethodInfo method = ((object)((FVRInteractiveObject)this).m_hand).GetType().GetMethod("Buzz", new Type[1] { typeof(FVRHapticBuzzProfile) }); if ((object)method != null) { method.Invoke(((FVRInteractiveObject)this).m_hand, new object[1] { fireBuzzProfile }); flag = true; } else { MethodInfo[] methods = ((object)((FVRInteractiveObject)this).m_hand).GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { if (methodInfo.Name == "Buzz") { ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length == 1 && parameters[0].ParameterType.IsAssignableFrom(typeof(FVRHapticBuzzProfile))) { methodInfo.Invoke(((FVRInteractiveObject)this).m_hand, new object[1] { fireBuzzProfile }); flag = true; break; } } } } } catch { flag = false; } } if (!flag) { int num = Mathf.Clamp(fireHapticStrengthScale, 0, 10); byte b = (byte)Mathf.Clamp(Mathf.RoundToInt((float)num / 10f * 255f), 1, 255); try { ((FVRInteractiveObject)this).m_hand.ForceTubeRumble(b, 0.08f); if ((Object)(object)((FVRInteractiveObject)this).m_hand.OtherHand != (Object)null) { ((FVRInteractiveObject)this).m_hand.OtherHand.ForceTubeRumble((byte)Mathf.Clamp(b / 2, 1, 255), 0.08f); } } catch { } } } try { bool flag2 = ((FVRFireArm)this).IsTwoHandStabilized(); bool flag3 = (Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null; bool flag4 = ((FVRFireArm)this).IsShoulderStabilized(); FVRFireArmRecoilProfile recoilProfile = ((FVRFireArm)this).GetRecoilProfile(); float num2 = 1f; ((FVRFireArm)this).Recoil(flag2, flag3, flag4, recoilProfile, num2); } catch (Exception ex) { Debug.LogException(ex); } if (_cooldownVisualCoroutine != null) { try { ((MonoBehaviour)this).StopCoroutine(_cooldownVisualCoroutine); } catch { } _cooldownVisualCoroutine = null; } ((MonoBehaviour)this).StartCoroutine(DelayedStartCooldownVisual(0.05f)); if (_cooldownCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_cooldownCoroutine); } _cooldownCoroutine = ((MonoBehaviour)this).StartCoroutine(CooldownRoutine()); } private IEnumerator DelayedStartCooldownVisual(float delay) { yield return (object)new WaitForSeconds(delay); if (_cooldownVisualCoroutine != null) { try { ((MonoBehaviour)this).StopCoroutine(_cooldownVisualCoroutine); } catch { } _cooldownVisualCoroutine = null; } _cooldownVisualCoroutine = ((MonoBehaviour)this).StartCoroutine(CooldownVisualRoutine()); } private IEnumerator CooldownVisualRoutine() { float elapsed = 0f; while (elapsed < cooldownTime) { elapsed += Time.deltaTime; float t = Mathf.Clamp01(elapsed / cooldownTime); float p = Mathf.Lerp(1f, 0f, t); UpdateChargeVisuals(p); yield return null; } UpdateChargeVisuals(0f); _cooldownVisualCoroutine = null; } private IEnumerator CooldownRoutine() { StopHaptics(); _isCooling = true; float elapsed = 0f; while (elapsed < cooldownTime) { elapsed += Time.deltaTime; yield return null; } _isCooling = false; _cooldownCoroutine = null; _hasFiredThisCharge = false; } public bool IsReady() { return !_isCooling && !_isCharging && !_hasFiredThisCharge; } public float GetChargeProgress() { if (!_isCharging) { return 0f; } return Mathf.Clamp01(_chargeTimer / chargeTime); } private void OnDisable() { StopHaptics(); if (_revertCoroutine != null) { try { ((MonoBehaviour)this).StopCoroutine(_revertCoroutine); } catch { } _revertCoroutine = null; } if (_cooldownVisualCoroutine != null) { try { ((MonoBehaviour)this).StopCoroutine(_cooldownVisualCoroutine); } catch { } _cooldownVisualCoroutine = null; } if (_cooldownCoroutine != null) { try { ((MonoBehaviour)this).StopCoroutine(_cooldownCoroutine); } catch { } _cooldownCoroutine = null; } if (!((Object)(object)chargeAudioSource != (Object)null)) { return; } try { if (chargeAudioSource.isPlaying) { chargeAudioSource.Stop(); } } catch { } try { chargeAudioSource.clip = null; } catch { } } [ContextMenu("Refresh Slot Caches")] public void RefreshSlotCaches() { CacheSlotTransforms(); CacheMuzzleParticle(); CacheTriggerTransforms(); CacheLight(); } } [RequireComponent(typeof(Rigidbody))] public class SimpleProjectile : MonoBehaviour { [Header("Explosion Prefabs")] [Tooltip("碰撞时生成的爆炸特效 prefab,可以填多个。")] public GameObject[] explosionPrefabs; [Tooltip("爆炸生成的偏移量(相对于碰撞点)。")] public Vector3 explosionOffset = Vector3.zero; [Tooltip("爆炸特效在场景中存活的时间(秒)。")] public float explosionLifetime = 5f; [Tooltip("碰撞后是否立即销毁弹丸本体。")] public bool destroyProjectileOnImpact = true; [Header("Layer Filter")] [Tooltip("只有这些层的 Collider 才会触发爆炸。")] public LayerMask triggerLayers = LayerMask.op_Implicit(-1); private bool _hasExploded = false; private void OnCollisionEnter(Collision collision) { //IL_001e: 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_0053: 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_006a: 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) if (!_hasExploded && IsInLayerMask(collision.gameObject.layer, triggerLayers)) { _hasExploded = true; Vector3 val = ((collision.contacts.Length <= 0) ? ((Component)this).transform.position : ((ContactPoint)(ref collision.contacts[0])).point); SpawnExplosions(val + explosionOffset); if (destroyProjectileOnImpact) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } private void OnTriggerEnter(Collider other) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!_hasExploded && IsInLayerMask(((Component)other).gameObject.layer, triggerLayers)) { _hasExploded = true; Vector3 val = other.ClosestPoint(((Component)this).transform.position); SpawnExplosions(val + explosionOffset); if (destroyProjectileOnImpact) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } private void SpawnExplosions(Vector3 position) { //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) if (explosionPrefabs == null || explosionPrefabs.Length == 0) { return; } GameObject[] array = explosionPrefabs; foreach (GameObject val in array) { if (!((Object)(object)val == (Object)null)) { GameObject val2 = Object.Instantiate(val, position, Quaternion.identity); Object.Destroy((Object)(object)val2, explosionLifetime); } } } private bool IsInLayerMask(int layer, LayerMask mask) { return (((LayerMask)(ref mask)).value & (1 << layer)) != 0; } } public class EatableFood : MonoBehaviour { [Header("Eat Settings")] public float eatDistance = 0.2f; public bool requireNotHeld = true; public bool destroyAfterEat = true; [Tooltip("Local offset from head where the eat FX will spawn.")] public Vector3 eatFXOffset = new Vector3(0f, -0.05f, 0.1f); [Header("Eat FX Prefabs")] public GameObject[] spawnOnEat; public int spawnCount = 1; [Header("Prefab Control On Eat")] public GameObject[] enableOnEat; public GameObject[] disableOnEat; [Header("References")] public FVRPhysicalObject fvrObject; private Transform headTransform; private bool eaten = false; private void Awake() { if ((Object)(object)GM.CurrentPlayerBody != (Object)null && (Object)(object)GM.CurrentPlayerBody.Head != (Object)null) { headTransform = GM.CurrentPlayerBody.Head; } if ((Object)(object)fvrObject == (Object)null) { fvrObject = ((Component)this).GetComponent(); } } private void Update() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (!eaten && !((Object)(object)headTransform == (Object)null)) { float num = Vector3.Distance(((Component)this).transform.position, headTransform.position); if (num <= eatDistance && (!requireNotHeld || ((Object)(object)fvrObject != (Object)null && !((FVRInteractiveObject)fvrObject).m_isHeld))) { Eat(); } } } private void Eat() { //IL_0052: 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_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_006f: 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) eaten = true; if (spawnOnEat != null && spawnOnEat.Length > 0) { for (int i = 0; i < spawnOnEat.Length; i++) { GameObject val = spawnOnEat[i]; if (!((Object)(object)val == (Object)null)) { for (int j = 0; j < Mathf.Max(1, spawnCount); j++) { Vector3 val2 = headTransform.position + headTransform.TransformVector(eatFXOffset); GameObject val3 = Object.Instantiate(val, val2, headTransform.rotation); val3.transform.SetParent(headTransform, true); } } } } GameObject[] array = enableOnEat; foreach (GameObject val4 in array) { if ((Object)(object)val4 != (Object)null) { val4.SetActive(true); } } GameObject[] array2 = disableOnEat; foreach (GameObject val5 in array2) { if ((Object)(object)val5 != (Object)null) { val5.SetActive(false); } } if (destroyAfterEat) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { ((Component)this).gameObject.SetActive(false); } } } public class SonyWalkman : FVRPhysicalObject { private enum TapeMode { Normal, FastForward, Rewind } [Header("Audio System")] public AudioSource audioSource; public AudioSource sfxSource; public AudioClip insertSound; public AudioClip ejectSound; [Header("Tape Slot")] public Transform tapeSlot; public Transform tapeInsertPoint; public Transform ejectPoint; private Tape insertedTape; private int insertedTapeOriginalLayer = -1; [Header("Detector")] [Tooltip("指定用于检测磁带插入的 trigger Collider(通常是 tapeInsertPoint 上的 Collider)。不要把 Walkman 的握持检测 Collider 拖到这里。")] public Collider detectorCollider; [Header("Buttons")] public SonyWalkmanButton playButton; public SonyWalkmanButton stopButton; public SonyWalkmanButton ffButton; public SonyWalkmanButton rewButton; [Header("Button Sounds")] public AudioClip buttonClickSound; [Header("FF/REW Settings")] public float ffSpeed = 2f; public float rewSpeed = 2f; public AudioClip ffSound; public AudioClip rewSound; [Header("Lid Settings")] public Transform lidTransform; public Vector3 lidClosedEuler = new Vector3(0f, 0f, 0f); public Vector3 lidOpenEuler = new Vector3(-70f, 0f, 0f); public float lidAnimSpeed = 5f; [Header("Lid Sounds")] public AudioClip lidOpenSound; public AudioClip lidCloseSound; [Header("Debug")] [Tooltip("Set to true in the Inspector to toggle the lid (Editor or Play). It will auto-reset to false in Play mode.")] public bool DebugLidToggle = false; [Header("Eject Settings")] [Tooltip("弹出时施加的速度大小(更小更慢)")] public float ejectVelocity = 0.12f; [Tooltip("是否直接设置刚体速度而不是 AddForce")] public bool setEjectVelocityDirectly = true; [Tooltip("弹出后临时设置的线性阻尼(drag),0 表示不改变。用于快速减速,单位为 drag")] public float temporaryPostEjectDrag = 1f; [Tooltip("弹出后恢复原始阻尼的延迟(秒)。")] public float restoreDragDelay = 0.5f; [Header("Inspector Debug Buttons")] [Tooltip("在 Inspector 中勾选以模拟 Play 按钮按下")] public bool DebugPressPlay = false; [Tooltip("在 Inspector 中勾选以模拟 Stop 按钮按下")] public bool DebugPressStop = false; [Tooltip("在 Inspector 中勾选以模拟 FastForward 按钮按下")] public bool DebugPressFF = false; [Tooltip("在 Inspector 中勾选以模拟 Rewind 按钮按下")] public bool DebugPressREW = false; private bool isLidOpen = false; private Quaternion targetRotation; private TapeMode currentMode = TapeMode.Normal; private bool pendingEject = false; private bool isEjecting = false; private bool wasPlayingBeforeFFREW = false; private const float DetectorReenableDelay = 1f; private const float EndTolerance = 0.02f; private void Start() { //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) if ((Object)(object)lidTransform != (Object)null) { targetRotation = Quaternion.Euler(lidClosedEuler); } if ((Object)(object)detectorCollider == (Object)null && (Object)(object)tapeInsertPoint != (Object)null) { detectorCollider = ((Component)tapeInsertPoint).GetComponent(); } if ((Object)(object)sfxSource != (Object)null) { sfxSource.loop = false; sfxSource.clip = null; } } private void OnValidate() { if (!Application.isPlaying && DebugLidToggle) { ToggleLid(); } } private void Update() { //IL_00ab: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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) if (DebugPressPlay) { DebugPressPlay = false; Play(); } if (DebugPressStop) { DebugPressStop = false; Stop(); } if (DebugPressFF) { DebugPressFF = false; FastForward(); } if (DebugPressREW) { DebugPressREW = false; Rewind(); } if (Application.isPlaying && DebugLidToggle) { DebugLidToggle = false; ToggleLid(); } if ((Object)(object)lidTransform != (Object)null) { lidTransform.localRotation = Quaternion.Lerp(lidTransform.localRotation, targetRotation, Time.deltaTime * lidAnimSpeed); } if ((Object)(object)insertedTape != (Object)null) { Transform val = ((!((Object)(object)tapeSlot != (Object)null)) ? ((Component)this).transform : tapeSlot); if ((Object)(object)((Component)insertedTape).transform.parent != (Object)(object)val) { ((Component)insertedTape).transform.SetParent(val, false); } if ((Object)(object)tapeInsertPoint != (Object)null) { ((Component)insertedTape).transform.position = tapeInsertPoint.position; ((Component)insertedTape).transform.rotation = tapeInsertPoint.rotation; } } if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null && ((FVRInteractiveObject)this).m_hand.Input.TriggerDown) { ToggleLid(); } if ((Object)(object)insertedTape != (Object)null && (Object)(object)audioSource != (Object)null && (Object)(object)audioSource.clip != (Object)null) { if (currentMode == TapeMode.FastForward) { insertedTape.currentTime = Mathf.Min(audioSource.clip.length, insertedTape.currentTime + ffSpeed * Time.deltaTime); audioSource.time = insertedTape.currentTime; } else if (currentMode == TapeMode.Rewind) { insertedTape.currentTime = Mathf.Max(0f, insertedTape.currentTime - rewSpeed * Time.deltaTime); audioSource.time = insertedTape.currentTime; } else { if (audioSource.isPlaying) { insertedTape.currentTime = audioSource.time; } if (audioSource.isPlaying && audioSource.time >= audioSource.clip.length - 0.02f) { OnPlaybackReachedEnd(); } } if (insertedTape.currentTime >= audioSource.clip.length) { Stop(); } } if (pendingEject && (Object)(object)insertedTape != (Object)null && isLidOpen && !isEjecting) { EjectTape(); pendingEject = false; } } private void OnPlaybackReachedEnd() { if ((Object)(object)insertedTape == (Object)null || (Object)(object)audioSource == (Object)null || (Object)(object)audioSource.clip == (Object)null) { return; } try { audioSource.Stop(); audioSource.time = audioSource.clip.length; } catch (Exception) { } insertedTape.currentTime = audioSource.clip.length; insertedTape.isFinished = true; StopLoopSound(); currentMode = TapeMode.Normal; wasPlayingBeforeFFREW = false; try { insertedTape.HandleEndPrefabs(); } catch (Exception) { } } [ContextMenu("Toggle Lid")] public void ToggleLid() { //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_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_0037: Unknown result type (might be due to invalid IL or missing references) isLidOpen = !isLidOpen; targetRotation = ((!isLidOpen) ? Quaternion.Euler(lidClosedEuler) : Quaternion.Euler(lidOpenEuler)); if ((Object)(object)sfxSource != (Object)null) { if (isLidOpen && (Object)(object)lidOpenSound != (Object)null) { sfxSource.PlayOneShot(lidOpenSound); } else if (!isLidOpen && (Object)(object)lidCloseSound != (Object)null) { sfxSource.PlayOneShot(lidCloseSound); } } } public bool IsLidOpen() { return isLidOpen; } public bool HasInsertedTape() { return (Object)(object)insertedTape != (Object)null; } public void InsertTape(Tape tape) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)tape == (Object)null || !isLidOpen || (Object)(object)insertedTape != (Object)null || tape.isInserted) { return; } insertedTape = tape; audioSource.clip = tape.tapeAudio; audioSource.time = tape.currentTime; insertedTapeOriginalLayer = ((Component)tape).gameObject.layer; bool flag = false; try { FVRPhysicalObject val = (FVRPhysicalObject)(object)insertedTape; if ((Object)(object)val != (Object)null) { val.StoreAndDestroyRigidbody(); flag = true; } } catch (Exception) { } Rigidbody component = ((Component)tape).GetComponent(); Collider component2 = ((Component)tape).GetComponent(); if (!flag && (Object)(object)component != (Object)null) { component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; component.isKinematic = true; component.interpolation = (RigidbodyInterpolation)1; component.collisionDetectionMode = (CollisionDetectionMode)1; } bool flag2 = false; try { FVRPhysicalObject val2 = (FVRPhysicalObject)(object)insertedTape; if ((Object)(object)val2 != (Object)null && (Object)(object)tapeSlot != (Object)null) { val2.SetParentage(tapeSlot); flag2 = true; } } catch (Exception) { flag2 = false; } if (!flag2) { if ((Object)(object)tapeSlot != (Object)null) { ((Component)tape).transform.SetParent(tapeSlot, false); } else { ((Component)tape).transform.SetParent(((Component)this).transform, false); } } if ((Object)(object)tapeInsertPoint != (Object)null) { ((Component)tape).transform.position = tapeInsertPoint.position; ((Component)tape).transform.rotation = tapeInsertPoint.rotation; } else { ((Component)tape).transform.localPosition = Vector3.zero; ((Component)tape).transform.localRotation = Quaternion.identity; } try { ((MonoBehaviour)this).StartCoroutine(DisableCollidersNextFrame(tape)); } catch (Exception) { if (!flag && (Object)(object)component2 != (Object)null) { component2.enabled = false; } } bool flag3 = false; try { FVRPhysicalObject val3 = (FVRPhysicalObject)(object)insertedTape; if ((Object)(object)val3 != (Object)null) { ((FVRInteractiveObject)val3).SetAllCollidersToLayer(false, "NoCol"); flag3 = true; } } catch (Exception) { } if (!flag3) { int num = LayerMask.NameToLayer("NoCol"); if (num != -1 && (tape.collidersToDisable == null || tape.collidersToDisable.Length == 0)) { ((Component)tape).gameObject.layer = num; } } tape.isInserted = true; if ((Object)(object)insertSound != (Object)null && (Object)(object)sfxSource != (Object)null) { sfxSource.PlayOneShot(insertSound); } if ((Object)(object)detectorCollider != (Object)null) { detectorCollider.enabled = false; } ((MonoBehaviour)this).Invoke("ReEnableDetector", 1f); } private IEnumerator DisableCollidersNextFrame(Tape tape) { yield return null; if ((Object)(object)tape != (Object)null) { try { tape.DisableAssignedColliders(); } catch (Exception) { } } } public void EjectTape() { //IL_0174: 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_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_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_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: 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_02c0: 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) //IL_02f4: 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) if ((Object)(object)insertedTape == (Object)null || !isLidOpen || isEjecting) { return; } isEjecting = true; if ((Object)(object)audioSource != (Object)null) { insertedTape.currentTime = audioSource.time; } audioSource.Stop(); audioSource.clip = null; StopLoopSound(); try { insertedTape.RestoreAssignedColliders(); } catch (Exception) { } bool flag = false; try { FVRPhysicalObject val = (FVRPhysicalObject)(object)insertedTape; if ((Object)(object)val != (Object)null) { val.SetParentage((Transform)null); val.RecoverRigidbody(); ((FVRInteractiveObject)val).SetAllCollidersToLayer(false, "Default"); flag = true; } } catch (Exception) { } if (!flag) { ((Component)insertedTape).transform.SetParent((Transform)null, true); Rigidbody component = ((Component)insertedTape).GetComponent(); Collider component2 = ((Component)insertedTape).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.enabled = true; } if ((Object)(object)component != (Object)null) { component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; component.isKinematic = false; component.interpolation = (RigidbodyInterpolation)1; component.collisionDetectionMode = (CollisionDetectionMode)1; } } if ((Object)(object)ejectPoint != (Object)null) { ((Component)insertedTape).transform.position = ejectPoint.position; ((Component)insertedTape).transform.rotation = ejectPoint.rotation; } else { Vector3 val2 = ((!((Object)(object)tapeInsertPoint != (Object)null)) ? ((Component)this).transform.up : tapeInsertPoint.forward); Vector3 position = ((!((Object)(object)tapeInsertPoint != (Object)null)) ? (((Component)insertedTape).transform.position + val2 * 0.05f) : (tapeInsertPoint.position + val2 * 0.05f)); ((Component)insertedTape).transform.position = position; } Rigidbody component3 = ((Component)insertedTape).GetComponent(); if ((Object)(object)component3 != (Object)null) { Vector3 val3 = (((Object)(object)ejectPoint != (Object)null) ? ejectPoint.forward : ((!((Object)(object)tapeInsertPoint != (Object)null)) ? ((Component)this).transform.up : tapeInsertPoint.forward)); Vector3 val4 = ((Vector3)(ref val3)).normalized * Mathf.Max(0f, ejectVelocity); component3.velocity = Vector3.zero; component3.angularVelocity = Vector3.zero; if (setEjectVelocityDirectly) { component3.velocity = val4; } else { component3.AddForce(val4, (ForceMode)2); } if (temporaryPostEjectDrag > 0f) { float drag = component3.drag; component3.drag = temporaryPostEjectDrag; ((MonoBehaviour)this).StartCoroutine(RestoreDrag(component3, drag, restoreDragDelay)); } } if (insertedTapeOriginalLayer >= 0) { ((Component)insertedTape).gameObject.layer = insertedTapeOriginalLayer; insertedTapeOriginalLayer = -1; } if ((Object)(object)ejectSound != (Object)null && (Object)(object)sfxSource != (Object)null) { sfxSource.PlayOneShot(ejectSound); } if ((Object)(object)detectorCollider != (Object)null) { detectorCollider.enabled = false; } ((MonoBehaviour)this).Invoke("ReEnableDetector", 1f); insertedTape.isInserted = false; insertedTape = null; isEjecting = false; } private IEnumerator RestoreDrag(Rigidbody rb, float originalDrag, float delay) { if ((Object)(object)rb == (Object)null) { yield break; } yield return (object)new WaitForSeconds(delay); try { if ((Object)(object)rb != (Object)null) { rb.drag = originalDrag; } } catch (Exception) { } } private void ReEnableDetector() { if (!((Object)(object)detectorCollider == (Object)null)) { if ((Object)(object)insertedTape != (Object)null) { ((MonoBehaviour)this).Invoke("ReEnableDetector", 0.5f); } else { detectorCollider.enabled = true; } } } public void Play() { if (!((Object)(object)insertedTape == (Object)null) && !((Object)(object)audioSource == (Object)null) && !((Object)(object)audioSource.clip == (Object)null)) { currentMode = TapeMode.Normal; StopLoopSound(); audioSource.loop = false; audioSource.time = insertedTape.currentTime; audioSource.Play(); PlayButtonClick(); if (!insertedTape.isFinished && (Object)(object)insertedTape.tapeAudio != (Object)null && insertedTape.currentTime < insertedTape.tapeAudio.length) { insertedTape.OnPlayStart(); } StopFFREW(); } } public void Stop() { if (!((Object)(object)insertedTape == (Object)null)) { StopFFREW(); wasPlayingBeforeFFREW = false; if ((Object)(object)audioSource != (Object)null) { insertedTape.currentTime = audioSource.time; } if ((Object)(object)audioSource != (Object)null) { audioSource.Pause(); } currentMode = TapeMode.Normal; StopLoopSound(); PlayButtonClick(); if (isLidOpen) { pendingEject = true; } } } public void FastForward() { if (!((Object)(object)insertedTape == (Object)null) && !((Object)(object)audioSource == (Object)null) && !((Object)(object)audioSource.clip == (Object)null)) { insertedTape.currentTime = audioSource.time; wasPlayingBeforeFFREW = audioSource.isPlaying; currentMode = TapeMode.FastForward; audioSource.Pause(); PlayLoopSound(ffSound); PlayButtonClick(); } } public void Rewind() { if (!((Object)(object)insertedTape == (Object)null) && !((Object)(object)audioSource == (Object)null) && !((Object)(object)audioSource.clip == (Object)null)) { insertedTape.currentTime = audioSource.time; wasPlayingBeforeFFREW = audioSource.isPlaying; currentMode = TapeMode.Rewind; audioSource.Pause(); PlayLoopSound(rewSound); PlayButtonClick(); } } public void StopFFREW() { currentMode = TapeMode.Normal; StopLoopSound(); if ((Object)(object)insertedTape != (Object)null && (Object)(object)audioSource != (Object)null && (Object)(object)audioSource.clip != (Object)null && wasPlayingBeforeFFREW) { audioSource.time = insertedTape.currentTime; audioSource.Play(); } wasPlayingBeforeFFREW = false; } public void PlayButtonClick() { if ((Object)(object)buttonClickSound != (Object)null && (Object)(object)sfxSource != (Object)null) { sfxSource.PlayOneShot(buttonClickSound); } } private void PlayLoopSound(AudioClip clip) { if (!((Object)(object)sfxSource == (Object)null) && !((Object)(object)clip == (Object)null) && (!sfxSource.isPlaying || !((Object)(object)sfxSource.clip == (Object)(object)clip) || !sfxSource.loop)) { sfxSource.clip = clip; sfxSource.loop = true; sfxSource.Play(); } } private void StopLoopSound() { if (!((Object)(object)sfxSource == (Object)null)) { sfxSource.Stop(); sfxSource.loop = false; sfxSource.clip = null; } } public void ResetAllButtons(SonyWalkmanButton except) { SonyWalkmanButton[] array = new SonyWalkmanButton[4] { playButton, stopButton, ffButton, rewButton }; SonyWalkmanButton[] array2 = array; foreach (SonyWalkmanButton sonyWalkmanButton in array2) { if ((Object)(object)sonyWalkmanButton != (Object)null && (Object)(object)sonyWalkmanButton != (Object)(object)except) { sonyWalkmanButton.ResetButton(); } } } private void OnTriggerEnter(Collider other) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) Tape component = ((Component)other).GetComponent(); if (!((Object)(object)component != (Object)null) || !isLidOpen || (!((Object)(object)detectorCollider == (Object)null) && !detectorCollider.enabled) || component.isInserted || !((Object)(object)insertedTape == (Object)null)) { return; } if ((Object)(object)tapeInsertPoint != (Object)null) { float num = 0.05f; if (Vector3.Distance(((Component)other).transform.position, tapeInsertPoint.position) <= num) { InsertTape(component); } } else { InsertTape(component); } } private void OnTriggerExit(Collider other) { } } public class SonyWalkmanButton : FVRInteractiveObject { public enum ButtonType { Play, Stop, FF, REW, Volume } public ButtonType buttonType; public SonyWalkman walkman; [Header("Button Animation Points")] public Transform buttonUpPoint; public Transform buttonDownPoint; [Header("Volume (optional)")] [Tooltip("优先使用此 AudioSource;若为空会尝试从 walkman 上获取 audioSource。")] public AudioSource targetAudioSource; [Range(0f, 1f)] public float highVolume = 1f; [Range(0f, 1f)] public float lowVolume = 0.1f; [Tooltip("切换时的过渡时长(秒)。")] public float transitionDuration = 0.5f; [Tooltip("是否在 Start 时把音量设为 High(否则设为 Low)。")] public bool startHigh = true; private bool isPressed = false; [Header("Volume State (read-only)")] public bool isHigh = true; private Coroutine _volCoroutine; public override void Awake() { //IL_0025: 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).Awake(); if ((Object)(object)buttonUpPoint != (Object)null) { ((Component)this).transform.position = buttonUpPoint.position; ((Component)this).transform.rotation = buttonUpPoint.rotation; } } private void Start() { if ((Object)(object)targetAudioSource == (Object)null) { if ((Object)(object)walkman != (Object)null && (Object)(object)walkman.audioSource != (Object)null) { targetAudioSource = walkman.audioSource; } else { targetAudioSource = ((Component)this).GetComponent(); if ((Object)(object)targetAudioSource == (Object)null && (Object)(object)((Component)this).transform.parent != (Object)null) { targetAudioSource = ((Component)((Component)this).transform.parent).GetComponentInChildren(); } } } if ((Object)(object)targetAudioSource != (Object)null) { isHigh = startHigh; targetAudioSource.volume = ((!isHigh) ? lowVolume : highVolume); } } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); switch (buttonType) { case ButtonType.Play: if ((Object)(object)walkman != (Object)null) { walkman.Play(); } MoveToDownPoint(); if ((Object)(object)walkman != (Object)null) { walkman.ResetAllButtons(this); } break; case ButtonType.Stop: if ((Object)(object)walkman != (Object)null) { walkman.Stop(); } MoveToDownPoint(); if ((Object)(object)walkman != (Object)null) { walkman.ResetAllButtons(this); } break; case ButtonType.FF: ToggleFFREW(isFF: true); if ((Object)(object)walkman != (Object)null) { walkman.ResetAllButtons(this); } break; case ButtonType.REW: ToggleFFREW(isFF: false); if ((Object)(object)walkman != (Object)null) { walkman.ResetAllButtons(this); } break; case ButtonType.Volume: ToggleVolume(); MoveToDownPoint(); if ((Object)(object)walkman != (Object)null) { walkman.ResetAllButtons(this); } break; } if ((Object)(object)walkman != (Object)null) { walkman.PlayButtonClick(); } } private void ToggleFFREW(bool isFF) { isPressed = !isPressed; if (isPressed) { if ((Object)(object)walkman != (Object)null) { if (isFF) { walkman.FastForward(); } else { walkman.Rewind(); } } MoveToDownPoint(); } else { if ((Object)(object)walkman != (Object)null) { walkman.StopFFREW(); } MoveToUpPoint(); } } private void ToggleVolume() { if ((Object)(object)targetAudioSource == (Object)null) { Debug.LogWarning((object)"[SonyWalkmanButton] No target AudioSource for volume toggle."); return; } float volume = targetAudioSource.volume; float to = ((!isHigh) ? highVolume : lowVolume); isHigh = !isHigh; if (_volCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_volCoroutine); } _volCoroutine = ((MonoBehaviour)this).StartCoroutine(SmoothVolume(volume, to, transitionDuration)); } public void SetVolumeHigh(bool high) { if (!((Object)(object)targetAudioSource == (Object)null)) { if (_volCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_volCoroutine); } isHigh = high; targetAudioSource.volume = ((!isHigh) ? lowVolume : highVolume); } } private IEnumerator SmoothVolume(float from, float to, float duration) { if ((Object)(object)targetAudioSource == (Object)null) { _volCoroutine = null; yield break; } if (duration <= 0f) { targetAudioSource.volume = to; _volCoroutine = null; yield break; } float elapsed = 0f; while (elapsed < duration) { elapsed += Time.deltaTime; float t = Mathf.Clamp01(elapsed / duration); float v = Mathf.Lerp(from, to, t); targetAudioSource.volume = v; yield return null; } targetAudioSource.volume = to; _volCoroutine = null; } public void ResetButton() { isPressed = false; MoveToUpPoint(); } private void MoveToDownPoint() { //IL_001f: 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) if ((Object)(object)buttonDownPoint != (Object)null) { ((Component)this).transform.position = buttonDownPoint.position; ((Component)this).transform.rotation = buttonDownPoint.rotation; } } private void MoveToUpPoint() { //IL_001f: 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) if ((Object)(object)buttonUpPoint != (Object)null) { ((Component)this).transform.position = buttonUpPoint.position; ((Component)this).transform.rotation = buttonUpPoint.rotation; } } } public class Tape : FVRPhysicalObject { [Header("Tape Settings")] public AudioClip tapeAudio; [HideInInspector] public float currentTime = 0f; [Header("State")] public bool isInserted = false; public bool isFinished = false; [Header("Debug")] public bool debugResetTime = false; [Header("Prefab Actions - Play Start")] public GameObject[] prefabsOnPlay; public Transform[] playSpawnPoints; public GameObject[] prefabsToDestroyOnPlay; [Header("Prefab Actions - Play End")] public GameObject[] prefabsOnEnd; public Transform[] endSpawnPoints; public GameObject[] prefabsToDestroyOnEnd; [Header("Collision Control")] public Collider[] collidersToDisable; public bool preferDisableGameObject = true; public bool preferLayerNoCol = true; private GameObject[] spawnedPlayPrefabs; private GameObject[] spawnedEndPrefabs; private bool playPrefabsSpawned = false; private bool endPrefabsSpawned = false; private bool[] _prevColliderEnabled; private int[] _prevColliderLayer; private bool[] _prevGameObjectActive; private void Update() { if (debugResetTime) { debugResetTime = false; ResetTape(); } if ((Object)(object)tapeAudio != (Object)null && currentTime >= tapeAudio.length && !isFinished) { isFinished = true; HandleEndPrefabs(); } } public void FastForward(float seconds) { if (!((Object)(object)tapeAudio == (Object)null)) { currentTime = Mathf.Min(tapeAudio.length, currentTime + seconds); if (currentTime >= tapeAudio.length) { isFinished = true; } } } public void Rewind(float seconds) { if (!((Object)(object)tapeAudio == (Object)null)) { currentTime = Mathf.Max(0f, currentTime - seconds); if (currentTime < tapeAudio.length) { isFinished = false; } } } public void ResetTape() { currentTime = 0f; isFinished = false; ClearPlayPrefabs(); ClearEndPrefabs(); playPrefabsSpawned = false; endPrefabsSpawned = false; } public float GetProgress() { if ((Object)(object)tapeAudio == (Object)null || tapeAudio.length <= 0f) { return 0f; } return Mathf.Clamp01(currentTime / tapeAudio.length); } public void AttachToSlot(Transform slot) { //IL_0021: 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_006b: 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) if ((Object)(object)slot != (Object)null) { ((Component)this).transform.SetParent(slot, false); ((Component)this).transform.localPosition = Vector3.zero; ((Component)this).transform.localRotation = Quaternion.identity; } else { ((Component)this).transform.SetParent((Transform)null); } isInserted = true; Rigidbody component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; } } public void DetachFromSlot() { //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) ((Component)this).transform.SetParent((Transform)null, true); isInserted = false; Rigidbody component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; } } public void DisableAssignedColliders() { if (collidersToDisable == null || collidersToDisable.Length == 0) { return; } int num = collidersToDisable.Length; _prevColliderEnabled = new bool[num]; _prevColliderLayer = new int[num]; _prevGameObjectActive = new bool[num]; int num2 = LayerMask.NameToLayer("NoCol"); for (int i = 0; i < num; i++) { Collider val = collidersToDisable[i]; if ((Object)(object)val == (Object)null) { _prevColliderEnabled[i] = false; _prevColliderLayer[i] = -1; _prevGameObjectActive[i] = false; continue; } _prevColliderEnabled[i] = val.enabled; _prevColliderLayer[i] = ((Component)val).gameObject.layer; _prevGameObjectActive[i] = ((Component)val).gameObject.activeSelf; if (preferDisableGameObject) { try { ((Component)val).gameObject.SetActive(false); } catch (Exception) { } } else if (preferLayerNoCol && num2 != -1) { try { ((Component)val).gameObject.layer = num2; } catch (Exception) { } } else { try { val.enabled = false; } catch (Exception) { } } } } public void RestoreAssignedColliders() { if (collidersToDisable == null || collidersToDisable.Length == 0 || _prevColliderEnabled == null || _prevColliderLayer == null || _prevGameObjectActive == null) { return; } int num = collidersToDisable.Length; for (int i = 0; i < num; i++) { Collider val = collidersToDisable[i]; if ((Object)(object)val == (Object)null) { continue; } bool active = _prevGameObjectActive[i]; try { ((Component)val).gameObject.SetActive(active); } catch (Exception) { } int num2 = _prevColliderLayer[i]; if (num2 >= 0) { try { ((Component)val).gameObject.layer = num2; } catch (Exception) { } } bool enabled = _prevColliderEnabled[i]; try { val.enabled = enabled; } catch (Exception) { } } _prevColliderEnabled = null; _prevColliderLayer = null; _prevGameObjectActive = null; } public void OnPlayStart() { //IL_00e7: 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) if (isFinished || playPrefabsSpawned) { return; } if (prefabsToDestroyOnPlay != null) { GameObject[] array = prefabsToDestroyOnPlay; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } } if (prefabsOnPlay != null && playSpawnPoints != null) { int num = Mathf.Min(prefabsOnPlay.Length, playSpawnPoints.Length); spawnedPlayPrefabs = (GameObject[])(object)new GameObject[num]; for (int j = 0; j < num; j++) { if ((Object)(object)prefabsOnPlay[j] != (Object)null && (Object)(object)playSpawnPoints[j] != (Object)null) { spawnedPlayPrefabs[j] = Object.Instantiate(prefabsOnPlay[j], playSpawnPoints[j].position, playSpawnPoints[j].rotation); } } } playPrefabsSpawned = true; } public void HandleEndPrefabs() { //IL_00d7: 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) if (endPrefabsSpawned) { return; } if (prefabsToDestroyOnEnd != null) { GameObject[] array = prefabsToDestroyOnEnd; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } } if (prefabsOnEnd != null && endSpawnPoints != null) { int num = Mathf.Min(prefabsOnEnd.Length, endSpawnPoints.Length); spawnedEndPrefabs = (GameObject[])(object)new GameObject[num]; for (int j = 0; j < num; j++) { if ((Object)(object)prefabsOnEnd[j] != (Object)null && (Object)(object)endSpawnPoints[j] != (Object)null) { spawnedEndPrefabs[j] = Object.Instantiate(prefabsOnEnd[j], endSpawnPoints[j].position, endSpawnPoints[j].rotation); } } } endPrefabsSpawned = true; } public void ClearPlayPrefabs() { if (spawnedPlayPrefabs == null) { return; } for (int i = 0; i < spawnedPlayPrefabs.Length; i++) { if ((Object)(object)spawnedPlayPrefabs[i] != (Object)null) { Object.Destroy((Object)(object)spawnedPlayPrefabs[i]); spawnedPlayPrefabs[i] = null; } } } public void ClearEndPrefabs() { if (spawnedEndPrefabs == null) { return; } for (int i = 0; i < spawnedEndPrefabs.Length; i++) { if ((Object)(object)spawnedEndPrefabs[i] != (Object)null) { Object.Destroy((Object)(object)spawnedEndPrefabs[i]); spawnedEndPrefabs[i] = null; } } } } public class TapeInsertTrigger : MonoBehaviour { public SonyWalkman walkman; public float maxInsertDistance = 0.05f; private void OnTriggerEnter(Collider other) { //IL_005f: 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) if (!((Object)(object)walkman == (Object)null)) { Tape component = ((Component)other).GetComponent(); if (!((Object)(object)component == (Object)null) && walkman.IsLidOpen() && !walkman.HasInsertedTape() && !(Vector3.Distance(((Component)other).transform.position, ((Component)this).transform.position) > maxInsertDistance)) { walkman.InsertTape(component); } } } } public class LaserBeam : MonoBehaviour { public float maxDistance = 50f; public float thermalDamage = 50f; public float energeticDamage = 50f; public float kineticDamage = 10f; public float lifetime = 0.1f; public LayerMask hitMask = LayerMask.op_Implicit(-1); public LineRenderer line; private void Start() { //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_001a: 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_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_0037: 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_012b: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0074: 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_00cf: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; Vector3 forward = ((Component)this).transform.forward; Vector3 val = position + forward * maxDistance; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(position, forward, ref val2, maxDistance, LayerMask.op_Implicit(hitMask))) { val = ((RaycastHit)(ref val2)).point; IFVRDamageable componentInParent = ((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent(); if (componentInParent != null) { Damage val3 = new Damage(); val3.Class = (DamageClass)1; val3.Dam_TotalKinetic = kineticDamage; val3.Dam_Blunt = kineticDamage * 0.1f; val3.Dam_Piercing = kineticDamage * 0.9f; val3.Dam_Thermal = thermalDamage; val3.Dam_TotalEnergetic = energeticDamage; val3.point = ((RaycastHit)(ref val2)).point; val3.hitNormal = ((RaycastHit)(ref val2)).normal; val3.strikeDir = forward; val3.damageSize = 0.01f; val3.Source_IFF = GM.CurrentPlayerBody.GetPlayerIFF(); componentInParent.Damage(val3); } } if ((Object)(object)line != (Object)null) { line.SetPosition(0, position); line.SetPosition(1, val); } Object.Destroy((Object)(object)((Component)this).gameObject, lifetime); } } [Serializable] public class OverheatEffectEntry { public GameObject EffectObject; public float TriggerThreshold = 50f; } [DisallowMultipleComponent] public class Trident : FVRFireArm { public enum TriggerAxis { X, Y, Z } [Header("Projectile")] public GameObject LaserPrefab; [Header("Fire control")] public int RPM = 600; public AudioClip FireSound; [Range(0f, 1f)] public float FireSoundVolume = 1f; public AudioClip BatteryInsertSound; public bool AutoRepeat = true; public int ProjectilesPerMuzzle = 1; [Header("Spread Cone (degrees)")] public float ConeAngle = 6f; public float MaxUpAngle = 6f; public float MaxDownAngle = 6f; [Header("Heat / Battery")] public float HeatPerShotPercent = 7f; public float OverheatPercent = 100f; public float CoolDelayAfterStop = 0.3f; public float CoolPercentPerSecond = 50f; [Header("Overheat Effects")] public List OverheatEffects = new List(); [Header("Muzzles")] public Transform[] Muzzles; [Header("Muzzle Effects")] public ParticleSystem[] MuzzleEffects; [Header("Battery")] public TridentBattery currentBattery; public Transform batterySlot; [HideInInspector] public TridentBattery InsertedBattery; private Coroutine m_fireRoutine; private AudioSource m_audioSource; private bool m_isTriggerHeld = false; private float m_lastFireTime = 0f; private float m_heatPercent = 0f; private Coroutine m_coolCoroutine; private bool m_isCooling = false; [Header("Trigger Animation")] public Transform triggerAnimatedObject; public TriggerAxis triggerAxis = TriggerAxis.Z; public Vector3 triggerStartLocalPos = Vector3.zero; public Vector3 triggerPressedLocalPos = Vector3.zero; public bool useAutoCachePressedOffset = true; public Vector3 autoPressedOffset = new Vector3(0f, 0f, -0.02f); [NonSerialized] private bool _triggerPositionsCached = false; private void CacheTriggerPositions() { //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_0045: 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_0055: Unknown result type (might be due to invalid IL or missing references) if (!_triggerPositionsCached && !((Object)(object)triggerAnimatedObject == (Object)null)) { triggerStartLocalPos = triggerAnimatedObject.localPosition; if (useAutoCachePressedOffset) { triggerPressedLocalPos = triggerStartLocalPos + autoPressedOffset; } _triggerPositionsCached = true; } } private void UpdateTriggerAnimation() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_00ae: 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_0102: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)triggerAnimatedObject == (Object)null) { return; } if (!_triggerPositionsCached) { CacheTriggerPositions(); } if (!((Object)(object)((FVRInteractiveObject)this).m_hand == (Object)null)) { float num = Mathf.Clamp01(((FVRInteractiveObject)this).m_hand.Input.TriggerFloat); Vector3 val = Vector3.Lerp(triggerStartLocalPos, triggerPressedLocalPos, num); Vector3 localPosition = triggerAnimatedObject.localPosition; switch (triggerAxis) { case TriggerAxis.X: triggerAnimatedObject.localPosition = new Vector3(val.x, localPosition.y, localPosition.z); break; case TriggerAxis.Y: triggerAnimatedObject.localPosition = new Vector3(localPosition.x, val.y, localPosition.z); break; case TriggerAxis.Z: triggerAnimatedObject.localPosition = new Vector3(localPosition.x, localPosition.y, val.z); break; } } } private void Awake() { try { ((FVRFireArm)this).Awake(); } catch { Debug.LogWarning((object)"[Trident] base.Awake() threw an exception."); } m_audioSource = ((Component)this).GetComponent(); if ((Object)(object)m_audioSource == (Object)null) { m_audioSource = ((Component)this).gameObject.AddComponent(); m_audioSource.playOnAwake = false; } if (OverheatEffects == null) { OverheatEffects = new List(); } CacheTriggerPositions(); } public override void FVRUpdate() { ((FVRFireArm)this).FVRUpdate(); bool flag = (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null; bool flag2 = flag && ((FVRInteractiveObject)this).m_hand.Input.TriggerDown; bool flag3 = flag && ((FVRInteractiveObject)this).m_hand.Input.TriggerUp; if (flag2 && !m_isTriggerHeld) { StartFiring(); } if (flag3 && m_isTriggerHeld) { StopFiring(); } UpdateTriggerAnimation(); } private void OnDisable() { if (m_fireRoutine != null) { try { ((MonoBehaviour)this).StopCoroutine(m_fireRoutine); } catch { } m_fireRoutine = null; } if (m_coolCoroutine != null) { try { ((MonoBehaviour)this).StopCoroutine(m_coolCoroutine); } catch { } m_coolCoroutine = null; } } private void OnDestroy() { InsertedBattery = null; } public override void BeginInteraction(FVRViveHand hand) { try { ((FVRFireArm)this).BeginInteraction(hand); } catch { } } public override void EndInteraction(FVRViveHand hand) { try { ((FVRFireArm)this).EndInteraction(hand); } catch { } } public void StartFiring() { if (m_fireRoutine == null) { m_isTriggerHeld = true; m_fireRoutine = ((MonoBehaviour)this).StartCoroutine(FireRoutine()); } } public void StopFiring() { m_isTriggerHeld = false; if (m_fireRoutine != null) { try { ((MonoBehaviour)this).StopCoroutine(m_fireRoutine); } catch { } m_fireRoutine = null; } if (m_coolCoroutine != null) { try { ((MonoBehaviour)this).StopCoroutine(m_coolCoroutine); } catch { } m_coolCoroutine = null; } m_coolCoroutine = ((MonoBehaviour)this).StartCoroutine(CoolDelayAndStart()); } private IEnumerator FireRoutine() { float interval = 60f / (float)Mathf.Max(1, RPM); while (m_isTriggerHeld) { if ((Object)(object)currentBattery == (Object)null || currentBattery.IsOverheated) { yield break; } FireOnce(); yield return (object)new WaitForSeconds(interval); } m_fireRoutine = null; } private void FireOnce() { //IL_005b: 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) //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) if (Muzzles == null || Muzzles.Length == 0 || (Object)(object)LaserPrefab == (Object)null) { return; } for (int i = 0; i < Muzzles.Length; i++) { Transform val = Muzzles[i]; if ((Object)(object)val == (Object)null) { continue; } for (int j = 0; j < ProjectilesPerMuzzle; j++) { Vector3 val2 = RandomDirectionInCone(val.forward, ConeAngle, MaxUpAngle, MaxDownAngle, val); Object.Instantiate(LaserPrefab, val.position, Quaternion.LookRotation(val2)); } if (MuzzleEffects == null) { continue; } ParticleSystem[] muzzleEffects = MuzzleEffects; foreach (ParticleSystem val3 in muzzleEffects) { if ((Object)(object)val3 != (Object)null) { val3.Play(); } } } if ((Object)(object)FireSound != (Object)null && (Object)(object)m_audioSource != (Object)null) { m_audioSource.PlayOneShot(FireSound, FireSoundVolume); } try { ((FVRFireArm)this).Recoil(((FVRFireArm)this).IsTwoHandStabilized(), ((FVRFireArm)this).IsForegripStabilized(), ((FVRFireArm)this).IsShoulderStabilized(), (FVRFireArmRecoilProfile)null, 1f); } catch { } if ((Object)(object)currentBattery != (Object)null) { currentBattery.AddHeat(HeatPerShotPercent); m_heatPercent = currentBattery.HeatPercent; UpdateOverheatEffects(m_heatPercent); if (m_heatPercent >= OverheatPercent) { try { currentBattery.HandleOverheatEject(); } catch { } currentBattery = null; } } m_lastFireTime = Time.time; } private IEnumerator CoolDelayAndStart() { yield return (object)new WaitForSeconds(CoolDelayAfterStop); if (!((Object)(object)currentBattery == (Object)null) && !currentBattery.IsOverheated) { m_isCooling = true; while ((Object)(object)currentBattery != (Object)null && currentBattery.HeatPercent > 0f && !currentBattery.IsOverheated && !m_isTriggerHeld) { float delta = CoolPercentPerSecond * Time.deltaTime; currentBattery.AddHeat(0f - delta); m_heatPercent = currentBattery.HeatPercent; UpdateOverheatEffects(m_heatPercent); yield return null; } m_isCooling = false; } } private void UpdateOverheatEffects(float currentHeat) { if (OverheatEffects == null) { return; } for (int i = 0; i < OverheatEffects.Count; i++) { OverheatEffectEntry overheatEffectEntry = OverheatEffects[i]; if (overheatEffectEntry != null && !((Object)(object)overheatEffectEntry.EffectObject == (Object)null)) { bool flag = currentHeat >= overheatEffectEntry.TriggerThreshold; if (overheatEffectEntry.EffectObject.activeSelf != flag) { overheatEffectEntry.EffectObject.SetActive(flag); } } } } public void OnBatteryInserted(TridentBattery battery) { //IL_0057: 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) currentBattery = battery; try { ((FVRPhysicalObject)battery).StoreAndDestroyRigidbody(); } catch { } if ((Object)(object)batterySlot != (Object)null) { ((FVRPhysicalObject)battery).SetParentage(batterySlot); } else { ((Component)battery).transform.SetParent(((Component)this).transform, false); } ((Component)battery).transform.localPosition = Vector3.zero; ((Component)battery).transform.localRotation = Quaternion.identity; try { ((FVRInteractiveObject)battery).SetAllCollidersToLayer(false, "NoCol"); } catch { } if ((Object)(object)BatteryInsertSound != (Object)null && (Object)(object)m_audioSource != (Object)null) { m_audioSource.PlayOneShot(BatteryInsertSound, 1f); } m_heatPercent = battery.HeatPercent; UpdateOverheatEffects(m_heatPercent); } public void OnBatteryEjected(TridentBattery battery) { if ((Object)(object)currentBattery == (Object)(object)battery) { currentBattery = null; } try { ((FVRInteractiveObject)battery).SetAllCollidersToLayer(false, "Default"); } catch { } UpdateOverheatEffects(0f); } private Vector3 RandomDirectionInCone(Vector3 forward, float coneHalfAngleDeg, float maxUpDeg, float maxDownDeg, Transform muzzle) { //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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0050: 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_0064: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_00cf: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) float value = Random.value; float num = Random.Range(0f, (float)Math.PI * 2f); float num2 = Mathf.Sqrt(value) * Mathf.Tan((float)Math.PI / 180f * coneHalfAngleDeg); Vector3 right = muzzle.right; Vector3 up = muzzle.up; Vector3 val = forward + right * (Mathf.Cos(num) * num2) + up * (Mathf.Sin(num) * num2); Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = muzzle.InverseTransformDirection(normalized); float num3 = Mathf.Atan2(val2.y, val2.z) * 57.29578f; float num4 = Mathf.Clamp(num3, 0f - maxDownDeg, maxUpDeg); float num5 = Mathf.Atan2(val2.x, val2.z) * 57.29578f; Quaternion val3 = Quaternion.Euler(num4, num5, 0f); Vector3 val4 = muzzle.TransformDirection(val3 * Vector3.forward); return ((Vector3)(ref val4)).normalized; } private void OnDrawGizmosSelected() { //IL_0011: 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_0048: Unknown result type (might be due to invalid IL or missing references) if (Muzzles == null) { return; } Gizmos.color = Color.cyan; Transform[] muzzles = Muzzles; foreach (Transform val in muzzles) { if (!((Object)(object)val == (Object)null)) { DrawConeGizmo(val.position, val.forward, ConeAngle, 1f); } } } private void DrawConeGizmo(Vector3 origin, Vector3 forward, float halfAngleDeg, float length) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_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_0071: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) int num = 18; Quaternion val = Quaternion.LookRotation(forward); Vector3 val2 = origin + val * Quaternion.Euler(0f, 0f - halfAngleDeg, 0f) * Vector3.forward * length; for (int i = 1; i <= num; i++) { float num2 = 0f - halfAngleDeg + 2f * halfAngleDeg * ((float)i / (float)num); Vector3 val3 = origin + val * Quaternion.Euler(0f, num2, 0f) * Vector3.forward * length; Gizmos.DrawLine(origin, val3); Gizmos.DrawLine(val2, val3); val2 = val3; } } } [DisallowMultipleComponent] public class TridentBattery : FVRPhysicalObject { [Serializable] public class HeatAnimatedObject { public Transform AnimatedObject; public Transform StartTransform; public Transform EndTransform; } [Header("Heat Animation")] public HeatAnimatedObject[] HeatAnimatedObjects; [Header("Battery Heat")] [Tooltip("当前热量百分比 0-100")] public float HeatPercent = 0f; [Tooltip("是否处于过热状态(过热后无法冷却)")] public bool IsOverheated = false; [Tooltip("当过热时是否阻止冷却")] public bool PreventCoolingWhenOverheated = true; [Header("Insertion")] [Tooltip("被插入的 Trident 引用(runtime)")] public Trident InsertedInto; [Tooltip("插入后是否被视为已插入(runtime)")] public bool IsInserted = false; [Header("Eject")] public float EjectForce = 0.2f; [Header("Audio")] public AudioClip InsertSound; public AudioClip EjectSound; [Header("Eject Target")] public Transform BatteryEjectPos; private Collider m_triggerCollider; [Header("Collision Control")] public Collider[] collidersToDisable; public bool preferDisableGameObject = false; public bool preferLayerNoCol = true; private bool[] _prevColliderEnabled; private int[] _prevColliderLayer; public Collider slotTriggerCollider; private void Awake() { try { ((FVRPhysicalObject)this).Awake(); } catch { Debug.LogWarning((object)"[TridentBattery] base.Awake() threw an exception."); } m_triggerCollider = ((Component)this).GetComponent(); if ((Object)(object)m_triggerCollider != (Object)null) { m_triggerCollider.isTrigger = true; } } private void Update() { UpdateHeatAnimations(); } private void OnDestroy() { InsertedInto = null; IsInserted = false; } public void AddHeat(float percent) { if (!IsOverheated || !PreventCoolingWhenOverheated || !(percent < 0f)) { HeatPercent += percent; HeatPercent = Mathf.Clamp(HeatPercent, 0f, 999f); if (HeatPercent >= 100f && !IsOverheated) { IsOverheated = true; } UpdateHeatAnimations(); } } public void HandleOverheatEject() { IsOverheated = true; EjectFromTrident(); } public void InsertIntoTrident(Trident t) { //IL_017a: 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_00c1: 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_0241: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)t == (Object)null || ((Object)(object)InsertedInto == (Object)(object)t && IsInserted)) { return; } if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null) { try { ((FVRInteractiveObject)this).m_hand.ForceSetInteractable((FVRInteractiveObject)null); } catch { } try { ((FVRInteractiveObject)this).EndInteraction(((FVRInteractiveObject)this).m_hand); } catch { } } InsertedInto = t; IsInserted = true; bool flag = false; try { ((FVRPhysicalObject)this).StoreAndDestroyRigidbody(); flag = true; } catch { } if (!flag && (Object)(object)((FVRPhysicalObject)this).RootRigidbody != (Object)null) { ((FVRPhysicalObject)this).RootRigidbody.velocity = Vector3.zero; ((FVRPhysicalObject)this).RootRigidbody.angularVelocity = Vector3.zero; ((FVRPhysicalObject)this).RootRigidbody.isKinematic = true; ((FVRPhysicalObject)this).RootRigidbody.interpolation = (RigidbodyInterpolation)1; ((FVRPhysicalObject)this).RootRigidbody.collisionDetectionMode = (CollisionDetectionMode)1; } bool flag2 = false; try { if ((Object)(object)t.batterySlot != (Object)null) { ((FVRPhysicalObject)this).SetParentage(t.batterySlot); flag2 = true; } } catch { } if (!flag2) { if ((Object)(object)t.batterySlot != (Object)null) { ((Component)this).transform.SetParent(t.batterySlot, false); } else { ((Component)this).transform.SetParent(((Component)t).transform, false); } } ((Component)this).transform.localPosition = Vector3.zero; ((Component)this).transform.localRotation = Quaternion.identity; try { if (collidersToDisable != null && collidersToDisable.Length > 0) { DisableAssignedColliders(); } else { ((FVRInteractiveObject)this).SetAllCollidersToLayer(false, "NoCol"); } } catch { } try { t.OnBatteryInserted(this); } catch { } try { AudioSource component = ((Component)t).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)InsertSound != (Object)null) { component.PlayOneShot(InsertSound, 1f); } else if ((Object)(object)InsertSound != (Object)null) { AudioSource.PlayClipAtPoint(InsertSound, ((Component)this).transform.position); } } catch { } } public void EjectFromTrident() { //IL_00d5: 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_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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) Trident insertedInto = InsertedInto; if ((Object)(object)insertedInto != (Object)null) { try { insertedInto.OnBatteryEjected(this); } catch { } } IsInserted = false; InsertedInto = null; try { ((FVRPhysicalObject)this).SetParentage((Transform)null); } catch { } try { ((Component)this).transform.SetParent((Transform)null, true); } catch { } try { ((FVRPhysicalObject)this).RecoverRigidbody(); } catch { } try { RestoreAssignedColliders(); } catch { } try { ((FVRInteractiveObject)this).SetAllCollidersToLayer(false, "Default"); } catch { } if ((Object)(object)((FVRPhysicalObject)this).RootRigidbody != (Object)null) { ((FVRPhysicalObject)this).RootRigidbody.isKinematic = false; ((FVRPhysicalObject)this).RootRigidbody.velocity = Vector3.zero; ((FVRPhysicalObject)this).RootRigidbody.angularVelocity = Vector3.zero; Vector3 val = ((Component)this).transform.up; if ((Object)(object)BatteryEjectPos != (Object)null) { Vector3 val2 = BatteryEjectPos.position - ((Component)this).transform.position; val = ((Vector3)(ref val2)).normalized; } ((FVRPhysicalObject)this).RootRigidbody.AddForce(val * EjectForce, (ForceMode)2); } try { if ((Object)(object)EjectSound != (Object)null) { AudioSource.PlayClipAtPoint(EjectSound, ((Component)this).transform.position); } } catch { } } public void DisableAssignedColliders() { if (collidersToDisable == null || collidersToDisable.Length == 0) { return; } int num = collidersToDisable.Length; _prevColliderEnabled = new bool[num]; _prevColliderLayer = new int[num]; int num2 = LayerMask.NameToLayer("NoCol"); for (int i = 0; i < num; i++) { Collider val = collidersToDisable[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)slotTriggerCollider)) { _prevColliderEnabled[i] = val.enabled; _prevColliderLayer[i] = ((Component)val).gameObject.layer; if (preferLayerNoCol && num2 != -1) { ((Component)val).gameObject.layer = num2; } else { val.enabled = false; } } } } public void RestoreAssignedColliders() { if (collidersToDisable == null || collidersToDisable.Length == 0) { return; } int num = collidersToDisable.Length; for (int i = 0; i < num; i++) { Collider val = collidersToDisable[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)slotTriggerCollider)) { ((Component)val).gameObject.layer = _prevColliderLayer[i]; val.enabled = _prevColliderEnabled[i]; } } } private void UpdateHeatAnimations() { //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_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_00c6: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) if (HeatAnimatedObjects == null || HeatAnimatedObjects.Length == 0) { return; } float num = Mathf.Clamp01(HeatPercent / 100f); HeatAnimatedObject[] heatAnimatedObjects = HeatAnimatedObjects; foreach (HeatAnimatedObject heatAnimatedObject in heatAnimatedObjects) { if (heatAnimatedObject != null && !((Object)(object)heatAnimatedObject.AnimatedObject == (Object)null) && !((Object)(object)heatAnimatedObject.StartTransform == (Object)null) && !((Object)(object)heatAnimatedObject.EndTransform == (Object)null)) { heatAnimatedObject.AnimatedObject.position = Vector3.Lerp(heatAnimatedObject.StartTransform.position, heatAnimatedObject.EndTransform.position, num); heatAnimatedObject.AnimatedObject.rotation = Quaternion.Lerp(heatAnimatedObject.StartTransform.rotation, heatAnimatedObject.EndTransform.rotation, num); heatAnimatedObject.AnimatedObject.localScale = Vector3.Lerp(heatAnimatedObject.StartTransform.localScale, heatAnimatedObject.EndTransform.localScale, num); } } } } public class TridentBatteryGrab : FVRInteractiveObject { public Trident Weapon; public Collider batteryTriggerCollider; public Collider batteryExitDetector; public override bool IsInteractable() { return (Object)(object)Weapon != (Object)null && (Object)(object)Weapon.currentBattery != (Object)null; } public override void BeginInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).BeginInteraction(hand); if ((Object)(object)Weapon == (Object)null || (Object)(object)Weapon.currentBattery == (Object)null) { ((FVRInteractiveObject)this).EndInteraction(hand); return; } if ((Object)(object)batteryTriggerCollider != (Object)null) { batteryTriggerCollider.enabled = false; } ((FVRInteractiveObject)this).EndInteraction(hand); TridentBattery currentBattery = Weapon.currentBattery; currentBattery.EjectFromTrident(); hand.ForceSetInteractable((FVRInteractiveObject)(object)currentBattery); ((FVRInteractiveObject)currentBattery).BeginInteraction(hand); ((MonoBehaviour)Weapon).StartCoroutine(CheckBatteryExit(currentBattery)); } private IEnumerator CheckBatteryExit(TridentBattery battery) { yield return null; yield return null; if (!((Object)(object)batteryExitDetector == (Object)null) && !((Object)(object)batteryTriggerCollider == (Object)null)) { Bounds bounds = batteryExitDetector.bounds; if (!((Bounds)(ref bounds)).Contains(((Component)battery).transform.position)) { batteryTriggerCollider.enabled = true; } else { ((MonoBehaviour)Weapon).StartCoroutine(CheckBatteryExit(battery)); } } } } [DisallowMultipleComponent] public class TridentBatteryTrigger : MonoBehaviour { [Header("References")] public Trident trident; public Transform batterySlot; [Header("Trigger Settings")] public bool debugLogs = true; private void OnTriggerEnter(Collider other) { TryInsertBattery(other); } private void OnTriggerExit(Collider other) { TridentBattery tridentBattery = ((Component)other).GetComponent() ?? ((Component)other).GetComponentInParent(); if (!((Object)(object)tridentBattery == (Object)null)) { ((Component)this).GetComponent().enabled = true; } } private void TryInsertBattery(Collider other) { if (!((Object)(object)trident == (Object)null) && !((Object)(object)batterySlot == (Object)null) && !((Object)(object)trident.currentBattery != (Object)null)) { TridentBattery tridentBattery = ((Component)other).GetComponent() ?? ((Component)other).GetComponentInParent(); if (!((Object)(object)tridentBattery == (Object)null) && !tridentBattery.IsInserted && !tridentBattery.IsOverheated && tridentBattery.HeatPercent < trident.OverheatPercent) { tridentBattery.InsertIntoTrident(trident); trident.currentBattery = tridentBattery; } } } } }