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 UnityEngine.SceneManagement; 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 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 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); } } } } } namespace FNAFModeScripts { public class ChancetoNextStage : MonoBehaviour { [Serializable] public class StageData { [Header("每隔多少秒进行一次概率判定")] public float rollInterval = 5f; [Header("进入下一阶段的概率(0~1)")] [Range(0f, 1f)] public float chanceToAdvance = 0.2f; [Header("如果超过多少秒还没进入下一阶段 → 强制进入")] public float forceAdvanceTime = 20f; [Header("进入此阶段时激活的 Prefab")] public GameObject[] activatePrefabs; } [Header("阶段列表(按顺序执行)")] public StageData[] stages; [Header("Awake 时自动启动")] public bool autoStart = true; [Header("是否一次性只显示当前阶段的 Prefab")] public bool onlyShowCurrentStage = false; private int currentStage = 0; private void Awake() { if (autoStart) { StartStages(); } } public void StartStages() { currentStage = 0; ((MonoBehaviour)this).StartCoroutine(RunStages()); } private IEnumerator RunStages() { while (currentStage < stages.Length) { StageData stage = stages[currentStage]; if (onlyShowCurrentStage) { HideAllPrefabs(); } ActivatePrefabs(stage.activatePrefabs); float elapsed = 0f; while (true) { if (elapsed < stage.forceAdvanceTime) { yield return (object)new WaitForSeconds(stage.rollInterval); elapsed += stage.rollInterval; float roll = Random.value; if (roll <= stage.chanceToAdvance) { currentStage++; break; } continue; } currentStage++; break; } yield return null; } } private void ActivatePrefabs(GameObject[] prefabs) { if (prefabs == null) { return; } foreach (GameObject val in prefabs) { if ((Object)(object)val != (Object)null) { val.SetActive(true); } } } private void HideAllPrefabs() { StageData[] array = stages; foreach (StageData stageData in array) { if (stageData.activatePrefabs == null) { continue; } GameObject[] activatePrefabs = stageData.activatePrefabs; foreach (GameObject val in activatePrefabs) { if ((Object)(object)val != (Object)null) { val.SetActive(false); } } } } } } namespace theWNbotMods { 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); } } } } } namespace FNAFModeScripts { public class EventDoorClose : MonoBehaviour { [Header("随机事件控制")] [Range(0f, 1f)] public float eventChance = 0.5f; [Header("门动画(Start / End Prefab)")] public Transform door; public GameObject doorOpenPrefab; public GameObject doorClosedPrefab; public float openAnimDuration = 0.6f; public float closeAnimDuration = 0.15f; private Vector3 openPos; private Quaternion openRot; private Vector3 closedPos; private Quaternion closedRot; private Coroutine animCoroutine; [Header("鬼脸(场景中隐藏物体)")] public GameObject ghostFaceObject; public float ghostDuration = 0.4f; [Header("音效")] public AudioSource audioSource; public AudioClip doorOpenSound; public AudioClip ghostSound; public AudioClip doorCloseSound; [Header("Trigger 引用")] public Collider openTrigger; public Collider scareTrigger; [Header("事件控制")] public bool oneTime = true; private bool opened = false; private bool scared = false; [Header("Debug 控制")] public bool debugOpen = false; public bool debugScare = false; private void Start() { //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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) if (Random.value > eventChance) { ((Component)this).gameObject.SetActive(false); return; } if ((Object)(object)doorOpenPrefab != (Object)null) { openPos = doorOpenPrefab.transform.localPosition; openRot = doorOpenPrefab.transform.localRotation; } if ((Object)(object)doorClosedPrefab != (Object)null) { closedPos = doorClosedPrefab.transform.localPosition; closedRot = doorClosedPrefab.transform.localRotation; } if ((Object)(object)ghostFaceObject != (Object)null) { ghostFaceObject.SetActive(false); } } private void Update() { if (debugOpen) { debugOpen = false; ((MonoBehaviour)this).StartCoroutine(OpenDoor()); } if (debugScare) { debugScare = false; ((MonoBehaviour)this).StartCoroutine(ScareAndClose()); } } private void OnTriggerEnter(Collider other) { if (!((Object)(object)((Component)other).transform != (Object)(object)GM.CurrentPlayerBody.Head)) { if ((Object)(object)other == (Object)(object)openTrigger && !opened) { opened = true; ((MonoBehaviour)this).StartCoroutine(OpenDoor()); } if ((Object)(object)other == (Object)(object)scareTrigger && !scared) { scared = true; ((MonoBehaviour)this).StartCoroutine(ScareAndClose()); } } } private IEnumerator OpenDoor() { if ((Object)(object)audioSource != (Object)null && (Object)(object)doorOpenSound != (Object)null) { audioSource.PlayOneShot(doorOpenSound); } yield return ((MonoBehaviour)this).StartCoroutine(AnimateDoor(openPos, openRot, openAnimDuration)); } private IEnumerator ScareAndClose() { if ((Object)(object)ghostFaceObject != (Object)null) { ghostFaceObject.SetActive(true); } if ((Object)(object)audioSource != (Object)null && (Object)(object)ghostSound != (Object)null) { audioSource.PlayOneShot(ghostSound); } yield return (object)new WaitForSeconds(ghostDuration); if ((Object)(object)ghostFaceObject != (Object)null) { ghostFaceObject.SetActive(false); } if ((Object)(object)audioSource != (Object)null && (Object)(object)doorCloseSound != (Object)null) { audioSource.PlayOneShot(doorCloseSound); } yield return ((MonoBehaviour)this).StartCoroutine(AnimateDoor(closedPos, closedRot, closeAnimDuration)); } private IEnumerator AnimateDoor(Vector3 targetPos, Quaternion targetRot, 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) if (!((Object)(object)door == (Object)null)) { Vector3 startPos = door.localPosition; Quaternion startRot = door.localRotation; float t = 0f; while (t < duration) { float lerp = t / duration; door.localPosition = Vector3.Lerp(startPos, targetPos, lerp); door.localRotation = Quaternion.Lerp(startRot, targetRot, lerp); t += Time.deltaTime; yield return null; } door.localPosition = targetPos; door.localRotation = targetRot; } } } public class FNAFAnimatronicAI : MonoBehaviour { [Header("注释")] [TextArea(2, 5)] public string developerNote; [Header("移动概率(每小时 AI Level)")] [Range(0f, 20f)] public int AI_12AM = 20; [Range(0f, 20f)] public int AI_1AM = 20; [Range(0f, 20f)] public int AI_2AM = 20; [Range(0f, 20f)] public int AI_3AM = 20; [Range(0f, 20f)] public int AI_4AM = 20; [Range(0f, 20f)] public int AI_5AM = 20; [Header("AI Roll 时间范围 (秒)")] public float minRollTime = 1f; public float maxRollTime = 2f; private float rollTimer = 0f; private float nextRollTime = 0f; private int currentAILevel = 0; private FNAFWaypoint[] waypoints; private int currentIndex = 0; private bool aiActive = false; private void Start() { waypoints = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < waypoints.Length; i++) { waypoints[i].index = i; } SetAllPosesInactive(); ActivatePose(currentIndex); FNAFNightClock fNAFNightClock = Object.FindObjectOfType(); if ((Object)(object)fNAFNightClock != (Object)null) { fNAFNightClock.OnHourChanged = (Action)Delegate.Combine(fNAFNightClock.OnHourChanged, new Action(SetAILevelByHour)); } aiActive = true; if ((Object)(object)fNAFNightClock != (Object)null) { SetAILevelByHour(fNAFNightClock.currentHour); } else { SetAILevelByHour(12); } ScheduleNextRoll(); TryMove(); Debug.Log((object)(((Object)this).name + " AI Enable")); } private void Update() { if (aiActive) { rollTimer += Time.deltaTime; if (rollTimer >= nextRollTime) { rollTimer = 0f; ScheduleNextRoll(); TryMove(); } } } private void ScheduleNextRoll() { nextRollTime = Random.Range(minRollTime, maxRollTime); } private void SetAllPosesInactive() { for (int i = 0; i < waypoints.Length; i++) { if ((Object)(object)waypoints[i].Pose != (Object)null) { waypoints[i].Pose.SetActive(false); } } } private void ActivatePose(int index) { if ((Object)(object)waypoints[index].Pose != (Object)null) { waypoints[index].Pose.SetActive(true); } } private void TryMove() { int num = Random.Range(1, 21); Debug.Log((object)(((Object)this).name + " Roll = " + num + " / AI Level = " + currentAILevel)); if (num < currentAILevel) { MoveToNextWaypoint(); } } private void MoveToNextWaypoint() { FNAFWaypoint fNAFWaypoint = waypoints[currentIndex]; if (fNAFWaypoint.nextPoints == null || fNAFWaypoint.nextPoints.Length == 0) { return; } int num = ChooseNextWaypoint(fNAFWaypoint); FNAFWaypoint fNAFWaypoint2 = waypoints[num]; if (fNAFWaypoint2.isDoorNode && (Object)(object)fNAFWaypoint2.doorToCheck != (Object)null) { FNAFDoor component = fNAFWaypoint2.doorToCheck.GetComponent(); if (fNAFWaypoint2.breakDoor && (Object)(object)component != (Object)null) { component.ForceDoorBroken(); Debug.Log((object)(((Object)this).name + " 把门破坏了!门无法关闭!")); } if ((Object)(object)component != (Object)null && component.currentState == FNAFDoor.DoorState.Closed) { Debug.Log((object)(((Object)this).name + " Door Closed, gets back")); if (fNAFWaypoint2.failReturnPoints != null && fNAFWaypoint2.failReturnPoints.Length > 0) { int num2 = Random.Range(0, fNAFWaypoint2.failReturnPoints.Length); num = fNAFWaypoint2.failReturnPoints[num2].index; } else { num = currentIndex; } } } waypoints[currentIndex].Pose.SetActive(false); currentIndex = num; waypoints[currentIndex].Pose.SetActive(true); Debug.Log((object)(((Object)this).name + " Move to waypoint: " + currentIndex)); waypoints[currentIndex].TryPlaySound(); waypoints[currentIndex].TriggerAttack(); waypoints[currentIndex].StartForceMove(); } private int ChooseNextWaypoint(FNAFWaypoint wp) { if (wp.nextPoints == null || wp.nextPoints.Length == 0) { return wp.index; } if (wp.nextPoints.Length == 1) { return wp.nextPoints[0].nextPoint.index; } int num = 0; for (int i = 0; i < wp.nextPoints.Length; i++) { num += wp.nextPoints[i].chance; } int num2 = Random.Range(0, num); int num3 = 0; for (int j = 0; j < wp.nextPoints.Length; j++) { num3 += wp.nextPoints[j].chance; if (num2 < num3) { return wp.nextPoints[j].nextPoint.index; } } return wp.nextPoints[0].nextPoint.index; } public void ForceMoveTo(int waypointIndex) { waypoints[currentIndex].Pose.SetActive(false); currentIndex = waypointIndex; waypoints[currentIndex].Pose.SetActive(true); Debug.Log((object)(((Object)this).name + " 强制移动到节点: " + currentIndex)); waypoints[currentIndex].TryPlaySound(); waypoints[currentIndex].TriggerAttack(); waypoints[currentIndex].StartForceMove(); } public void DeactivateAI() { aiActive = false; Debug.Log((object)(((Object)this).name + " AI Stopped")); } public void SetAILevelByHour(int hour) { switch (hour) { case 12: currentAILevel = AI_12AM; break; case 1: currentAILevel = AI_1AM; break; case 2: currentAILevel = AI_2AM; break; case 3: currentAILevel = AI_3AM; break; case 4: currentAILevel = AI_4AM; break; case 5: currentAILevel = AI_5AM; break; } Debug.Log((object)(((Object)this).name + " AI Level to: " + currentAILevel + "(Now Time: " + hour + "AM)")); } } public enum CameraSwitchInitialState { Off, On } public class FNAFCameraButton : MonoBehaviour { [Header("摄像头管理器引用")] public FNAFCameraManager cameraManager; [Header("对应摄像头索引(从 0 开始)")] public int cameraIndex = 0; [Header("开关动画")] public Transform switchHandle; public GameObject handleStartPrefab; public GameObject handleEndPrefab; public float animDuration = 0.15f; [Header("开关音效")] public AudioSource audioSource; public AudioClip toggleSound; private Vector3 startPos; private Vector3 endPos; private Quaternion startRot; private Quaternion endRot; private Coroutine animCoroutine; private AR15HandleSightFlipper flipper; private bool switchDown = false; [Header("初始状态")] public CameraSwitchInitialState initialState = CameraSwitchInitialState.Off; [Header("Debug 控制")] public bool debugTrigger = false; private bool lastFlipState; private void Start() { //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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00f8: 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) flipper = ((Component)this).GetComponent(); switchDown = initialState == CameraSwitchInitialState.On; lastFlipState = switchDown; if ((Object)(object)switchHandle != (Object)null && (Object)(object)handleStartPrefab != (Object)null && (Object)(object)handleEndPrefab != (Object)null) { startPos = handleStartPrefab.transform.localPosition; startRot = handleStartPrefab.transform.localRotation; endPos = handleEndPrefab.transform.localPosition; endRot = handleEndPrefab.transform.localRotation; switchHandle.localPosition = ((!switchDown) ? startPos : endPos); switchHandle.localRotation = ((!switchDown) ? startRot : endRot); } if ((Object)(object)flipper != (Object)null) { flipper.m_isLargeAperture = switchDown; } } private void Update() { if (debugTrigger) { debugTrigger = false; TriggerAction(); } if ((Object)(object)flipper != (Object)null && flipper.m_isLargeAperture != lastFlipState) { lastFlipState = flipper.m_isLargeAperture; switchDown = lastFlipState; PlaySwitchAnimation(switchDown); PlayToggleSound(); ActivateCamera(); } } public void TriggerAction() { switchDown = !switchDown; PlaySwitchAnimation(switchDown); PlayToggleSound(); ActivateCamera(); Debug.Log((object)"[FNAFCameraButton] Button Triggered"); } private void ActivateCamera() { if ((Object)(object)cameraManager != (Object)null) { cameraManager.SwitchToCamera(cameraIndex); } } private void PlayToggleSound() { if ((Object)(object)audioSource != (Object)null && (Object)(object)toggleSound != (Object)null) { audioSource.PlayOneShot(toggleSound); } } private void PlaySwitchAnimation(bool down) { if (animCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(animCoroutine); } animCoroutine = ((MonoBehaviour)this).StartCoroutine(AnimateSwitch(down)); } private IEnumerator AnimateSwitch(bool down) { if (!((Object)(object)switchHandle == (Object)null)) { Vector3 fromPos = switchHandle.localPosition; Quaternion fromRot = switchHandle.localRotation; Vector3 toPos = ((!down) ? startPos : endPos); Quaternion toRot = ((!down) ? startRot : endRot); float t = 0f; while (t < animDuration) { float lerp = t / animDuration; switchHandle.localPosition = Vector3.Lerp(fromPos, toPos, lerp); switchHandle.localRotation = Quaternion.Lerp(fromRot, toRot, lerp); t += Time.deltaTime; yield return null; } switchHandle.localPosition = toPos; switchHandle.localRotation = toRot; } } } public class FNAFCameraManager : MonoBehaviour, IFNAFPowerConsumer { [Header("屏幕元素")] public GameObject blackScreen; public List cameraViews; [Header("Cameras(与 Camera Views 一一对应的摄像头 Prefab)")] public List cameras; [Header("切换效果")] public float switchBlackTime = 0.15f; public AudioSource audioSource; public AudioClip switchSound; private int currentIndex = -1; private Coroutine switchRoutine; [Header("监控状态")] public bool cameraOff = true; public bool powerLocked = false; [Header("耗电设置")] public float cameraDrainRate = 0.2f; private void Start() { cameraOff = true; powerLocked = false; ShowOnlyBlackScreen(); FNAFPowerManager fNAFPowerManager = Object.FindObjectOfType(); if ((Object)(object)fNAFPowerManager != (Object)null) { fNAFPowerManager.OnPowerDepleted = (Action)Delegate.Combine(fNAFPowerManager.OnPowerDepleted, new Action(ForceBlackout)); } } private void ShowOnlyBlackScreen() { if ((Object)(object)blackScreen != (Object)null) { blackScreen.SetActive(true); } if (cameraViews != null) { for (int i = 0; i < cameraViews.Count; i++) { if ((Object)(object)cameraViews[i] != (Object)null) { cameraViews[i].SetActive(false); } } } if (cameras != null) { for (int j = 0; j < cameras.Count; j++) { if ((Object)(object)cameras[j] != (Object)null) { cameras[j].SetActive(false); } } } currentIndex = -1; } public void SwitchToCamera(int index) { if (!powerLocked && !cameraOff && cameraViews != null && index >= 0 && index < cameraViews.Count && index != currentIndex) { if (switchRoutine != null) { ((MonoBehaviour)this).StopCoroutine(switchRoutine); } switchRoutine = ((MonoBehaviour)this).StartCoroutine(SwitchRoutine(index)); } } private IEnumerator SwitchRoutine(int targetIndex) { if ((Object)(object)audioSource != (Object)null && (Object)(object)switchSound != (Object)null) { audioSource.PlayOneShot(switchSound); } if ((Object)(object)blackScreen != (Object)null) { blackScreen.SetActive(true); } for (int i = 0; i < cameraViews.Count; i++) { if ((Object)(object)cameraViews[i] != (Object)null) { cameraViews[i].SetActive(false); } } if (cameras != null) { for (int j = 0; j < cameras.Count; j++) { if ((Object)(object)cameras[j] != (Object)null) { cameras[j].SetActive(false); } } } if (switchBlackTime > 0f) { yield return (object)new WaitForSeconds(switchBlackTime); } GameObject targetView = cameraViews[targetIndex]; if ((Object)(object)targetView != (Object)null) { targetView.SetActive(true); } if (cameras != null && targetIndex < cameras.Count) { GameObject val = cameras[targetIndex]; if ((Object)(object)val != (Object)null) { val.SetActive(true); } } if ((Object)(object)blackScreen != (Object)null) { blackScreen.SetActive(false); } currentIndex = targetIndex; switchRoutine = null; } public void TurnOffCamera() { if (powerLocked) { return; } cameraOff = true; if ((Object)(object)blackScreen != (Object)null) { blackScreen.SetActive(true); } if (cameraViews != null) { for (int i = 0; i < cameraViews.Count; i++) { if ((Object)(object)cameraViews[i] != (Object)null) { cameraViews[i].SetActive(false); } } } if (cameras != null) { for (int j = 0; j < cameras.Count; j++) { if ((Object)(object)cameras[j] != (Object)null) { cameras[j].SetActive(false); } } } currentIndex = -1; } public void TurnOnCamera() { if (!powerLocked) { cameraOff = false; if (currentIndex >= 0) { SwitchToCamera(currentIndex); } else if (cameraViews != null && cameraViews.Count > 0) { SwitchToCamera(0); } } } public void ForceBlackout() { powerLocked = true; cameraOff = true; if ((Object)(object)blackScreen != (Object)null) { blackScreen.SetActive(true); } if (cameraViews != null) { for (int i = 0; i < cameraViews.Count; i++) { if ((Object)(object)cameraViews[i] != (Object)null) { cameraViews[i].SetActive(false); } } } if (cameras != null) { for (int j = 0; j < cameras.Count; j++) { if ((Object)(object)cameras[j] != (Object)null) { cameras[j].SetActive(false); } } } currentIndex = -1; } public bool IsConsumingPower() { if (powerLocked) { return false; } if (cameraOff) { return false; } return true; } public float GetPowerDrainRate() { return cameraDrainRate; } } public class FNAFCameraOffSwitch : MonoBehaviour { [Header("监控管理器")] public FNAFCameraManager cameraManager; [Header("开关动画")] public Transform switchHandle; public GameObject handleStartPrefab; public GameObject handleEndPrefab; public float animDuration = 0.2f; private Vector3 startPos; private Vector3 endPos; private Quaternion startRot; private Quaternion endRot; private Coroutine animCoroutine; private AR15HandleSightFlipper flipper; [Header("音效")] public AudioSource audioSource; public AudioClip toggleSound; public AudioClip turnOffSound; public AudioClip turnOnSound; private bool switchDown = true; private bool isAnimating = false; [Header("Debug 控制")] public bool debugToggle = false; private void Start() { //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_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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) flipper = ((Component)this).GetComponent(); if ((Object)(object)switchHandle != (Object)null && (Object)(object)handleStartPrefab != (Object)null && (Object)(object)handleEndPrefab != (Object)null) { startPos = handleStartPrefab.transform.localPosition; startRot = handleStartPrefab.transform.localRotation; endPos = handleEndPrefab.transform.localPosition; endRot = handleEndPrefab.transform.localRotation; switchHandle.localPosition = startPos; switchHandle.localRotation = startRot; } if ((Object)(object)flipper != (Object)null) { flipper.m_isLargeAperture = switchDown; } } private void Update() { if (debugToggle) { debugToggle = false; ToggleSwitch(); } if ((!((Object)(object)cameraManager != (Object)null) || !cameraManager.cameraOff || !((Object)(object)flipper != (Object)null) || flipper.m_isLargeAperture != switchDown) && !isAnimating && (Object)(object)flipper != (Object)null && flipper.m_isLargeAperture != switchDown) { ToggleSwitch(); } } private void ToggleSwitch() { if (isAnimating) { return; } switchDown = !switchDown; PlaySwitchAnimation(switchDown); if ((Object)(object)audioSource != (Object)null && (Object)(object)toggleSound != (Object)null) { audioSource.PlayOneShot(toggleSound); } if (switchDown) { if ((Object)(object)audioSource != (Object)null && (Object)(object)turnOffSound != (Object)null) { audioSource.PlayOneShot(turnOffSound); } if ((Object)(object)cameraManager != (Object)null) { cameraManager.TurnOffCamera(); } } else { if ((Object)(object)audioSource != (Object)null && (Object)(object)turnOnSound != (Object)null) { audioSource.PlayOneShot(turnOnSound); } if ((Object)(object)cameraManager != (Object)null) { cameraManager.TurnOnCamera(); } } if ((Object)(object)flipper != (Object)null) { flipper.m_isLargeAperture = switchDown; } } private void PlaySwitchAnimation(bool down) { if (animCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(animCoroutine); } isAnimating = true; animCoroutine = ((MonoBehaviour)this).StartCoroutine(AnimateSwitch(down)); } private IEnumerator AnimateSwitch(bool down) { if (!((Object)(object)switchHandle == (Object)null)) { Vector3 fromPos = switchHandle.localPosition; Quaternion fromRot = switchHandle.localRotation; Vector3 toPos = ((!down) ? startPos : endPos); Quaternion toRot = ((!down) ? startRot : endRot); float t = 0f; while (t < animDuration) { float lerp = t / animDuration; switchHandle.localPosition = Vector3.Lerp(fromPos, toPos, lerp); switchHandle.localRotation = Quaternion.Lerp(fromRot, toRot, lerp); t += Time.deltaTime; yield return null; } switchHandle.localPosition = toPos; switchHandle.localRotation = toRot; isAnimating = false; } } } public class FNAFDeskFan : MonoBehaviour, IFNAFPowerConsumer { [Header("旋转部件(扇叶)")] public Transform rotatePart; [Header("旋转设置")] public Vector3 rotationAxis = new Vector3(0f, 1f, 0f); public float rotationSpeed = 300f; [Header("音效")] public AudioSource fanAudioSource; [Header("输入开关(AR15 FlipSight)")] public AR15HandleSightFlipper flipper; [Header("电力系统")] public FNAFPowerManager powerManager; private bool fanEnabled = true; private void Update() { //IL_009a: 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_00af: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)flipper != (Object)null) { fanEnabled = flipper.m_isLargeAperture; } if ((Object)(object)powerManager != (Object)null && powerManager.IsPowerOut()) { if ((Object)(object)fanAudioSource != (Object)null && fanAudioSource.isPlaying) { fanAudioSource.Stop(); } } else if (fanEnabled) { if ((Object)(object)rotatePart != (Object)null) { rotatePart.Rotate(rotationAxis * rotationSpeed * Time.deltaTime); } if ((Object)(object)fanAudioSource != (Object)null && !fanAudioSource.isPlaying) { fanAudioSource.Play(); } } else if ((Object)(object)fanAudioSource != (Object)null && fanAudioSource.isPlaying) { fanAudioSource.Stop(); } } public bool IsConsumingPower() { return fanEnabled; } public float GetPowerDrainRate() { return 0.2f; } } public class FNAFDoor : MonoBehaviour, IFNAFPowerConsumer { public enum DoorState { Open, Closed } [Serializable] public class DoorAnimatedPart { public Transform target; public GameObject startPrefab; public GameObject endPrefab; public float delay = 0f; public float duration = 1f; [HideInInspector] public Vector3 startPos; [HideInInspector] public Vector3 endPos; [HideInInspector] public Quaternion startRot; [HideInInspector] public Quaternion endRot; [HideInInspector] public Vector3 startScale; [HideInInspector] public Vector3 endScale; [HideInInspector] public Coroutine runningCoroutine; } [Header("动画物体列表")] public List doorParts = new List(); [Header("耗电设置")] public float powerDrainRate = 1f; [Header("门灯光提示")] public List doorLights = new List(); public Color lightOpenColor = Color.green; public Color lightClosedColor = Color.red; [Header("门音效")] public AudioSource audioSource; public AudioClip openSound; public AudioClip closeSound; [Header("当前门状态(Output)")] public DoorState currentState = DoorState.Open; [Header("引用")] public FNAFPowerManager powerManager; public Action OnDoorClosedEvent; public Action OnDoorOpenedEvent; private bool lastPowerOut = false; private bool fakePowerOut = false; public void ForceDoorBroken() { fakePowerOut = true; OpenDoor(); } private void Start() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_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) foreach (DoorAnimatedPart doorPart in doorParts) { if (!((Object)(object)doorPart.target == (Object)null) && !((Object)(object)doorPart.startPrefab == (Object)null) && !((Object)(object)doorPart.endPrefab == (Object)null)) { doorPart.startPos = doorPart.startPrefab.transform.localPosition; doorPart.startRot = doorPart.startPrefab.transform.localRotation; doorPart.startScale = doorPart.startPrefab.transform.localScale; doorPart.endPos = doorPart.endPrefab.transform.localPosition; doorPart.endRot = doorPart.endPrefab.transform.localRotation; doorPart.endScale = doorPart.endPrefab.transform.localScale; } } UpdateLights(); } private void Update() { bool flag = (Object)(object)powerManager != (Object)null && powerManager.IsPowerOut(); if (flag && !lastPowerOut && currentState == DoorState.Closed && (Object)(object)audioSource != (Object)null && (Object)(object)openSound != (Object)null) { audioSource.PlayOneShot(openSound); } if ((flag || fakePowerOut) && currentState != 0) { OpenDoor(); } lastPowerOut = flag; } public void TryCloseDoor() { if (!fakePowerOut && (!((Object)(object)powerManager != (Object)null) || !powerManager.IsPowerOut())) { CloseDoor(); } } public void TryOpenDoor() { OpenDoor(); } public void OpenDoor() { currentState = DoorState.Open; UpdateLights(); PlaySound(openSound); if (OnDoorOpenedEvent != null) { OnDoorOpenedEvent(); } foreach (DoorAnimatedPart doorPart in doorParts) { if (doorPart.runningCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(doorPart.runningCoroutine); } doorPart.runningCoroutine = ((MonoBehaviour)this).StartCoroutine(AnimatePart(doorPart, closing: false)); } } public void CloseDoor() { currentState = DoorState.Closed; UpdateLights(); PlaySound(closeSound); if (OnDoorClosedEvent != null) { OnDoorClosedEvent(); } foreach (DoorAnimatedPart doorPart in doorParts) { if (doorPart.runningCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(doorPart.runningCoroutine); } doorPart.runningCoroutine = ((MonoBehaviour)this).StartCoroutine(AnimatePart(doorPart, closing: true)); } } private IEnumerator AnimatePart(DoorAnimatedPart part, bool closing) { if (part.delay > 0f) { yield return (object)new WaitForSeconds(part.delay); } Vector3 startPos = part.target.localPosition; Quaternion startRot = part.target.localRotation; Vector3 startScale = part.target.localScale; Vector3 targetPos = ((!closing) ? part.startPos : part.endPos); Quaternion targetRot = ((!closing) ? part.startRot : part.endRot); Vector3 targetScale = ((!closing) ? part.startScale : part.endScale); float t = 0f; while (t < part.duration) { float lerp = t / part.duration; part.target.localPosition = Vector3.Lerp(startPos, targetPos, lerp); part.target.localRotation = Quaternion.Lerp(startRot, targetRot, lerp); part.target.localScale = Vector3.Lerp(startScale, targetScale, lerp); t += Time.deltaTime; yield return null; } part.target.localPosition = targetPos; part.target.localRotation = targetRot; part.target.localScale = targetScale; } private void UpdateLights() { //IL_0046: 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) foreach (Light doorLight in doorLights) { if (!((Object)(object)doorLight == (Object)null)) { doorLight.color = ((currentState != DoorState.Closed) ? lightOpenColor : lightClosedColor); } } } private void PlaySound(AudioClip clip) { if ((!((Object)(object)powerManager != (Object)null) || !powerManager.IsPowerOut()) && (Object)(object)audioSource != (Object)null && (Object)(object)clip != (Object)null) { audioSource.PlayOneShot(clip); } } public bool IsConsumingPower() { return currentState == DoorState.Closed; } public float GetPowerDrainRate() { return powerDrainRate; } public bool IsDoorClosed() { return currentState == DoorState.Closed; } } public enum SwitchInitialState { Off, On } public class FNAFDoorSwitch : MonoBehaviour { [Header("门本体引用")] public FNAFDoor door; [Header("开关动画")] public Transform switchHandle; public GameObject handleStartPrefab; public GameObject handleEndPrefab; public float animDuration = 0.2f; [Header("开关音效")] public AudioSource switchAudioSource; public AudioClip switchToggleSound; public AudioClip switchOpenSound; public AudioClip switchCloseSound; private Vector3 startPos; private Vector3 endPos; private Quaternion startRot; private Quaternion endRot; private Coroutine animCoroutine; private AR15HandleSightFlipper flipper; private bool switchDown = false; [Header("初始开关状态(Play 前设置)")] public SwitchInitialState initialState = SwitchInitialState.Off; [Header("Debug 控制")] public bool debugForceOpen = false; public bool debugForceClose = false; public bool debugToggleSwitch = false; [Header("Debug:直接控制开关状态(On=关门 / Off=开门)")] [SerializeField] private bool debugSwitchState = false; private bool lastDebugSwitchState = false; private void PlayToggleSound() { if ((Object)(object)switchAudioSource != (Object)null && (Object)(object)switchToggleSound != (Object)null) { switchAudioSource.PlayOneShot(switchToggleSound); } } private void PlayOpenSound() { if ((Object)(object)switchAudioSource != (Object)null && (Object)(object)switchOpenSound != (Object)null) { switchAudioSource.PlayOneShot(switchOpenSound); } } private void PlayCloseSound() { if ((Object)(object)switchAudioSource != (Object)null && (Object)(object)switchCloseSound != (Object)null) { switchAudioSource.PlayOneShot(switchCloseSound); } } private void Start() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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) flipper = ((Component)this).GetComponent(); switchDown = initialState == SwitchInitialState.On; debugSwitchState = switchDown; lastDebugSwitchState = debugSwitchState; if ((Object)(object)switchHandle != (Object)null && (Object)(object)handleStartPrefab != (Object)null && (Object)(object)handleEndPrefab != (Object)null) { startPos = handleStartPrefab.transform.localPosition; startRot = handleStartPrefab.transform.localRotation; endPos = handleEndPrefab.transform.localPosition; endRot = handleEndPrefab.transform.localRotation; if (switchDown) { switchHandle.localPosition = endPos; switchHandle.localRotation = endRot; } else { switchHandle.localPosition = startPos; switchHandle.localRotation = startRot; } } if ((Object)(object)flipper != (Object)null) { flipper.m_isLargeAperture = switchDown; } } private void Update() { if (debugSwitchState != lastDebugSwitchState) { lastDebugSwitchState = debugSwitchState; switchDown = debugSwitchState; PlaySwitchAnimation(switchDown); PlayToggleSound(); if (switchDown) { PlayCloseSound(); door.TryCloseDoor(); } else { PlayOpenSound(); door.TryOpenDoor(); } } if (debugForceOpen) { debugForceOpen = false; switchDown = false; debugSwitchState = false; PlaySwitchAnimation(down: false); PlayToggleSound(); PlayOpenSound(); door.TryOpenDoor(); } if (debugForceClose) { debugForceClose = false; switchDown = true; debugSwitchState = true; PlaySwitchAnimation(down: true); PlayToggleSound(); PlayCloseSound(); door.TryCloseDoor(); } if (debugToggleSwitch) { debugToggleSwitch = false; if ((Object)(object)flipper != (Object)null) { flipper.m_isLargeAperture = !flipper.m_isLargeAperture; } PlayToggleSound(); } if ((Object)(object)flipper != (Object)null && flipper.m_isLargeAperture != switchDown) { switchDown = !switchDown; debugSwitchState = switchDown; PlaySwitchAnimation(switchDown); PlayToggleSound(); if (switchDown) { PlayCloseSound(); door.TryCloseDoor(); } else { PlayOpenSound(); door.TryOpenDoor(); } } } private void PlaySwitchAnimation(bool down) { if (animCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(animCoroutine); } animCoroutine = ((MonoBehaviour)this).StartCoroutine(AnimateSwitch(down)); } private IEnumerator AnimateSwitch(bool down) { if (!((Object)(object)switchHandle == (Object)null)) { Vector3 fromPos = switchHandle.localPosition; Quaternion fromRot = switchHandle.localRotation; Vector3 toPos = ((!down) ? startPos : endPos); Quaternion toRot = ((!down) ? startRot : endRot); float t = 0f; while (t < animDuration) { float lerp = t / animDuration; switchHandle.localPosition = Vector3.Lerp(fromPos, toPos, lerp); switchHandle.localRotation = Quaternion.Lerp(fromRot, toRot, lerp); t += Time.deltaTime; yield return null; } switchHandle.localPosition = toPos; switchHandle.localRotation = toRot; } } } public class FNAFLightSwitch : MonoBehaviour, IFNAFPowerConsumer { [Header("灯光 Prefab(初始应为关闭状态)")] public GameObject lightObject; public AudioSource audioSource; public AudioClip lightOnSound; public AudioClip lightOffSound; [Header("AR15HandleSightFlipper 作为开关")] public AR15HandleSightFlipper flipSwitch; [Header("电量系统")] public float powerDrainPerSecond = 0.5f; [SerializeField] public bool isOn = false; [Header("闪烁效果 Flickering")] [Range(0f, 1f)] public float flickerChance = 0.05f; public float flickerCooldown = 0.05f; private float flickerTimer = 0f; [Header("初始灯光状态")] public bool startOn = false; [Header("Debug 控制")] public bool debugForceOn = false; public bool debugForceOff = false; [SerializeField] private bool powerOut = false; private bool lastFlipState = false; private FNAFPowerManager pm; private void Start() { pm = Object.FindObjectOfType(); if ((Object)(object)pm == (Object)null) { Debug.LogError((object)"[FNAFLightSwitch] 找不到 FNAFPowerManager,灯光无法正常工作!"); } if (startOn) { TurnOn(); } else { TurnOff(); } if ((Object)(object)flipSwitch != (Object)null) { lastFlipState = flipSwitch.m_isLargeAperture; } } private void Update() { if ((Object)(object)pm == (Object)null) { return; } if (debugForceOn) { debugForceOn = false; TurnOn(); } if (debugForceOff) { debugForceOff = false; TurnOff(); } if (!powerOut && pm.IsPowerOut()) { TriggerPowerOut(); } if (powerOut) { return; } if ((Object)(object)flipSwitch != (Object)null && flipSwitch.m_isLargeAperture != lastFlipState) { lastFlipState = flipSwitch.m_isLargeAperture; if (isOn) { TurnOff(); } else { TurnOn(); } } if (!isOn) { return; } flickerTimer += Time.deltaTime; if (flickerTimer >= flickerCooldown) { flickerTimer = 0f; if (Random.value < flickerChance) { ((MonoBehaviour)this).StartCoroutine(FlickerOnce()); } } } private void TriggerPowerOut() { powerOut = true; isOn = false; if ((Object)(object)lightObject != (Object)null) { lightObject.SetActive(false); } if ((Object)(object)audioSource != (Object)null && (Object)(object)lightOffSound != (Object)null) { audioSource.PlayOneShot(lightOffSound); } if ((Object)(object)flipSwitch != (Object)null) { ((Behaviour)flipSwitch).enabled = false; } } private void TurnOn() { if (!powerOut) { isOn = true; if ((Object)(object)lightObject != (Object)null) { lightObject.SetActive(true); } if ((Object)(object)audioSource != (Object)null && (Object)(object)lightOnSound != (Object)null) { audioSource.PlayOneShot(lightOnSound); } } } private void TurnOff() { isOn = false; if ((Object)(object)lightObject != (Object)null) { lightObject.SetActive(false); } if ((Object)(object)audioSource != (Object)null && (Object)(object)lightOffSound != (Object)null) { audioSource.PlayOneShot(lightOffSound); } } private IEnumerator FlickerOnce() { if (!powerOut && !((Object)(object)lightObject == (Object)null)) { lightObject.SetActive(false); yield return (object)new WaitForSeconds(Random.Range(0.02f, 0.08f)); if (isOn && !powerOut) { lightObject.SetActive(true); } } } public bool IsConsumingPower() { return isOn && !powerOut; } public float GetPowerDrainRate() { return powerDrainPerSecond; } } public class FNAFNightClock : MonoBehaviour { [Header("夜班时间设置")] public int startHour = 12; public int endHour = 6; public float realSecondsPerHour = 60f; [Header("当前游戏时间(只读)")] public int currentHour = 12; public float hourTimer = 0f; [Header("事件")] public Action OnHourChanged; public Action OnNightCompleted; [Header("6AM 时要开启的隐藏 Prefabs")] public GameObject[] prefabsToEnableAtEnd; [Header("6AM 时要关闭的 Prefabs")] public GameObject[] prefabsToDisableAtEnd; private bool clockRunning = false; public bool IsRunning() { return clockRunning; } private void Start() { currentHour = startHour; hourTimer = 0f; clockRunning = false; } private void Update() { if (clockRunning) { hourTimer += Time.deltaTime; if (hourTimer >= realSecondsPerHour) { hourTimer = 0f; AdvanceHour(); } } } private void AdvanceHour() { currentHour++; if (currentHour > 12 && currentHour < 100) { currentHour -= 12; } if (OnHourChanged != null) { OnHourChanged(currentHour); } if (currentHour != endHour) { return; } if (OnNightCompleted != null) { OnNightCompleted(); } clockRunning = false; StopAllAI(); GameObject[] array = prefabsToEnableAtEnd; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { val.SetActive(true); } } GameObject[] array2 = prefabsToDisableAtEnd; foreach (GameObject val2 in array2) { if ((Object)(object)val2 != (Object)null) { val2.SetActive(false); } } Debug.Log((object)"[FNAFNightClock] 6AM 到达,开启隐藏 Prefabs 并关闭指定 Prefabs!"); } public void StartClock() { clockRunning = true; } public void PauseClock() { clockRunning = false; FNAFAnimatronicAI[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { array[i].DeactivateAI(); } } public void ResetClock() { currentHour = startHour; hourTimer = 0f; clockRunning = false; StopAllAI(); } private void StopAllAI() { FNAFAnimatronicAI[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { array[i].DeactivateAI(); } } } public class FNAFPowerManager : MonoBehaviour { [Header("电量设置")] public float maxPower = 100f; public float currentPower = 100f; [Header("电量动画")] public Transform powerBarTarget; public GameObject powerStartPrefab; public GameObject powerEndPrefab; private Vector3 startPos; private Vector3 endPos; private Vector3 startScale; private Vector3 endScale; [Header("耗电设备列表(添加脚本而不是空GameObject)")] public List powerConsumers = new List(); private List consumerInterfaces = new List(); [Header("每个设备的耗电占比(和 powerConsumers 一一对应)")] public List consumerWeights = new List(); [Header("Debug控制")] public bool debugForceFullPower = false; public bool debugForceZeroPower = false; [SerializeField] private bool isPowerOut = false; public Action OnPowerDepleted; [Header("停电后启用的 Prefab 列表")] public GameObject[] enableOnBlackout; [Header("停电后禁用的 Prefab 列表")] public GameObject[] disableOnBlackout; [Header("停电音效")] public AudioClip blackoutSound; public AudioSource blackoutAudioSource; private bool blackoutTriggered = false; [Header("夜晚绑定")] public FNAFNightClock nightClock; [Header("用电指示器")] public Transform usageBarTarget; public GameObject usageStartPrefab; public GameObject usageEndPrefab; private Vector3 usageStartPos; private Vector3 usageEndPos; private Vector3 usageStartScale; private Vector3 usageEndScale; private void Start() { //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_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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)powerStartPrefab != (Object)null) { startPos = powerStartPrefab.transform.localPosition; startScale = powerStartPrefab.transform.localScale; } if ((Object)(object)powerEndPrefab != (Object)null) { endPos = powerEndPrefab.transform.localPosition; endScale = powerEndPrefab.transform.localScale; } if ((Object)(object)usageStartPrefab != (Object)null) { usageStartPos = usageStartPrefab.transform.localPosition; usageStartScale = usageStartPrefab.transform.localScale; } if ((Object)(object)usageEndPrefab != (Object)null) { usageEndPos = usageEndPrefab.transform.localPosition; usageEndScale = usageEndPrefab.transform.localScale; } foreach (MonoBehaviour powerConsumer in powerConsumers) { if (powerConsumer is IFNAFPowerConsumer item) { consumerInterfaces.Add(item); } else { Debug.LogWarning((object)("[PowerManager] 你添加的对象没有实现 IFNAFPowerConsumer: " + ((Object)powerConsumer).name)); } } OnPowerDepleted = (Action)Delegate.Combine(OnPowerDepleted, new Action(HandleBlackout)); } private void Update() { if ((Object)(object)nightClock != (Object)null && !nightClock.IsRunning()) { return; } if (debugForceFullPower) { debugForceFullPower = false; currentPower = maxPower; isPowerOut = false; blackoutTriggered = false; UpdatePowerBar(); UpdateUsageBar(0f); return; } if (debugForceZeroPower) { debugForceZeroPower = false; currentPower = 0f; isPowerOut = true; UpdatePowerBar(); UpdateUsageBar(1f); if (OnPowerDepleted != null) { OnPowerDepleted(); } return; } float num = 0f; foreach (IFNAFPowerConsumer consumerInterface in consumerInterfaces) { if (consumerInterface.IsConsumingPower()) { num += consumerInterface.GetPowerDrainRate() * Time.deltaTime; } } currentPower -= num; currentPower = Mathf.Clamp(currentPower, 0f, maxPower); UpdatePowerBar(); float num2 = 0f; for (int i = 0; i < consumerInterfaces.Count; i++) { if (consumerInterfaces[i].IsConsumingPower()) { float num3 = ((i >= consumerWeights.Count) ? 10f : consumerWeights[i]); num2 += num3; } } num2 = Mathf.Clamp(num2, 0f, 100f); UpdateUsageBar(num2 / 100f); if (currentPower <= 0f && !isPowerOut) { isPowerOut = true; if (OnPowerDepleted != null) { OnPowerDepleted(); } } else if (currentPower > 0f) { isPowerOut = false; } } private void UpdatePowerBar() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)powerBarTarget == (Object)null)) { float num = currentPower / maxPower; powerBarTarget.localPosition = Vector3.Lerp(endPos, startPos, num); powerBarTarget.localScale = Vector3.Lerp(endScale, startScale, num); } } private void UpdateUsageBar(float percent) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)usageBarTarget == (Object)null)) { usageBarTarget.localPosition = Vector3.Lerp(usageEndPos, usageStartPos, percent); usageBarTarget.localScale = Vector3.Lerp(usageEndScale, usageStartScale, percent); } } public bool IsPowerOut() { return isPowerOut; } private void HandleBlackout() { if (blackoutTriggered) { return; } blackoutTriggered = true; GameObject[] array = enableOnBlackout; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { val.SetActive(true); } } GameObject[] array2 = disableOnBlackout; foreach (GameObject val2 in array2) { if ((Object)(object)val2 != (Object)null) { val2.SetActive(false); } } if ((Object)(object)blackoutAudioSource != (Object)null && (Object)(object)blackoutSound != (Object)null) { blackoutAudioSource.PlayOneShot(blackoutSound); } Debug.Log((object)"[PowerManager] 停电触发:启用 enableOnBlackout + 禁用 disableOnBlackout + 播放音效"); } } [Serializable] public class NextPointData { public FNAFWaypoint nextPoint; public int chance = 100; } public class FNAFWaypoint : MonoBehaviour { [HideInInspector] public int index; [Header("可以前往的路径点(含概率)")] public NextPointData[] nextPoints; [Header("是否为门前节点")] public bool isDoorNode = false; public GameObject doorToCheck; public bool breakDoor = false; public FNAFWaypoint[] failReturnPoints; [Header("是否为攻击节点")] public bool isAttackNode = false; public GameObject attackPrefabToEnable; [Header("到达此路径点时的音效(纯随机播放一个)")] public AudioClip[] randomSounds; [Header("强制移动设置")] public bool forceMove = false; public float forceMoveDelay = 2f; private bool hasStartedForceMove = false; public GameObject Pose => ((Component)this).gameObject; public void TryPlaySound() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (randomSounds != null && randomSounds.Length != 0) { int num = Random.Range(0, randomSounds.Length); AudioClip val = randomSounds[num]; if ((Object)(object)val != (Object)null) { AudioSource.PlayClipAtPoint(val, ((Component)this).transform.position); Debug.Log((object)("[FNAFWaypoint] 路径点 " + index + " 随机播放音效: " + ((Object)val).name)); } } } public void TriggerAttack() { if (isAttackNode) { if ((Object)(object)attackPrefabToEnable != (Object)null) { attackPrefabToEnable.SetActive(true); Debug.Log((object)("[FNAFWaypoint] 攻击节点触发,已启用死亡 Prefab: " + ((Object)attackPrefabToEnable).name)); } else { Debug.LogWarning((object)"[FNAFWaypoint] 攻击节点没有绑定 attackPrefabToEnable!"); } } } public void StartForceMove() { if (forceMove && !hasStartedForceMove) { hasStartedForceMove = true; ((MonoBehaviour)this).Invoke("DoForceMove", forceMoveDelay); Debug.Log((object)("[FNAFWaypoint] 节点 " + index + " 已启动强制移动计时器," + forceMoveDelay + " 秒后进入下一个节点")); } } private void DoForceMove() { if (nextPoints == null || nextPoints.Length <= 0) { return; } int num = 0; NextPointData[] array = nextPoints; foreach (NextPointData nextPointData in array) { num += nextPointData.chance; } int num2 = Random.Range(0, num); FNAFWaypoint fNAFWaypoint = null; int num3 = 0; NextPointData[] array2 = nextPoints; foreach (NextPointData nextPointData2 in array2) { num3 += nextPointData2.chance; if (num2 < num3) { fNAFWaypoint = nextPointData2.nextPoint; break; } } if (!((Object)(object)fNAFWaypoint != (Object)null)) { return; } Debug.Log((object)("[FNAFWaypoint] 节点 " + index + " 强制移动 → 下一个节点 " + fNAFWaypoint.index)); if (fNAFWaypoint.isDoorNode && (Object)(object)fNAFWaypoint.doorToCheck != (Object)null) { FNAFDoor component = fNAFWaypoint.doorToCheck.GetComponent(); if (fNAFWaypoint.breakDoor && (Object)(object)component != (Object)null) { component.ForceDoorBroken(); Debug.Log((object)("[FNAFWaypoint] 强制移动时破坏门: " + fNAFWaypoint.index)); } if ((Object)(object)component != (Object)null && component.currentState == FNAFDoor.DoorState.Closed) { Debug.Log((object)"[FNAFWaypoint] 强制移动失败,门关闭 → 回退"); if (fNAFWaypoint.failReturnPoints != null && fNAFWaypoint.failReturnPoints.Length > 0) { int num4 = Random.Range(0, fNAFWaypoint.failReturnPoints.Length); fNAFWaypoint = fNAFWaypoint.failReturnPoints[num4]; } else { fNAFWaypoint = this; } } } FNAFAnimatronicAI componentInParent = ((Component)this).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { componentInParent.ForceMoveTo(fNAFWaypoint.index); } } } [RequireComponent(typeof(CharacterController))] public class FlatDebugController : MonoBehaviour { [Header("移动设置")] public float moveSpeed = 5f; public float lookSpeed = 2f; [Header("自定义交互球体")] public SphereCollider interactSphere; public LayerMask interactLayer; [Header("调试输入模拟")] public KeyCode triggerKey = (KeyCode)323; [Header("重力设置")] public float gravity = -9.81f; public float jumpHeight = 1.5f; private float pitch = 0f; private float verticalVelocity = 0f; private CharacterController controller; public Transform cameraPivot; private Camera cam; private void Start() { controller = ((Component)this).GetComponent(); cam = Camera.main; Cursor.lockState = (CursorLockMode)1; } private void Update() { HandleMovement(); HandleMouseLook(); HandleTrigger(); } private void HandleMovement() { //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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) float axis = Input.GetAxis("Horizontal"); float axis2 = Input.GetAxis("Vertical"); Vector3 val = ((Component)this).transform.right * axis + ((Component)this).transform.forward * axis2; if (controller.isGrounded) { verticalVelocity = -1f; if (Input.GetButtonDown("Jump")) { verticalVelocity = Mathf.Sqrt(jumpHeight * -2f * gravity); } } else { verticalVelocity += gravity * Time.deltaTime; } val.y = verticalVelocity; controller.Move(val * moveSpeed * Time.deltaTime); } private void HandleMouseLook() { //IL_002b: 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_007a: Unknown result type (might be due to invalid IL or missing references) float num = Input.GetAxis("Mouse X") * lookSpeed; float num2 = Input.GetAxis("Mouse Y") * lookSpeed; ((Component)this).transform.Rotate(Vector3.up * num); pitch -= num2; pitch = Mathf.Clamp(pitch, -80f, 80f); cameraPivot.localRotation = Quaternion.Euler(pitch, 0f, 0f); } private void HandleTrigger() { //IL_0002: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (!Input.GetKeyDown(triggerKey) || !((Object)(object)interactSphere != (Object)null)) { return; } Vector3 position = ((Component)interactSphere).transform.position; float num = interactSphere.radius * ((Component)interactSphere).transform.localScale.x; Collider[] array = Physics.OverlapSphere(position, num, LayerMask.op_Implicit(interactLayer)); Collider[] array2 = array; foreach (Collider val in array2) { AR15HandleSightFlipper component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { component.m_isLargeAperture = !component.m_isLargeAperture; Debug.Log((object)("[FlatDebugController] 模拟触发 AR15HandleSightFlipper → " + component.m_isLargeAperture)); } } } private void OnDrawGizmosSelected() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0053: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)interactSphere != (Object)null) { Gizmos.color = Color.green; Vector3 position = ((Component)interactSphere).transform.position; float num = interactSphere.radius * ((Component)interactSphere).transform.localScale.x; Gizmos.DrawWireSphere(position, num); } } } public interface IFNAFPowerConsumer { bool IsConsumingPower(); float GetPowerDrainRate(); } public class MenuButton : MonoBehaviour { [Header("监听输入:AR15HandleSightFlipper")] public AR15HandleSightFlipper flipSwitch; [Header("要关闭的 Prefabs")] public GameObject[] prefabsToDisable; [Header("要开启的 Prefabs")] public GameObject[] prefabsToEnable; [Header("音效")] public AudioSource audioSource; public AudioClip triggerSound; [Header("Debug 控制")] public bool debugTrigger = false; private bool lastFlipState; private void Start() { if ((Object)(object)flipSwitch != (Object)null) { lastFlipState = flipSwitch.m_isLargeAperture; } } private void Update() { if (debugTrigger) { debugTrigger = false; TriggerAction(); } if (!((Object)(object)flipSwitch == (Object)null) && flipSwitch.m_isLargeAperture != lastFlipState) { lastFlipState = flipSwitch.m_isLargeAperture; TriggerAction(); } } public void TriggerAction() { if (prefabsToDisable != null) { GameObject[] array = prefabsToDisable; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { val.SetActive(false); } } } if (prefabsToEnable != null) { GameObject[] array2 = prefabsToEnable; foreach (GameObject val2 in array2) { if ((Object)(object)val2 != (Object)null) { val2.SetActive(true); } } } if ((Object)(object)audioSource != (Object)null && (Object)(object)triggerSound != (Object)null) { audioSource.PlayOneShot(triggerSound); } Debug.Log((object)"[MenuButton] Button Triggered"); } } public class NightStartOnAwake : MonoBehaviour { [Header("夜晚时钟")] public FNAFNightClock nightClock; [Header("要激活的玩具 Prefabs(默认隐藏)")] public GameObject[] toyPrefabsToEnable; [Header("要关闭的 Prop Prefabs(可选)")] public GameObject[] propPrefabsToDisable; [Header("夜晚开始时要启用的 AI 脚本")] public FNAFAnimatronicAI[] aiScriptsToEnable; [Header("夜晚开始时要关闭的 AI 脚本")] public FNAFAnimatronicAI[] aiScriptsToDisable; private void Awake() { if ((Object)(object)nightClock != (Object)null) { nightClock.StartClock(); Debug.Log((object)"[NightStartOnAwake] 夜晚开始!"); } else { Debug.LogError((object)"[NightStartOnAwake] 没有绑定 NightClock!"); } GameObject[] array = toyPrefabsToEnable; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { val.SetActive(true); } } GameObject[] array2 = propPrefabsToDisable; foreach (GameObject val2 in array2) { if ((Object)(object)val2 != (Object)null) { val2.SetActive(false); } } FNAFAnimatronicAI[] array3 = aiScriptsToEnable; foreach (FNAFAnimatronicAI fNAFAnimatronicAI in array3) { if ((Object)(object)fNAFAnimatronicAI != (Object)null) { ((Behaviour)fNAFAnimatronicAI).enabled = true; Debug.Log((object)("[NightStartOnAwake] 启用 AI 脚本: " + ((Object)fNAFAnimatronicAI).name)); } } FNAFAnimatronicAI[] array4 = aiScriptsToDisable; foreach (FNAFAnimatronicAI fNAFAnimatronicAI2 in array4) { if ((Object)(object)fNAFAnimatronicAI2 != (Object)null) { ((Behaviour)fNAFAnimatronicAI2).enabled = false; Debug.Log((object)("[NightStartOnAwake] 关闭 AI 脚本: " + ((Object)fNAFAnimatronicAI2).name)); } } } } public class PrefabsOnOffAwake : MonoBehaviour { [Header("Awake 后延迟开启的 Prefab 列表")] public GameObject[] enablePrefabs; public float[] enableDelays; [Header("Awake 后延迟关闭的 Prefab 列表")] public GameObject[] disablePrefabs; public float[] disableDelays; private void Awake() { for (int i = 0; i < enablePrefabs.Length; i++) { float delay = ((i >= enableDelays.Length) ? 0f : enableDelays[i]); ((MonoBehaviour)this).StartCoroutine(EnableAfterDelay(enablePrefabs[i], delay)); } for (int j = 0; j < disablePrefabs.Length; j++) { float delay2 = ((j >= disableDelays.Length) ? 0f : disableDelays[j]); ((MonoBehaviour)this).StartCoroutine(DisableAfterDelay(disablePrefabs[j], delay2)); } } private IEnumerator EnableAfterDelay(GameObject obj, float delay) { if (delay > 0f) { yield return (object)new WaitForSeconds(delay); } if ((Object)(object)obj != (Object)null) { obj.SetActive(true); } } private IEnumerator DisableAfterDelay(GameObject obj, float delay) { if (delay > 0f) { yield return (object)new WaitForSeconds(delay); } if ((Object)(object)obj != (Object)null) { obj.SetActive(false); } } } public class RandomAppearance : MonoBehaviour { [Header("可随机激活的子物体列表")] public List targets = new List(); [Header("随机间隔时间范围 (秒)")] public float minInterval = 0.1f; public float maxInterval = 0.5f; [Header("是否循环随机")] public bool loop = true; private float timer = 0f; private float nextInterval = 0f; private void Start() { ScheduleNext(); DeactivateAll(); } private void Update() { if (loop) { timer += Time.deltaTime; if (timer >= nextInterval) { timer = 0f; ScheduleNext(); RandomToggle(); } } } private void ScheduleNext() { nextInterval = Random.Range(minInterval, maxInterval); } private void RandomToggle() { if (targets != null && targets.Count != 0) { DeactivateAll(); int index = Random.Range(0, targets.Count); if ((Object)(object)targets[index] != (Object)null) { targets[index].SetActive(true); } } } private void DeactivateAll() { foreach (GameObject target in targets) { if ((Object)(object)target != (Object)null) { target.SetActive(false); } } } } public class RestartSceneOnAwake : MonoBehaviour { [Header("延迟重启时间(秒)")] public float restartDelay = 0f; private void Awake() { //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) if (restartDelay <= 0f) { Scene activeScene = SceneManager.GetActiveScene(); SceneManager.LoadScene(((Scene)(ref activeScene)).name); } else { ((MonoBehaviour)this).Invoke("RestartScene", restartDelay); } } private void RestartScene() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); SceneManager.LoadScene(((Scene)(ref activeScene)).name); } } [Serializable] public class RotateTarget { [Header("要旋转的对象")] public GameObject target; [Header("旋转轴选择")] public bool rotateX = false; public bool rotateY = true; public bool rotateZ = false; [Header("起始角度")] public float startAngle = 0f; [Header("结束角度")] public float endAngle = 90f; [Header("一次从起始到结束所需秒数")] public float durationSeconds = 2f; [Header("循环模式")] public bool isLoop = true; public bool oneWay = false; [Header("循环停留时间 (秒)")] public float pauseDuration = 0f; [Header("是否等待 NightClock 激活后再开始运作")] public bool waitForNightClock = false; [HideInInspector] public float timer = 0f; [HideInInspector] public bool forward = true; [HideInInspector] public bool stopped = false; [HideInInspector] public float pauseTimer = 0f; [HideInInspector] public bool isPausing = false; } public class RotateByTime : MonoBehaviour { [Header("旋转目标列表(可添加多个 Prefab)")] public RotateTarget[] rotateTargets; private FNAFNightClock clock; private void Start() { clock = Object.FindObjectOfType(); } private void Update() { //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) RotateTarget[] array = rotateTargets; foreach (RotateTarget rotateTarget in array) { if ((Object)(object)rotateTarget.target == (Object)null || rotateTarget.stopped || (rotateTarget.waitForNightClock && ((Object)(object)clock == (Object)null || !clock.IsRunning()))) { continue; } if (rotateTarget.isPausing) { rotateTarget.pauseTimer += Time.deltaTime; if (rotateTarget.pauseTimer >= rotateTarget.pauseDuration) { rotateTarget.isPausing = false; rotateTarget.pauseTimer = 0f; rotateTarget.forward = !rotateTarget.forward; rotateTarget.timer = 0f; } continue; } rotateTarget.timer += Time.deltaTime; float num = Mathf.Clamp01(rotateTarget.timer / rotateTarget.durationSeconds); float num2 = Mathf.Lerp(rotateTarget.startAngle, rotateTarget.endAngle, (!rotateTarget.forward) ? (1f - num) : num); Vector3 localEulerAngles = rotateTarget.target.transform.localEulerAngles; if (rotateTarget.rotateX) { localEulerAngles.x = num2; } if (rotateTarget.rotateY) { localEulerAngles.y = num2; } if (rotateTarget.rotateZ) { localEulerAngles.z = num2; } rotateTarget.target.transform.localEulerAngles = localEulerAngles; if (!(rotateTarget.timer >= rotateTarget.durationSeconds)) { continue; } if (rotateTarget.isLoop) { if (rotateTarget.pauseDuration > 0f) { rotateTarget.isPausing = true; rotateTarget.pauseTimer = 0f; } else { rotateTarget.forward = !rotateTarget.forward; rotateTarget.timer = 0f; } } else if (rotateTarget.oneWay) { rotateTarget.stopped = true; } else { rotateTarget.stopped = true; } } } } } namespace theWNbotMods { 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 + " !!!")); } } } } } namespace FNAFModeScripts { public enum TabletInitialPage { Page1, Page2 } public class TabletPageSwitch : MonoBehaviour { [Header("页面引用")] public GameObject page1; public GameObject page2; [Header("初始页面")] public TabletInitialPage initialPage = TabletInitialPage.Page1; [Header("音效设置")] public AudioSource audioSource; public AudioClip[] page1ToPage2Clips; public AudioClip[] page2ToPage1Clips; [Header("Debug 控制")] public bool debugToggle = false; private AR15HandleSightFlipper flipper; private bool isPage2 = false; private void Start() { flipper = ((Component)this).GetComponent(); isPage2 = initialPage == TabletInitialPage.Page2; ApplyPageState(); if ((Object)(object)flipper != (Object)null) { flipper.m_isLargeAperture = isPage2; } } private void Update() { if (debugToggle) { debugToggle = false; TogglePage(); } if ((Object)(object)flipper != (Object)null && flipper.m_isLargeAperture != isPage2) { TogglePage(); } } private void TogglePage() { bool goingToPage = !isPage2; isPage2 = !isPage2; PlayToggleSound(goingToPage); ApplyPageState(); if ((Object)(object)flipper != (Object)null) { flipper.m_isLargeAperture = isPage2; } } private void PlayToggleSound(bool goingToPage2) { if (!((Object)(object)audioSource == (Object)null)) { AudioClip[] array = ((!goingToPage2) ? page2ToPage1Clips : page1ToPage2Clips); if (array != null && array.Length > 0) { AudioClip val = array[Random.Range(0, array.Length)]; audioSource.PlayOneShot(val); } } } private void ApplyPageState() { if ((Object)(object)page1 != (Object)null) { page1.SetActive(!isPage2); } if ((Object)(object)page2 != (Object)null) { page2.SetActive(isPage2); } } } } namespace theWNbotMods { 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.MGS3_CQC_System_Knife { [BepInPlugin("thewnbot.MGS3_CQC_System_Knife", "MGS3_CQC_System_Knife", "1.0.3")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class MGS3_CQC_System_KnifePlugin : 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.MGS3_CQC_System_Knife"); OtherLoader.RegisterDirectLoad(BasePath, "thewnbot.MGS3_CQC_System_Knife", "", "", "mgs_cqcknife", ""); } } } namespace theWNbotMods { public class SonyWalkman : FVRPhysicalObject { [Header("Audio System")] public AudioSource audioSource; public AudioClip insertSound; public AudioClip ejectSound; [Header("Tape Slot")] public Transform tapeSlot; public Transform tapeInsertPoint; private Tape insertedTape; [Header("Buttons")] public SonyWalkmanButton playButton; public SonyWalkmanButton stopButton; public SonyWalkmanButton ffButton; public SonyWalkmanButton rewButton; [Header("Button Sounds")] public AudioClip buttonClickSound; [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; private bool isLidOpen = false; private Quaternion targetRotation; 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); } } private void Update() { //IL_001f: 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_0036: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)lidTransform != (Object)null) { lidTransform.localRotation = Quaternion.Lerp(lidTransform.localRotation, targetRotation, Time.deltaTime * lidAnimSpeed); } if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null && ((FVRInteractiveObject)this).m_hand.Input.TriggerDown) { ToggleLid(); } } 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 (isLidOpen && (Object)(object)lidOpenSound != (Object)null) { audioSource.PlayOneShot(lidOpenSound); } else if (!isLidOpen && (Object)(object)lidCloseSound != (Object)null) { audioSource.PlayOneShot(lidCloseSound); } } public void InsertTape(Tape tape) { //IL_00c5: 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_0098: 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) if (!((Object)(object)tape == (Object)null) && isLidOpen) { insertedTape = tape; audioSource.clip = tape.tapeAudio; audioSource.time = tape.currentTime; Rigidbody component = ((Component)tape).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; component.detectCollisions = false; } ((Component)tape).transform.SetParent(tapeSlot); 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; } if ((Object)(object)insertSound != (Object)null) { audioSource.PlayOneShot(insertSound); } } } public void EjectTape() { if ((Object)(object)insertedTape != (Object)null && isLidOpen) { insertedTape.currentTime = audioSource.time; Rigidbody component = ((Component)insertedTape).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; component.detectCollisions = true; } ((Component)insertedTape).transform.SetParent((Transform)null); insertedTape = null; audioSource.Stop(); if ((Object)(object)ejectSound != (Object)null) { audioSource.PlayOneShot(ejectSound); } } } public void Play() { if ((Object)(object)insertedTape != (Object)null && (Object)(object)audioSource.clip != (Object)null) { audioSource.time = insertedTape.currentTime; audioSource.Play(); PlayButtonClick(); } } public void Stop() { if ((Object)(object)insertedTape != (Object)null && audioSource.isPlaying) { insertedTape.currentTime = audioSource.time; audioSource.Pause(); PlayButtonClick(); } } public void FastForward(float seconds) { if ((Object)(object)insertedTape != (Object)null && (Object)(object)audioSource.clip != (Object)null) { insertedTape.currentTime = Mathf.Min(audioSource.clip.length, audioSource.time + seconds); audioSource.time = insertedTape.currentTime; PlayButtonClick(); } } public void Rewind(float seconds) { if ((Object)(object)insertedTape != (Object)null && (Object)(object)audioSource.clip != (Object)null) { insertedTape.currentTime = Mathf.Max(0f, audioSource.time - seconds); audioSource.time = insertedTape.currentTime; PlayButtonClick(); } } public void PlayButtonClick() { if ((Object)(object)buttonClickSound != (Object)null && (Object)(object)audioSource != (Object)null) { audioSource.PlayOneShot(buttonClickSound); } } 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) { Tape component = ((Component)other).GetComponent(); if ((Object)(object)component != (Object)null && isLidOpen) { InsertTape(component); } } private void OnTriggerExit(Collider other) { Tape component = ((Component)other).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component == (Object)(object)insertedTape) { EjectTape(); } } } public class SonyWalkmanButton : MonoBehaviour { public enum ButtonType { Play, Stop, FF, REW } public ButtonType buttonType; public AR15HandleSightFlipper flipper; private bool lastState = false; public SonyWalkman walkman; [Header("Button Animation Points")] public Transform buttonUpPoint; public Transform buttonDownPoint; private void Start() { //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; } } private void Update() { //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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) if ((Object)(object)flipper == (Object)null || (Object)(object)walkman == (Object)null) { return; } if (flipper.m_isLargeAperture && !lastState) { lastState = true; switch (buttonType) { case ButtonType.Play: walkman.Play(); break; case ButtonType.Stop: walkman.Stop(); break; case ButtonType.FF: walkman.FastForward(5f); break; case ButtonType.REW: walkman.Rewind(5f); break; } if ((Object)(object)buttonDownPoint != (Object)null) { ((Component)this).transform.position = buttonDownPoint.position; ((Component)this).transform.rotation = buttonDownPoint.rotation; } walkman.ResetAllButtons(this); walkman.PlayButtonClick(); } if (!flipper.m_isLargeAperture && lastState) { lastState = false; if ((Object)(object)buttonUpPoint != (Object)null) { ((Component)this).transform.position = buttonUpPoint.position; ((Component)this).transform.rotation = buttonUpPoint.rotation; } } } public void ResetButton() { //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; [Header("Debug")] public bool debugResetTime = false; private void Update() { if (debugResetTime) { debugResetTime = false; currentTime = 0f; } } public void FastForward(float seconds) { if (!((Object)(object)tapeAudio == (Object)null)) { currentTime = Mathf.Min(tapeAudio.length, currentTime + seconds); } } public void Rewind(float seconds) { if (!((Object)(object)tapeAudio == (Object)null)) { currentTime = Mathf.Max(0f, currentTime - seconds); } } public void ResetTape() { currentTime = 0f; } public float GetProgress() { if ((Object)(object)tapeAudio == (Object)null) { return 0f; } return currentTime / tapeAudio.length; } public void AttachToSlot(Transform slot) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.SetParent(slot); ((Component)this).transform.localPosition = Vector3.zero; ((Component)this).transform.localRotation = Quaternion.identity; isInserted = true; } public void DetachFromSlot() { ((Component)this).transform.SetParent((Transform)null); isInserted = false; } } }