Decompiled source of Bowling v1.1.1
Omni.dll
Decompiled 5 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Omni")] [assembly: AssemblyTitle("Omni")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class VHSShaderOnItemGrab : MonoBehaviour { [Header("VHS Shader")] public MonoBehaviour vhsShaderPrefab; private bool effectApplied = false; private PhysGrabObject physGrabObject; private void Start() { physGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); } private void Update() { if (effectApplied || (Object)(object)physGrabObject == (Object)null || !physGrabObject.grabbed) { return; } foreach (PhysGrabber item in physGrabObject.playerGrabbing) { if ((Object)(object)item?.playerAvatar != (Object)null) { AttachVHSShader(item.playerAvatar); } } effectApplied = true; } private void AttachVHSShader(PlayerAvatar player) { CharacterController componentInChildren = ((Component)player).GetComponentInChildren<CharacterController>(true); if ((Object)(object)componentInChildren == (Object)null) { Debug.LogWarning((object)"Character Controller not found under player."); return; } Transform val = ((Component)componentInChildren).transform.Find("Top Camera"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"Top Camera not found."); } else if ((Object)(object)((Component)val).GetComponent(((object)vhsShaderPrefab).GetType()) == (Object)null) { ((Component)val).gameObject.AddComponent(((object)vhsShaderPrefab).GetType()); Debug.Log((object)"VHS Shader attached to Top Camera."); } } } [RequireComponent(typeof(Renderer))] public class AudioReactiveMaterial : MonoBehaviour { [Header("Audio Settings")] public AudioSource audioSource; public float sensitivity = 15f; [Header("Materials")] public Material idleMaterial; public Material activeMaterial; private Renderer rend; private float[] samples = new float[64]; private void Start() { rend = ((Component)this).GetComponent<Renderer>(); if ((Object)(object)idleMaterial != (Object)null) { rend.material = idleMaterial; } } private void Update() { float audioVolume = GetAudioVolume(); float num = Mathf.Clamp01(audioVolume * sensitivity); if (num > 0.1f) { if ((Object)(object)activeMaterial != (Object)null) { rend.material = activeMaterial; } } else if ((Object)(object)idleMaterial != (Object)null) { rend.material = idleMaterial; } } private float GetAudioVolume() { if ((Object)(object)audioSource == (Object)null) { return 0f; } audioSource.GetOutputData(samples, 0); float num = 0f; for (int i = 0; i < samples.Length; i++) { num += Mathf.Abs(samples[i]); } return num / (float)samples.Length; } } public class OmniscyeBowlingGameManager : MonoBehaviourPun { [CompilerGenerated] private sealed class <ResetBallAfterDelay>d__36 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public OmniscyeBowlingGameManager <>4__this; private int <finalScore>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ResetBallAfterDelay>d__36(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.isResetting = true; <finalScore>5__1 = <>4__this.pinsKnockedOver; Debug.Log((object)$"[Omniscye Bowling] Captured final score: {<finalScore>5__1}"); <>2__current = (object)new WaitForSeconds(<>4__this.resetDelay); <>1__state = 1; return true; case 1: <>1__state = -1; if (PhotonNetwork.OfflineMode) { <>4__this.ResetBallRPC(<finalScore>5__1); } else { ((MonoBehaviourPun)<>4__this).photonView.RPC("ResetBallRPC", (RpcTarget)3, new object[1] { <finalScore>5__1 }); } <>4__this.isResetting = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ThrowTimeoutCheck>d__32 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public OmniscyeBowlingGameManager <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ThrowTimeoutCheck>d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(<>4__this.maxThrowTime); <>1__state = 1; return true; case 1: <>1__state = -1; if (<>4__this.throwActive) { Debug.Log((object)"[Omniscye Bowling] Throw timed out - auto finishing"); <>4__this.FinishThrow(); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Header("Omniscye Pins")] public GameObject[] pins; [Header("Omniscye Score Display")] public TextMeshProUGUI scoreText; public TextMeshProUGUI[] frameScoreTexts = (TextMeshProUGUI[])(object)new TextMeshProUGUI[10]; [Header("Pin Detection Settings")] public float tippedAngleThreshold = 30f; [Header("Ball Reset Settings")] public Rigidbody ballRb; public Transform resetPosition; public Transform stopPoint; public Transform pinZoneStart; public Transform throwStart; public float resetDelay = 3f; public float maxThrowTime = 10f; public float ballStoppedThreshold = 0.05f; [Header("Death Mechanic")] public int deathScoreThreshold = 50; public HurtCollider playerKillCollider; [Header("Reward")] public GameObject rewardPrefab; public Transform rewardSpawnPoint; private bool isResetting = false; private bool ballInPinZone = false; private bool throwActive = false; private float ballStoppedTime = 0f; private int pinsKnockedOver = 0; private int throwCount = 0; private int currentFrame = 0; private List<int> throws = new List<int>(); private Coroutine throwTimeoutCoroutine; private Dictionary<GameObject, Vector3> originalUpDirections = new Dictionary<GameObject, Vector3>(); private Dictionary<GameObject, Vector3> originalPositions = new Dictionary<GameObject, Vector3>(); private Dictionary<GameObject, Quaternion> originalRotations = new Dictionary<GameObject, Quaternion>(); private void Start() { //IL_003f: 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_006f: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsConnected) { PhotonNetwork.OfflineMode = true; Debug.Log((object)"[Omniscye Bowling] OfflineMode enabled."); } GameObject[] array = pins; foreach (GameObject val in array) { originalUpDirections[val] = val.transform.up; originalPositions[val] = val.transform.position; originalRotations[val] = val.transform.rotation; } ((TMP_Text)scoreText).text = "Pins Knocked Over: 0"; for (int j = 0; j < frameScoreTexts.Length; j++) { if ((Object)(object)frameScoreTexts[j] != (Object)null) { ((TMP_Text)frameScoreTexts[j]).text = $"Frame {j + 1}: "; } } } private void Update() { if ((PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode) && !isResetting) { CheckBallPosition(); if (throwActive && ballInPinZone) { TrackPins(); } if (throwActive) { CheckIfBallStopped(); } } } private void CheckIfBallStopped() { //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) Vector3 velocity = ballRb.velocity; float magnitude = ((Vector3)(ref velocity)).magnitude; if (magnitude < ballStoppedThreshold) { ballStoppedTime += Time.deltaTime; if (ballStoppedTime >= 2f) { Debug.Log((object)"[Omniscye Bowling] Ball stopped moving - finishing throw"); FinishThrow(); } } else { ballStoppedTime = 0f; } } private void CheckBallPosition() { //IL_000c: 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_002e: 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) float x = ((Component)ballRb).transform.position.x; float x2 = throwStart.position.x; float x3 = pinZoneStart.position.x; float x4 = stopPoint.position.x; if (!throwActive && x >= x2) { throwActive = true; ballStoppedTime = 0f; Debug.Log((object)"[Omniscye Bowling] Ball passed throw start - throw started"); if (throwTimeoutCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(throwTimeoutCoroutine); } throwTimeoutCoroutine = ((MonoBehaviour)this).StartCoroutine(ThrowTimeoutCheck()); } if (throwActive && !ballInPinZone && x >= x3) { ballInPinZone = true; Debug.Log((object)"[Omniscye Bowling] Ball entered pin zone"); } if (throwActive && x >= x4) { Debug.Log((object)"[Omniscye Bowling] Ball reached stop point - finishing throw"); FinishThrow(); } } [IteratorStateMachine(typeof(<ThrowTimeoutCheck>d__32))] private IEnumerator ThrowTimeoutCheck() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ThrowTimeoutCheck>d__32(0) { <>4__this = this }; } private void FinishThrow() { if (!isResetting) { throwActive = false; ballInPinZone = false; if (throwTimeoutCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(throwTimeoutCoroutine); throwTimeoutCoroutine = null; } Debug.Log((object)$"[Omniscye Bowling] Throw finished with final score: {pinsKnockedOver}"); ((MonoBehaviour)this).StartCoroutine(ResetBallAfterDelay()); } } private void TrackPins() { int num = 0; GameObject[] array = pins; foreach (GameObject val in array) { Renderer component = val.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null && component.enabled && IsPinKnockedOver(val)) { num++; } } if (num != pinsKnockedOver) { pinsKnockedOver = num; if (PhotonNetwork.OfflineMode) { UpdateScoreRPC(pinsKnockedOver); return; } ((MonoBehaviourPun)this).photonView.RPC("UpdateScoreRPC", (RpcTarget)3, new object[1] { pinsKnockedOver }); } } private bool IsPinKnockedOver(GameObject pin) { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (!originalUpDirections.ContainsKey(pin)) { return false; } Vector3 val = originalUpDirections[pin]; float num = Vector3.Angle(val, pin.transform.up); return num > tippedAngleThreshold; } [IteratorStateMachine(typeof(<ResetBallAfterDelay>d__36))] private IEnumerator ResetBallAfterDelay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ResetBallAfterDelay>d__36(0) { <>4__this = this }; } [PunRPC] private void UpdateScoreRPC(int score) { if (throwActive && ballInPinZone) { ((TMP_Text)scoreText).text = "Pins Knocked Over: " + score; } } [PunRPC] private void ResetBallRPC(int finalThrowScore) { //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) throws.Add(finalThrowScore); throwCount++; if (currentFrame < 10 && (Object)(object)frameScoreTexts[currentFrame] != (Object)null) { if (throwCount % 2 == 1) { if (finalThrowScore == 10) { ((TMP_Text)frameScoreTexts[currentFrame]).text = $"Frame {currentFrame + 1}: STRIKE (10)"; throwCount++; currentFrame++; ResetPins(); Debug.Log((object)"[Omniscye Bowling] Strike! Moving to next frame."); } else { ((TMP_Text)frameScoreTexts[currentFrame]).text = $"Frame {currentFrame + 1}: {finalThrowScore}"; HideKnockedPins(); Debug.Log((object)$"[Omniscye Bowling] First throw: {finalThrowScore} pins. Hiding knocked pins for second throw."); } } else { List<int> list = throws; int num = list[list.Count - 2]; int num2 = num + finalThrowScore; if (num2 == 10) { ((TMP_Text)frameScoreTexts[currentFrame]).text = $"Frame {currentFrame + 1}: {num} / SPARE"; Debug.Log((object)"[Omniscye Bowling] Spare achieved!"); } else { ((TMP_Text)frameScoreTexts[currentFrame]).text = $"Frame {currentFrame + 1}: {num} / {finalThrowScore}"; Debug.Log((object)$"[Omniscye Bowling] Frame complete: {num} + {finalThrowScore} = {num2}"); } ResetPins(); currentFrame++; } } if (currentFrame >= 10) { int num3 = CalculateTotalScore(); Debug.Log((object)$"[Omniscye Bowling] Game complete! Total score: {num3}"); if (num3 < deathScoreThreshold) { Debug.Log((object)$"[Omniscye Bowling] Score {num3} below threshold {deathScoreThreshold} - triggering player death!"); TriggerPlayerDeath(); } else { Debug.Log((object)$"[Omniscye Bowling] Score {num3} meets threshold - rewarding players!"); SpawnRewardPrefab(); } currentFrame = 0; throwCount = 0; throws.Clear(); for (int i = 0; i < frameScoreTexts.Length; i++) { if ((Object)(object)frameScoreTexts[i] != (Object)null) { ((TMP_Text)frameScoreTexts[i]).text = $"Frame {i + 1}: "; } } ResetPins(); } ballRb.velocity = Vector3.zero; ballRb.angularVelocity = Vector3.zero; ballRb.isKinematic = true; ((Component)ballRb).transform.position = resetPosition.position; ((Component)ballRb).transform.rotation = resetPosition.rotation; ballRb.isKinematic = false; pinsKnockedOver = 0; ((TMP_Text)scoreText).text = "Pins Knocked Over: 0"; Debug.Log((object)$"[Omniscye Bowling] Ball reset complete. Frame: {currentFrame + 1}, Throw: {throwCount % 2 + 1}"); } private void SpawnRewardPrefab() { if ((Object)(object)rewardPrefab != (Object)null) { PhotonView component = rewardPrefab.GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null) { ((MonoBehaviourPun)this).photonView.RPC("EnableRewardRPC", (RpcTarget)3, new object[1] { component.ViewID }); Debug.Log((object)"[Omniscye Bowling] Sent RPC to enable reward object."); } else { Debug.LogWarning((object)"[Omniscye Bowling] Reward prefab is missing PhotonView."); } } else { Debug.LogWarning((object)"[Omniscye Bowling] Reward prefab not assigned."); } } [PunRPC] private void EnableRewardRPC(int viewID) { PhotonView val = PhotonView.Find(viewID); if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject != (Object)null) { ((Component)val).gameObject.SetActive(true); Debug.Log((object)"[Omniscye Bowling] Reward activated across all clients."); } else { Debug.LogWarning((object)"[Omniscye Bowling] Could not find reward PhotonView by ViewID."); } } private void ResetPins() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) GameObject[] array = pins; foreach (GameObject val in array) { val.transform.position = originalPositions[val]; val.transform.rotation = originalRotations[val]; Rigidbody component = val.GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component)) { component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; } Renderer component2 = val.GetComponent<Renderer>(); Collider component3 = val.GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component2)) { component2.enabled = true; } if (Object.op_Implicit((Object)(object)component3)) { component3.enabled = true; } } pinsKnockedOver = 0; Debug.Log((object)"[Omniscye Bowling] All pins reset and re-enabled"); } private void HideKnockedPins() { int num = 0; GameObject[] array = pins; foreach (GameObject val in array) { if (IsPinKnockedOver(val)) { Renderer component = val.GetComponent<Renderer>(); Collider component2 = val.GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component)) { component.enabled = false; } if (Object.op_Implicit((Object)(object)component2)) { component2.enabled = false; } num++; } } Debug.Log((object)$"[Omniscye Bowling] Hidden {num} knocked pins for second throw"); } private int CalculateTotalScore() { int num = 0; foreach (int @throw in throws) { num += @throw; } return num; } private void TriggerPlayerDeath() { if ((Object)(object)playerKillCollider == (Object)null) { Debug.LogError((object)"[Omniscye Bowling] No HurtCollider assigned for player death!"); return; } PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); PlayerAvatar[] array2 = array; foreach (PlayerAvatar val in array2) { if ((Object)(object)val != (Object)null && (Object)(object)val.playerHealth != (Object)null) { Debug.Log((object)("[Omniscye Bowling] Killing player: " + ((Object)val).name)); int num = ((!((Object)(object)playerKillCollider.enemyHost != (Object)null)) ? (-1) : 0); val.playerHealth.Hurt(val.playerHealth.health, false, num); } } } } public class ChasingSkullValuable : Trap { [Header("Chase Settings")] public float forceStrength = 50f; public float maxSpeed = 15f; public float detectionRange = 30f; public float playerKnockbackForce = 25f; [Header("Physics")] public Rigidbody rb; private PlayerAvatar targetPlayer; public override void Start() { ((Trap)this).Start(); if ((Object)(object)rb == (Object)null) { rb = ((Component)this).GetComponent<Rigidbody>(); } } public override void Update() { ((Trap)this).Update(); if (!base.physGrabObject.grabbed) { FindPlayerTarget(); ChaseTarget(); } else { targetPlayer = null; } } private void FindPlayerTarget() { //IL_005f: 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) if ((Object)(object)targetPlayer != (Object)null && !targetPlayer.isDisabled) { return; } float num = detectionRange; PlayerAvatar val = null; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!item.isDisabled) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if (num2 < num) { num = num2; val = item; } } } targetPlayer = val; } private void ChaseTarget() { //IL_002e: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) if (!((Object)(object)targetPlayer == (Object)null) && !targetPlayer.isDisabled) { Vector3 val = ((Component)targetPlayer).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; val = rb.velocity; if (((Vector3)(ref val)).magnitude < maxSpeed) { rb.AddForce(normalized * forceStrength, (ForceMode)5); } } } private void OnCollisionEnter(Collision collision) { //IL_004c: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer()) { PlayerAvatar componentInParent = ((Component)collision.collider).GetComponentInParent<PlayerAvatar>(); if ((Object)(object)componentInParent != (Object)null && !componentInParent.isDisabled) { componentInParent.tumble.TumbleRequest(true, false); Vector3 val = ((Component)componentInParent).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; componentInParent.tumble.TumbleForce(normalized * playerKnockbackForce); componentInParent.tumble.TumbleOverrideTime(1.5f); } } } } public class CoasterSeatCarrier : MonoBehaviour { [Tooltip("Child under the cart where the player sits (must be parented)")] public Transform seatPoint; [Header("Grab & Follow Settings")] [Tooltip("How close the player must be to latch on")] public float grabDistance = 1f; [Tooltip("Spring stiffness for position follow")] public float positionStiffness = 10f; [Tooltip("Spring stiffness for rotation follow")] public float rotationStiffness = 0.2f; private PlayerAvatar playerTarget; private void FixedUpdate() { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)playerTarget == (Object)null) { foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (item.isDisabled || !(Vector3.Distance(seatPoint.position, ((Component)item).transform.position) <= grabDistance)) { continue; } playerTarget = item; break; } } if ((Object)(object)playerTarget != (Object)null && !playerTarget.isDisabled) { Rigidbody rb = playerTarget.tumble.rb; if (!playerTarget.tumble.isTumbling) { playerTarget.tumble.TumbleRequest(true, false); } playerTarget.tumble.TumbleOverrideTime(1f); playerTarget.FallDamageResetSet(0.1f); Vector3 val = SemiFunc.PhysFollowPosition(((Component)playerTarget.tumble).transform.position, seatPoint.position, rb.velocity, positionStiffness); rb.AddForce(val * (positionStiffness * Time.fixedDeltaTime), (ForceMode)1); Vector3 val2 = SemiFunc.PhysFollowRotation(((Component)playerTarget.tumble).transform, seatPoint.rotation, rb, rotationStiffness); rb.AddTorque(val2 * Time.fixedDeltaTime, (ForceMode)1); } } } [RequireComponent(typeof(Renderer))] public class CubeWalk : MonoBehaviour { [CompilerGenerated] private sealed class <FlipRight>d__13 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CubeWalk <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FlipRight>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; if (!<>4__this.isFlipping) { <>4__this.isFlipping = true; ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.PerformFlip()); } break; } <>2__current = (object)new WaitForSeconds(<>4__this.flipDelay); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PerformFlip>d__14 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CubeWalk <>4__this; private float <rotationAmount>5__1; private float <rotationSpeed>5__2; private float <totalRotation>5__3; private Vector3 <rightAngleRotation>5__4; private float <step>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PerformFlip>d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0089: 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_00f1: 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_013d: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <rotationAmount>5__1 = 90f; <rotationSpeed>5__2 = <rotationAmount>5__1 / <>4__this.flipDelay * Time.deltaTime; <totalRotation>5__3 = 0f; break; case 1: <>1__state = -1; break; } if (<totalRotation>5__3 < <rotationAmount>5__1) { <step>5__5 = Mathf.Min(<rotationSpeed>5__2, <rotationAmount>5__1 - <totalRotation>5__3); ((Component)<>4__this).transform.RotateAround(<>4__this.pivot, <>4__this.rotationAxis, <step>5__5); <totalRotation>5__3 += <step>5__5; <>2__current = null; <>1__state = 1; return true; } <rightAngleRotation>5__4 = new Vector3(Mathf.Round(((Component)<>4__this).transform.eulerAngles.x / 90f) * 90f, Mathf.Round(((Component)<>4__this).transform.eulerAngles.y / 90f) * 90f, Mathf.Round(((Component)<>4__this).transform.eulerAngles.z / 90f) * 90f); ((Component)<>4__this).transform.eulerAngles = <rightAngleRotation>5__4; <>4__this.pivot = ((Component)<>4__this).transform.position + new Vector3(((Component)<>4__this).transform.localScale.x / 2f, (0f - ((Component)<>4__this).transform.localScale.y) / 2f, ((Component)<>4__this).transform.localScale.z / 2f); <>4__this.isFlipping = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Header("Flip Settings")] public float flipDelay = 0.5f; [Header("Audio Settings")] public AudioSource audioSource; public float sensitivity = 15f; [Header("Materials")] public Material blackMaterial; public Material redMaterial; private Vector3 pivot; private bool isFlipping = false; private Vector3 rotationAxis = new Vector3(0f, 0f, -1f); private Renderer rend; private float[] samples = new float[64]; private void Start() { //IL_0008: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //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) pivot = ((Component)this).transform.position + new Vector3(((Component)this).transform.localScale.x / 2f, (0f - ((Component)this).transform.localScale.y) / 2f, ((Component)this).transform.localScale.z / 2f); rend = ((Component)this).GetComponent<Renderer>(); rend.material = blackMaterial; ((MonoBehaviour)this).StartCoroutine(FlipRight()); } private void Update() { float audioVolume = GetAudioVolume(); float num = Mathf.Clamp01(audioVolume * sensitivity); if (num > 0.1f) { rend.material = redMaterial; } else { rend.material = blackMaterial; } } private float GetAudioVolume() { if ((Object)(object)audioSource == (Object)null) { return 0f; } audioSource.GetOutputData(samples, 0); float num = 0f; for (int i = 0; i < samples.Length; i++) { num += Mathf.Abs(samples[i]); } return num / (float)samples.Length; } [IteratorStateMachine(typeof(<FlipRight>d__13))] private IEnumerator FlipRight() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FlipRight>d__13(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<PerformFlip>d__14))] private IEnumerator PerformFlip() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PerformFlip>d__14(0) { <>4__this = this }; } } public class CursedFollowCat : MonoBehaviourPun { public float followDistance = 50f; public float moveForce = 20f; public float rotationForce = 5f; public float toppleAngleThreshold = 45f; public float resetAfterSeconds = 5f; private PlayerAvatar playerTarget; private Rigidbody rb; private float toppleTimer = 0f; private void Start() { rb = ((Component)this).GetComponent<Rigidbody>(); } private void FixedUpdate() { if (SemiFunc.IsMasterClientOrSingleplayer()) { AcquirePlayerTarget(); if ((Object)(object)playerTarget != (Object)null && !playerTarget.isDisabled) { FollowPlayer(); } CheckForTopple(); } } private void AcquirePlayerTarget() { //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) float num = followDistance; playerTarget = null; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!item.isDisabled) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if (num2 <= num) { num = num2; playerTarget = item; } } } } private void FollowPlayer() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)playerTarget).transform.position; Vector3 val = SemiFunc.PhysFollowPosition(rb.position, position, rb.velocity, moveForce); rb.AddForce(val * (moveForce * Time.fixedDeltaTime), (ForceMode)1); Vector3 val2 = SemiFunc.PhysFollowRotation(((Component)rb).transform, Quaternion.LookRotation(position - ((Component)this).transform.position), rb, rotationForce); rb.AddTorque(val2 * Time.fixedDeltaTime, (ForceMode)1); } private void CheckForTopple() { //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) float num = Vector3.Angle(((Component)this).transform.up, Vector3.up); if (num > toppleAngleThreshold) { toppleTimer += Time.fixedDeltaTime; if (toppleTimer >= resetAfterSeconds) { ResetUpright(); toppleTimer = 0f; } } else { toppleTimer = 0f; } } private void ResetUpright() { //IL_0012: 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_0032: 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) ((Component)this).transform.rotation = Quaternion.Euler(0f, ((Component)this).transform.eulerAngles.y, 0f); rb.angularVelocity = Vector3.zero; rb.velocity = Vector3.zero; } } public class CursedBlackHoleOrbValuable : Trap { [Header("Black Hole Settings")] public float blackHoleRange = 20f; public float pullForce = 100f; public override void Update() { ((Trap)this).Update(); if (base.physGrabObject.grabbed && SemiFunc.IsMasterClientOrSingleplayer()) { ApplyContinuousPull(); } } private void ApplyContinuousPull() { //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_0092: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { bool flag = false; foreach (PhysGrabber item2 in base.physGrabObject.playerGrabbing) { if ((Object)(object)item2.playerAvatar == (Object)(object)item) { flag = true; break; } } if (!flag && !item.isDisabled) { float num = Vector3.Distance(position, ((Component)item).transform.position); if (num <= blackHoleRange) { Vector3 val = position - ((Component)item).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; item.tumble.TumbleRequest(true, false); float num2 = Mathf.Clamp01(1f - num / blackHoleRange); float num3 = pullForce * num2; item.tumble.TumbleForce(normalized * num3); item.tumble.TumbleOverrideTime(0.2f); } } } } } public class CursedRollerValuable : MonoBehaviour { [Header("Patrol Settings")] public float moveForce = 15f; public float rotationForce = 5f; public float wanderInterval = 5f; public float wanderRadius = 10f; [Header("Coaster Settings")] public Transform seatPoint; public float grabDistance = 1f; public float positionStiffness = 10f; public float rotationStiffness = 0.2f; public float latchDuration = 5f; public float tossForce = 30f; public float regrabCooldown = 5f; private PlayerAvatar playerTarget; private Rigidbody rb; private float wanderTimer = 0f; private Vector3 randomWanderTarget; private float latchTimer = 0f; private float regrabTimer = 0f; private void Start() { rb = ((Component)this).GetComponent<Rigidbody>(); SetRandomWanderTarget(); } private void FixedUpdate() { //IL_008b: 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 (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } if (regrabTimer > 0f) { regrabTimer -= Time.fixedDeltaTime; } if ((Object)(object)playerTarget == (Object)null && regrabTimer <= 0f) { foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (item.isDisabled || !(Vector3.Distance(seatPoint.position, ((Component)item).transform.position) <= grabDistance)) { continue; } playerTarget = item; latchTimer = 0f; break; } } if ((Object)(object)playerTarget != (Object)null) { CarryPlayer(); latchTimer += Time.fixedDeltaTime; if (latchTimer >= latchDuration) { TossPlayer(); playerTarget = null; latchTimer = 0f; regrabTimer = regrabCooldown; SetRandomWanderTarget(); } } else { wanderTimer += Time.fixedDeltaTime; if (wanderTimer >= wanderInterval) { wanderTimer = 0f; SetRandomWanderTarget(); } MoveToWanderTarget(); } } private void CarryPlayer() { //IL_0073: 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_0084: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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) Rigidbody val = playerTarget.tumble.rb; if (!playerTarget.tumble.isTumbling) { playerTarget.tumble.TumbleRequest(true, false); } playerTarget.tumble.TumbleOverrideTime(1f); playerTarget.FallDamageResetSet(0.1f); Vector3 val2 = SemiFunc.PhysFollowPosition(((Component)playerTarget.tumble).transform.position, seatPoint.position, val.velocity, positionStiffness); val.AddForce(val2 * (positionStiffness * Time.fixedDeltaTime), (ForceMode)1); Vector3 val3 = SemiFunc.PhysFollowRotation(((Component)playerTarget.tumble).transform, seatPoint.rotation, val, rotationStiffness); val.AddTorque(val3 * Time.fixedDeltaTime, (ForceMode)1); } private void TossPlayer() { //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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) Vector3 val = ((Component)playerTarget).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; playerTarget.tumble.TumbleRequest(true, false); playerTarget.tumble.TumbleForce(normalized * tossForce); playerTarget.tumble.TumbleOverrideTime(1f); } private void SetRandomWanderTarget() { //IL_0001: 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_0011: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Random.insideUnitCircle * wanderRadius; randomWanderTarget = ((Component)this).transform.position + new Vector3(val.x, 0f, val.y); } private void MoveToWanderTarget() { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_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_0086: 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) Vector3 val = SemiFunc.PhysFollowPosition(rb.position, randomWanderTarget, rb.velocity, moveForce); rb.AddForce(val * (moveForce * Time.fixedDeltaTime), (ForceMode)1); Vector3 val2 = SemiFunc.PhysFollowRotation(((Component)rb).transform, Quaternion.LookRotation(randomWanderTarget - ((Component)this).transform.position), rb, rotationForce); rb.AddTorque(val2 * Time.fixedDeltaTime, (ForceMode)1); } } public class GreedyVendingTrap : MonoBehaviourPun { [CompilerGenerated] private sealed class <PressCooldown>d__10 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GreedyVendingTrap <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PressCooldown>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.recentlyPressed = true; <>2__current = (object)new WaitForSeconds(<>4__this.cooldown); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.recentlyPressed = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private ItemToggle itemToggle; private bool warned = false; private bool recentlyPressed = false; public AudioClip warningClip; public AudioSource audioSource; public Animator warningAnimator; public string animationTriggerName = "Warn"; public float cooldown = 0.5f; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } private void Update() { if (!itemToggle.toggleImpulse || recentlyPressed) { return; } ((MonoBehaviour)this).StartCoroutine(PressCooldown()); if (!warned) { warned = true; if ((Object)(object)warningClip != (Object)null && (Object)(object)audioSource != (Object)null) { audioSource.PlayOneShot(warningClip); } if ((Object)(object)warningAnimator != (Object)null) { warningAnimator.SetTrigger(animationTriggerName); } Debug.Log((object)"[Trap] First press - warning issued."); } else { Debug.Log((object)"[Trap] Second press - punishing all players."); KillAllPlayers(); } } [IteratorStateMachine(typeof(<PressCooldown>d__10))] private IEnumerator PressCooldown() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PressCooldown>d__10(0) { <>4__this = this }; } private void KillAllPlayers() { PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); PlayerAvatar[] array2 = array; foreach (PlayerAvatar val in array2) { if ((Object)(object)val != (Object)null && (Object)(object)val.playerHealth != (Object)null) { int num = -1; val.playerHealth.Hurt(val.playerHealth.health, false, num); } } } } [RequireComponent(typeof(Collider))] public class KinematicCoasterMover : MonoBehaviour { [Header("Waypoints & Timing")] public Transform waypointRoot; public float speed = 5f; public float startDelay = 10f; public bool loop = true; public float rotationSpeed = 5f; [Header("Mesh Import Rotation Correction (tweak in Inspector)")] public Vector3 meshEulerOffset = new Vector3(-90f, 180f, -0.085f); private Transform[] waypoints; private int idx; private float delayTimer; private bool started; private Quaternion originalRotation; private Quaternion meshOffsetQuat; private static readonly Regex regex = new Regex("Waypoint_(\\d+)$"); private void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c5: 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) originalRotation = ((Component)this).transform.rotation; waypoints = (from t in ((Component)waypointRoot).GetComponentsInChildren<Transform>(true) where regex.IsMatch(((Object)t).name) select new { t = t, i = int.Parse(regex.Match(((Object)t).name).Groups[1].Value) } into x orderby x.i select x.t).ToArray(); meshOffsetQuat = Quaternion.Euler(meshEulerOffset); idx = 0; delayTimer = startDelay; started = false; if (waypoints.Length != 0) { ((Component)this).transform.position = waypoints[0].position; } } private void Update() { //IL_0048: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c9: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) if (waypoints == null || waypoints.Length == 0) { return; } if (!started) { delayTimer -= Time.deltaTime; ((Component)this).transform.rotation = originalRotation; if (delayTimer <= 0f) { started = true; } return; } if (idx == 0 && ((Component)this).transform.rotation == originalRotation && waypoints.Length > 1) { Vector3 val = waypoints[1].position - waypoints[0].position; Vector3 normalized = ((Vector3)(ref val)).normalized; Quaternion rotation = Quaternion.LookRotation(normalized, Vector3.up) * meshOffsetQuat; ((Component)this).transform.rotation = rotation; } Vector3 position = waypoints[idx].position; Vector3 val2 = position - ((Component)this).transform.position; float num = speed * Time.deltaTime; if (((Vector3)(ref val2)).magnitude <= num) { ((Component)this).transform.position = position; AdvanceIndex(); return; } Transform transform = ((Component)this).transform; transform.position += ((Vector3)(ref val2)).normalized * num; Quaternion val3 = Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up) * meshOffsetQuat; ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val3, rotationSpeed * Time.deltaTime); } private void AdvanceIndex() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) idx++; if (idx >= waypoints.Length) { if (loop) { idx = 0; delayTimer = startDelay; started = false; ((Component)this).transform.rotation = originalRotation; } else { ((Behaviour)this).enabled = false; } } } private void OnDrawGizmos() { //IL_00b8: 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_00d2: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)waypointRoot == (Object)null)) { Vector3[] array = (from t in ((Component)waypointRoot).GetComponentsInChildren<Transform>(true) where regex.IsMatch(((Object)t).name) select new { p = t.position, i = int.Parse(regex.Match(((Object)t).name).Groups[1].Value) } into x orderby x.i select x.p).ToArray(); Gizmos.color = Color.cyan; for (int i = 0; i + 1 < array.Length; i++) { Gizmos.DrawLine(array[i], array[i + 1]); } } } } public class CursedMusicBoxValuable : Trap { [Header("Audio")] public Sound cursedMusicSound; [Header("Spin Settings")] public float spinForce = 50f; public float tumbleForce = 15f; public float spinInterval = 0.2f; [Header("Visual Effects")] public ParticleSystem curseSparks; public Light curseLight; [Header("Animator")] public Animator cursedAnimator; public string holdBoolParameter = "IsHeld"; [Header("Camera Shake")] public float cameraShakeTime = 0.2f; public float cameraShakeStrength = 3f; public Vector2 cameraShakeBounds = new Vector2(1.5f, 5f); private float spinTimer; private Rigidbody rb; private bool soundPlaying = false; public override void Start() { ((Trap)this).Start(); rb = ((Component)this).GetComponent<Rigidbody>(); if ((Object)(object)curseLight != (Object)null) { ((Behaviour)curseLight).enabled = false; } } public override void Update() { ((Trap)this).Update(); if (SemiFunc.IsMasterClientOrSingleplayer()) { CheckForGrabTumble(); } HandleGrabAnimation(); } private void CheckForGrabTumble() { if (!SemiFunc.FPSImpulse15() && base.physGrabObject.grabbed) { ActivateCurseEffects(); { foreach (PhysGrabber item in base.physGrabObject.playerGrabbing) { SpinAndTumblePlayer(item.playerAvatar); } return; } } StopCurseEffects(); } private void ActivateCurseEffects() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!soundPlaying) { cursedMusicSound.Play(base.physGrabObject.centerPoint, 1f, 1f, 1f, 1f); soundPlaying = true; } if ((Object)(object)curseLight != (Object)null) { ((Behaviour)curseLight).enabled = true; } if ((Object)(object)curseSparks != (Object)null && !curseSparks.isPlaying) { curseSparks.Play(); } } private void StopCurseEffects() { if (soundPlaying) { cursedMusicSound.Stop(); soundPlaying = false; } if ((Object)(object)curseLight != (Object)null) { ((Behaviour)curseLight).enabled = false; } if ((Object)(object)curseSparks != (Object)null && curseSparks.isPlaying) { curseSparks.Stop(); } } private void SpinAndTumblePlayer(PlayerAvatar player) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) spinTimer += Time.deltaTime; if (spinTimer >= spinInterval) { spinTimer = 0f; player.tumble.TumbleRequest(true, false); player.tumble.TumbleForce(((Component)player).transform.forward * tumbleForce); player.tumble.TumbleTorque(Vector3.up * spinForce); player.tumble.TumbleOverrideTime(2f); player.tumble.ImpactHurtSet(1f, 5); GameDirector.instance.CameraShake.ShakeDistance(cameraShakeStrength, 3f, 8f, ((Component)this).transform.position, cameraShakeTime); GameDirector.instance.CameraImpact.ShakeDistance(cameraShakeStrength, cameraShakeBounds.x, cameraShakeBounds.y, ((Component)this).transform.position, cameraShakeTime); } } private void HandleGrabAnimation() { if (!((Object)(object)cursedAnimator == (Object)null)) { bool grabbed = base.physGrabObject.grabbed; cursedAnimator.SetBool(holdBoolParameter, grabbed); } } } public class NetworkedProximityTrigger : MonoBehaviourPun { [Header("Trigger Settings")] public float triggerDistance = 2f; public float deactivateAfterSeconds = 49f; public bool retriggerable = false; [Header("Actions")] public VideoPlayer videoPlayer; public AudioSource externalAudioSource; [Header("Audio Control")] public bool startAudioOnActivate = false; public bool stopAudioOnDeactivate = false; public GameObject[] objectsToToggle; [Header("Animator Settings")] public Animator targetAnimator; public string triggerParameterName = "Activate"; private bool isActive = false; private bool hasTriggered = false; private float timer = 0f; private PlayerAvatar playerTarget; private void FixedUpdate() { //IL_004c: 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) if (hasTriggered) { return; } if ((Object)(object)playerTarget == (Object)null) { foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (item.isDisabled || !(Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position) <= triggerDistance)) { continue; } playerTarget = item; break; } } if (!((Object)(object)playerTarget != (Object)null) || playerTarget.isDisabled) { return; } if (!isActive) { TriggerActivate(); return; } timer += Time.fixedDeltaTime; if (timer >= deactivateAfterSeconds) { TriggerDeactivate(); hasTriggered = true; } } private void TriggerActivate() { if (PhotonNetwork.IsConnectedAndReady || PhotonNetwork.OfflineMode) { ((MonoBehaviourPun)this).photonView.RPC("ActivateTrigger", (RpcTarget)3, Array.Empty<object>()); } else { ActivateTrigger(); } } private void TriggerDeactivate() { if (PhotonNetwork.IsConnectedAndReady || PhotonNetwork.OfflineMode) { ((MonoBehaviourPun)this).photonView.RPC("DeactivateTrigger", (RpcTarget)3, Array.Empty<object>()); } else { DeactivateTrigger(); } } [PunRPC] private void ActivateTrigger() { if (isActive) { return; } isActive = true; timer = 0f; if ((Object)(object)videoPlayer != (Object)null) { videoPlayer.Play(); } if (startAudioOnActivate && (Object)(object)externalAudioSource != (Object)null && !externalAudioSource.isPlaying) { externalAudioSource.Play(); } GameObject[] array = objectsToToggle; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { val.SetActive(true); } } if ((Object)(object)targetAnimator != (Object)null && !string.IsNullOrEmpty(triggerParameterName)) { targetAnimator.SetTrigger(triggerParameterName); } } [PunRPC] private void DeactivateTrigger() { if (!isActive) { return; } isActive = false; playerTarget = null; if ((Object)(object)videoPlayer != (Object)null) { videoPlayer.Stop(); } if (stopAudioOnDeactivate && (Object)(object)externalAudioSource != (Object)null) { externalAudioSource.Stop(); } GameObject[] array = objectsToToggle; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { val.SetActive(false); } } } } public class PlayerWallBlocker : Trap { [Header("Push Settings")] public float blockRange = 2f; public float pushForce = 30f; public override void Update() { ((Trap)this).Update(); if (SemiFunc.IsMasterClientOrSingleplayer()) { PushBackNearbyPlayers(); } } private void PushBackNearbyPlayers() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00ac: Unknown result type (might be due to invalid IL or missing references) foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!item.isDisabled) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if (num <= blockRange) { Vector3 val = ((Component)item).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; normalized.y = 0f; Rigidbody rb = item.tumble.rb; rb.AddForce(normalized * pushForce * Time.deltaTime, (ForceMode)2); } } } } } public class TeleportGlitchValuable : Trap { [Header("Teleport Settings")] public float teleportForce = 150f; public float teleportInterval = 2f; private float teleportTimer = 0f; public override void Update() { ((Trap)this).Update(); if (SemiFunc.IsMasterClientOrSingleplayer()) { CheckForGrabTeleport(); } } private void CheckForGrabTeleport() { if (base.physGrabObject.grabbed) { teleportTimer += Time.deltaTime; if (!(teleportTimer >= teleportInterval)) { return; } teleportTimer = 0f; { foreach (PhysGrabber item in base.physGrabObject.playerGrabbing) { if ((Object)(object)item != (Object)null && (Object)(object)item.playerAvatar != (Object)null) { ApplyTeleportEffect(item.playerAvatar); } } return; } } teleportTimer = 0f; } private void ApplyTeleportEffect(PlayerAvatar player) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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) player.tumble.TumbleRequest(true, false); Vector3 up = Vector3.up; player.tumble.TumbleForce(up * teleportForce); player.tumble.TumbleOverrideTime(1.5f); } } namespace NWH.DWP2.DefaultWater { [ExecuteInEditMode] [RequireComponent(typeof(WaterBase))] public class Displace : MonoBehaviour { public void Awake() { if (((Behaviour)this).enabled) { OnEnable(); } else { OnDisable(); } } public void OnEnable() { Shader.EnableKeyword("WATER_VERTEX_DISPLACEMENT_ON"); Shader.DisableKeyword("WATER_VERTEX_DISPLACEMENT_OFF"); } public void OnDisable() { Shader.EnableKeyword("WATER_VERTEX_DISPLACEMENT_OFF"); Shader.DisableKeyword("WATER_VERTEX_DISPLACEMENT_ON"); } } [ExecuteInEditMode] [RequireComponent(typeof(WaterBase))] public class GerstnerDisplace : Displace { } public class MeshContainer { public Mesh mesh; public Vector3[] vertices; public Vector3[] normals; public MeshContainer(Mesh m) { mesh = m; vertices = m.vertices; normals = m.normals; } public void Update() { mesh.vertices = vertices; mesh.normals = normals; } } [ExecuteInEditMode] [RequireComponent(typeof(WaterBase))] public class PlanarReflection : MonoBehaviour { public LayerMask reflectionMask; public bool reflectSkybox; public Color clearColor = Color.grey; public string reflectionSampler = "_ReflectionTex"; public float clipPlaneOffset = 0.07f; private Vector3 m_Oldpos; private Camera m_ReflectionCamera; private Material m_SharedMaterial; private Dictionary<Camera, bool> m_HelperCameras; public void Start() { m_SharedMaterial = ((WaterBase)(object)((Component)this).gameObject.GetComponent(typeof(WaterBase))).sharedMaterial; } public void LateUpdate() { if (m_HelperCameras != null) { m_HelperCameras.Clear(); } } private Camera CreateReflectionCameraFor(Camera cam) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) string text = ((Object)((Component)this).gameObject).name + "Reflection" + ((Object)cam).name; GameObject val = GameObject.Find(text); if (!Object.op_Implicit((Object)(object)val)) { val = new GameObject(text, new Type[1] { typeof(Camera) }); } if (!Object.op_Implicit((Object)(object)val.GetComponent(typeof(Camera)))) { val.AddComponent(typeof(Camera)); } Camera component = val.GetComponent<Camera>(); component.backgroundColor = clearColor; component.clearFlags = (CameraClearFlags)(reflectSkybox ? 1 : 2); SetStandardCameraParameter(component, reflectionMask); if (!Object.op_Implicit((Object)(object)component.targetTexture)) { component.targetTexture = CreateTextureFor(cam); } return component; } private void SetStandardCameraParameter(Camera cam, LayerMask mask) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) cam.cullingMask = LayerMask.op_Implicit(mask) & ~(1 << LayerMask.NameToLayer("Water")); cam.backgroundColor = Color.black; ((Behaviour)cam).enabled = false; } private RenderTexture CreateTextureFor(Camera cam) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown RenderTexture val = new RenderTexture(Mathf.FloorToInt((float)cam.pixelWidth * 0.5f), Mathf.FloorToInt((float)cam.pixelHeight * 0.5f), 24); ((Object)val).hideFlags = (HideFlags)52; return val; } public void RenderHelpCameras(Camera currentCam) { if (m_HelperCameras == null) { m_HelperCameras = new Dictionary<Camera, bool>(); } if (!m_HelperCameras.ContainsKey(currentCam)) { m_HelperCameras.Add(currentCam, value: false); } if (!m_HelperCameras[currentCam]) { if (!Object.op_Implicit((Object)(object)m_ReflectionCamera)) { m_ReflectionCamera = CreateReflectionCameraFor(currentCam); } RenderReflectionFor(currentCam, m_ReflectionCamera); m_HelperCameras[currentCam] = true; } } public void WaterTileBeingRendered(Transform tr, Camera currentCam) { RenderHelpCameras(currentCam); if (Object.op_Implicit((Object)(object)m_ReflectionCamera) && Object.op_Implicit((Object)(object)m_SharedMaterial)) { m_SharedMaterial.SetTexture(reflectionSampler, (Texture)(object)m_ReflectionCamera.targetTexture); } } public void OnEnable() { Shader.EnableKeyword("WATER_REFLECTIVE"); Shader.DisableKeyword("WATER_SIMPLE"); } public void OnDisable() { Shader.EnableKeyword("WATER_SIMPLE"); Shader.DisableKeyword("WATER_REFLECTIVE"); } private void RenderReflectionFor(Camera cam, Camera reflectCamera) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0284: 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_00de: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)reflectCamera) || (Object.op_Implicit((Object)(object)m_SharedMaterial) && !m_SharedMaterial.HasProperty(reflectionSampler))) { return; } reflectCamera.cullingMask = LayerMask.op_Implicit(reflectionMask) & ~(1 << LayerMask.NameToLayer("Water")); SaneCameraSettings(reflectCamera); reflectCamera.backgroundColor = clearColor; reflectCamera.clearFlags = (CameraClearFlags)(reflectSkybox ? 1 : 2); if (reflectSkybox && Object.op_Implicit((Object)(object)((Component)cam).gameObject.GetComponent(typeof(Skybox)))) { Skybox val = (Skybox)((Component)reflectCamera).gameObject.GetComponent(typeof(Skybox)); if (!Object.op_Implicit((Object)(object)val)) { val = (Skybox)((Component)reflectCamera).gameObject.AddComponent(typeof(Skybox)); } val.material = ((Skybox)((Component)cam).GetComponent(typeof(Skybox))).material; } GL.invertCulling = true; Transform transform = ((Component)this).transform; Vector3 eulerAngles = ((Component)cam).transform.eulerAngles; ((Component)reflectCamera).transform.eulerAngles = new Vector3(0f - eulerAngles.x, eulerAngles.y, eulerAngles.z); ((Component)reflectCamera).transform.position = ((Component)cam).transform.position; Vector3 position = ((Component)transform).transform.position; position.y = transform.position.y; Vector3 up = ((Component)transform).transform.up; float num = 0f - Vector3.Dot(up, position) - clipPlaneOffset; Vector4 plane = default(Vector4); ((Vector4)(ref plane))..ctor(up.x, up.y, up.z, num); Matrix4x4 val2 = Matrix4x4.zero; val2 = CalculateReflectionMatrix(val2, plane); m_Oldpos = ((Component)cam).transform.position; Vector3 position2 = ((Matrix4x4)(ref val2)).MultiplyPoint(m_Oldpos); reflectCamera.worldToCameraMatrix = cam.worldToCameraMatrix * val2; Vector4 clipPlane = CameraSpacePlane(reflectCamera, position, up, 1f); Matrix4x4 projectionMatrix = cam.projectionMatrix; projectionMatrix = CalculateObliqueMatrix(projectionMatrix, clipPlane); reflectCamera.projectionMatrix = projectionMatrix; ((Component)reflectCamera).transform.position = position2; Vector3 eulerAngles2 = ((Component)cam).transform.eulerAngles; ((Component)reflectCamera).transform.eulerAngles = new Vector3(0f - eulerAngles2.x, eulerAngles2.y, eulerAngles2.z); reflectCamera.Render(); GL.invertCulling = false; } private void SaneCameraSettings(Camera helperCam) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) helperCam.depthTextureMode = (DepthTextureMode)0; helperCam.backgroundColor = Color.black; helperCam.clearFlags = (CameraClearFlags)2; helperCam.renderingPath = (RenderingPath)1; } private static Matrix4x4 CalculateObliqueMatrix(Matrix4x4 projection, Vector4 clipPlane) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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_0032: 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_0039: 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_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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) Vector4 val = ((Matrix4x4)(ref projection)).inverse * new Vector4(Sgn(clipPlane.x), Sgn(clipPlane.y), 1f, 1f); Vector4 val2 = clipPlane * (2f / Vector4.Dot(clipPlane, val)); ((Matrix4x4)(ref projection))[2] = val2.x - ((Matrix4x4)(ref projection))[3]; ((Matrix4x4)(ref projection))[6] = val2.y - ((Matrix4x4)(ref projection))[7]; ((Matrix4x4)(ref projection))[10] = val2.z - ((Matrix4x4)(ref projection))[11]; ((Matrix4x4)(ref projection))[14] = val2.w - ((Matrix4x4)(ref projection))[15]; return projection; } private static Matrix4x4 CalculateReflectionMatrix(Matrix4x4 reflectionMat, Vector4 plane) { //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) reflectionMat.m00 = 1f - 2f * ((Vector4)(ref plane))[0] * ((Vector4)(ref plane))[0]; reflectionMat.m01 = -2f * ((Vector4)(ref plane))[0] * ((Vector4)(ref plane))[1]; reflectionMat.m02 = -2f * ((Vector4)(ref plane))[0] * ((Vector4)(ref plane))[2]; reflectionMat.m03 = -2f * ((Vector4)(ref plane))[3] * ((Vector4)(ref plane))[0]; reflectionMat.m10 = -2f * ((Vector4)(ref plane))[1] * ((Vector4)(ref plane))[0]; reflectionMat.m11 = 1f - 2f * ((Vector4)(ref plane))[1] * ((Vector4)(ref plane))[1]; reflectionMat.m12 = -2f * ((Vector4)(ref plane))[1] * ((Vector4)(ref plane))[2]; reflectionMat.m13 = -2f * ((Vector4)(ref plane))[3] * ((Vector4)(ref plane))[1]; reflectionMat.m20 = -2f * ((Vector4)(ref plane))[2] * ((Vector4)(ref plane))[0]; reflectionMat.m21 = -2f * ((Vector4)(ref plane))[2] * ((Vector4)(ref plane))[1]; reflectionMat.m22 = 1f - 2f * ((Vector4)(ref plane))[2] * ((Vector4)(ref plane))[2]; reflectionMat.m23 = -2f * ((Vector4)(ref plane))[3] * ((Vector4)(ref plane))[2]; reflectionMat.m30 = 0f; reflectionMat.m31 = 0f; reflectionMat.m32 = 0f; reflectionMat.m33 = 1f; return reflectionMat; } private static float Sgn(float a) { if (a > 0f) { return 1f; } if (a < 0f) { return -1f; } return 0f; } private Vector4 CameraSpacePlane(Camera cam, Vector3 pos, Vector3 normal, float sideSign) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) Vector3 val = pos + normal * clipPlaneOffset; Matrix4x4 worldToCameraMatrix = cam.worldToCameraMatrix; Vector3 val2 = ((Matrix4x4)(ref worldToCameraMatrix)).MultiplyPoint(val); Vector3 val3 = ((Matrix4x4)(ref worldToCameraMatrix)).MultiplyVector(normal); Vector3 val4 = ((Vector3)(ref val3)).normalized * sideSign; return new Vector4(val4.x, val4.y, val4.z, 0f - Vector3.Dot(val2, val4)); } } [RequireComponent(typeof(WaterBase))] [ExecuteInEditMode] public class SpecularLighting : MonoBehaviour { public Transform specularLight; private WaterBase m_WaterBase; public void Start() { m_WaterBase = (WaterBase)(object)((Component)this).gameObject.GetComponent(typeof(WaterBase)); } public void Update() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)m_WaterBase)) { m_WaterBase = (WaterBase)(object)((Component)this).gameObject.GetComponent(typeof(WaterBase)); } if (Object.op_Implicit((Object)(object)specularLight) && Object.op_Implicit((Object)(object)m_WaterBase.sharedMaterial)) { m_WaterBase.sharedMaterial.SetVector("_WorldLightDir", Vector4.op_Implicit(((Component)specularLight).transform.forward)); } } } [ExecuteInEditMode] public class Water : MonoBehaviour { public enum WaterMode { Simple, Reflective, Refractive } private static bool s_InsideWater; public WaterMode waterMode = WaterMode.Refractive; public bool disablePixelLights = true; public int textureSize = 256; public float clipPlaneOffset = 0.07f; public LayerMask reflectLayers = LayerMask.op_Implicit(-1); public LayerMask refractLayers = LayerMask.op_Implicit(-1); private readonly Dictionary<Camera, Camera> m_ReflectionCameras = new Dictionary<Camera, Camera>(); private readonly Dictionary<Camera, Camera> m_RefractionCameras = new Dictionary<Camera, Camera>(); private RenderTexture m_ReflectionTexture; private RenderTexture m_RefractionTexture; private WaterMode m_HardwareWaterSupport = WaterMode.Refractive; private int m_OldReflectionTextureSize; private int m_OldRefractionTextureSize; private void Update() { //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_007f: 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_009f: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((Component)this).GetComponent<Renderer>())) { Material sharedMaterial = ((Component)this).GetComponent<Renderer>().sharedMaterial; if (Object.op_Implicit((Object)(object)sharedMaterial)) { Vector4 vector = sharedMaterial.GetVector("WaveSpeed"); float @float = sharedMaterial.GetFloat("_WaveScale"); Vector4 val = default(Vector4); ((Vector4)(ref val))..ctor(@float, @float, @float * 0.4f, @float * 0.45f); double num = (double)Time.timeSinceLevelLoad / 20.0; Vector4 val2 = default(Vector4); ((Vector4)(ref val2))..ctor((float)Math.IEEERemainder((double)(vector.x * val.x) * num, 1.0), (float)Math.IEEERemainder((double)(vector.y * val.y) * num, 1.0), (float)Math.IEEERemainder((double)(vector.z * val.z) * num, 1.0), (float)Math.IEEERemainder((double)(vector.w * val.w) * num, 1.0)); sharedMaterial.SetVector("_WaveOffset", val2); sharedMaterial.SetVector("_WaveScale4", val); } } } public void OnWillRenderObject() { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ef: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) if (!((Behaviour)this).enabled || !Object.op_Implicit((Object)(object)((Component)this).GetComponent<Renderer>()) || !Object.op_Implicit((Object)(object)((Component)this).GetComponent<Renderer>().sharedMaterial) || !((Component)this).GetComponent<Renderer>().enabled) { return; } Camera current = Camera.current; if (Object.op_Implicit((Object)(object)current) && !s_InsideWater) { s_InsideWater = true; m_HardwareWaterSupport = FindHardwareWaterSupport(); WaterMode waterMode = GetWaterMode(); CreateWaterObjects(current, out Camera reflectionCamera, out Camera refractionCamera); Vector3 position = ((Component)this).transform.position; Vector3 up = ((Component)this).transform.up; int pixelLightCount = QualitySettings.pixelLightCount; if (disablePixelLights) { QualitySettings.pixelLightCount = 0; } UpdateCameraModes(current, reflectionCamera); UpdateCameraModes(current, refractionCamera); if (waterMode >= WaterMode.Reflective) { float num = 0f - Vector3.Dot(up, position) - clipPlaneOffset; Vector4 plane = default(Vector4); ((Vector4)(ref plane))..ctor(up.x, up.y, up.z, num); Matrix4x4 reflectionMat = Matrix4x4.zero; CalculateReflectionMatrix(ref reflectionMat, plane); Vector3 position2 = ((Component)current).transform.position; Vector3 position3 = ((Matrix4x4)(ref reflectionMat)).MultiplyPoint(position2); reflectionCamera.worldToCameraMatrix = current.worldToCameraMatrix * reflectionMat; Vector4 val = CameraSpacePlane(reflectionCamera, position, up, 1f); reflectionCamera.projectionMatrix = current.CalculateObliqueMatrix(val); reflectionCamera.cullingMatrix = current.projectionMatrix * current.worldToCameraMatrix; reflectionCamera.cullingMask = -17 & ((LayerMask)(ref reflectLayers)).value; reflectionCamera.targetTexture = m_ReflectionTexture; bool invertCulling = GL.invertCulling; GL.invertCulling = !invertCulling; ((Component)reflectionCamera).transform.position = position3; Vector3 eulerAngles = ((Component)current).transform.eulerAngles; ((Component)reflectionCamera).transform.eulerAngles = new Vector3(0f - eulerAngles.x, eulerAngles.y, eulerAngles.z); reflectionCamera.Render(); ((Component)reflectionCamera).transform.position = position2; GL.invertCulling = invertCulling; ((Component)this).GetComponent<Renderer>().sharedMaterial.SetTexture("_ReflectionTex", (Texture)(object)m_ReflectionTexture); } if (waterMode >= WaterMode.Refractive) { refractionCamera.worldToCameraMatrix = current.worldToCameraMatrix; Vector4 val2 = CameraSpacePlane(refractionCamera, position, up, -1f); refractionCamera.projectionMatrix = current.CalculateObliqueMatrix(val2); refractionCamera.cullingMatrix = current.projectionMatrix * current.worldToCameraMatrix; refractionCamera.cullingMask = -17 & ((LayerMask)(ref refractLayers)).value; refractionCamera.targetTexture = m_RefractionTexture; ((Component)refractionCamera).transform.position = ((Component)current).transform.position; ((Component)refractionCamera).transform.rotation = ((Component)current).transform.rotation; refractionCamera.Render(); ((Component)this).GetComponent<Renderer>().sharedMaterial.SetTexture("_RefractionTex", (Texture)(object)m_RefractionTexture); } if (disablePixelLights) { QualitySettings.pixelLightCount = pixelLightCount; } switch (waterMode) { case WaterMode.Simple: Shader.EnableKeyword("WATER_SIMPLE"); Shader.DisableKeyword("WATER_REFLECTIVE"); Shader.DisableKeyword("WATER_REFRACTIVE"); break; case WaterMode.Reflective: Shader.DisableKeyword("WATER_SIMPLE"); Shader.EnableKeyword("WATER_REFLECTIVE"); Shader.DisableKeyword("WATER_REFRACTIVE"); break; case WaterMode.Refractive: Shader.DisableKeyword("WATER_SIMPLE"); Shader.DisableKeyword("WATER_REFLECTIVE"); Shader.EnableKeyword("WATER_REFRACTIVE"); break; } s_InsideWater = false; } } private void OnDisable() { if (Object.op_Implicit((Object)(object)m_ReflectionTexture)) { Object.DestroyImmediate((Object)(object)m_ReflectionTexture); m_ReflectionTexture = null; } if (Object.op_Implicit((Object)(object)m_RefractionTexture)) { Object.DestroyImmediate((Object)(object)m_RefractionTexture); m_RefractionTexture = null; } foreach (KeyValuePair<Camera, Camera> reflectionCamera in m_ReflectionCameras) { Object.DestroyImmediate((Object)(object)((Component)reflectionCamera.Value).gameObject); } m_ReflectionCameras.Clear(); foreach (KeyValuePair<Camera, Camera> refractionCamera in m_RefractionCameras) { Object.DestroyImmediate((Object)(object)((Component)refractionCamera.Value).gameObject); } m_RefractionCameras.Clear(); } private void UpdateCameraModes(Camera src, Camera dest) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 if ((Object)(object)dest == (Object)null) { return; } dest.clearFlags = src.clearFlags; dest