Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of TheThing v1.0.8
TheThing.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalLib.Modules; using Microsoft.CodeAnalysis; using StaticNetcodeLib; using TheThing.Scripts; using TheThing.Utils; using Unity.Netcode; using UnityEngine; using UnityEngine.Rendering.HighDefinition; [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: AssemblyCompany("TheThing")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("TheThing")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a874517598050a3a40a2d65547166f6827a84678")] [assembly: AssemblyProduct("TheThing")] [assembly: AssemblyTitle("TheThing")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TheThing { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency("evaisa.lethallib", "0.15.1")] [BepInPlugin("wexop.the_thing", "TheThing", "1.0.8")] public class TheThingPlugin : BaseUnityPlugin { private const string GUID = "wexop.the_thing"; private const string NAME = "TheThing"; private const string VERSION = "1.0.8"; public GameObject roomObject; public GameObject actualRoomObjectInstantiated; public ThingRoomManager actualRoomObjectManager; public Dictionary<int, LightInformation> lightsInUse = new Dictionary<int, LightInformation>(); public static TheThingPlugin instance; public ConfigEntry<string> spawnMoonRarity; public ConfigEntry<int> maxSeePlayerCount; public ConfigEntry<float> timeBetweenTeleport; public ConfigEntry<float> minDistanceBetweenPlayerToTeleport; public ConfigEntry<float> TimeToEscapeRoom; public ConfigEntry<int> monsterToHitToEscapeRoom; public ConfigEntry<float> enemyPower; public ConfigEntry<float> roomFogDistance; public ConfigEntry<float> roomPosY; private void Awake() { instance = this; ((BaseUnityPlugin)this).Logger.LogInfo((object)"TheThing starting...."); string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "thing"); AssetBundle bundle = AssetBundle.LoadFromFile(text); ((BaseUnityPlugin)this).Logger.LogInfo((object)"TheThing bundle found !"); LoadConfigs(); RegisterMonster(bundle); LoadRoom(bundle); ((BaseUnityPlugin)this).Logger.LogInfo((object)"TheThing is ready!"); } private void LoadConfigs() { spawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "SpawnRarity", "Modded:40,ExperimentationLevel:20,AssuranceLevel:20,VowLevel:20,OffenseLevel:25,MarchLevel:25,RendLevel:30,DineLevel:30,TitanLevel:40,Adamance:35,Embrion:40,Artifice:45", "Chance for thing to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game."); CreateStringConfig(spawnMoonRarity, requireRestart: true); enemyPower = ((BaseUnityPlugin)this).Config.Bind<float>("General", "EnemyPower", 2f, "Enemy power for Thing monster. You need to restart the game."); CreateFloatConfig(enemyPower, 0f, 10f); maxSeePlayerCount = ((BaseUnityPlugin)this).Config.Bind<int>("Behavior", "MaxSeePlayerCount", 4, "Max player see by the monster before teleporting him into his room. No need to restart the game !"); CreateIntConfig(maxSeePlayerCount); timeBetweenTeleport = ((BaseUnityPlugin)this).Config.Bind<float>("Behavior", "timeBetweenTeleport", 20f, "Time to wait before teleport to another place after the thing see a player. No need to restart the game !"); CreateFloatConfig(timeBetweenTeleport); minDistanceBetweenPlayerToTeleport = ((BaseUnityPlugin)this).Config.Bind<float>("Behavior", "minDistanceBetweenPlayerToTeleport", 45f, "Minimum distance to have with any player to teleport somewhere to wait. No need to restart the game !"); CreateFloatConfig(minDistanceBetweenPlayerToTeleport); monsterToHitToEscapeRoom = ((BaseUnityPlugin)this).Config.Bind<int>("Behavior", "MonsterToHitToEscapeRoom", 2, "Monsters to hit to escape the room. No need to restart the game !"); CreateIntConfig(monsterToHitToEscapeRoom); roomFogDistance = ((BaseUnityPlugin)this).Config.Bind<float>("RoomSettings", "roomFogDistance", 5f, "Thing room fog distance. No need to restart the game !"); CreateFloatConfig(roomFogDistance); TimeToEscapeRoom = ((BaseUnityPlugin)this).Config.Bind<float>("RoomSettings", "TimeToEscapeRoom", 90f, "Time to escape the room. No need to restart the game !"); CreateFloatConfig(TimeToEscapeRoom, 0f, 300f); roomPosY = ((BaseUnityPlugin)this).Config.Bind<float>("RoomSettings", "roomPosY", 550f, "Room Y position. No need to restart the game !"); CreateFloatConfig(roomPosY, 0f, 3000f); } private void RegisterMonster(AssetBundle bundle) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown EnemyType val = bundle.LoadAsset<EnemyType>("Assets/LethalCompany/Mods/ThingMonster/Thing.asset"); ((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val).name + " FOUND")); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val.enemyPrefab} prefab"); NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Utilities.FixMixerGroups(val.enemyPrefab); TerminalNode val2 = new TerminalNode(); val2.creatureName = "Thing"; val2.displayText = ""; TerminalKeyword val3 = new TerminalKeyword(); val3.word = "Thing"; RegisterUtil.RegisterEnemyWithConfig(spawnMoonRarity.Value, val, val2, val3, instance.enemyPower.Value, val.MaxCount); } private void LoadRoom(AssetBundle bundle) { GameObject val = (roomObject = bundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/ThingMonster/ThingRoom.prefab")); ((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val).name + " FOUND")); Utilities.FixMixerGroups(val); } public void InstantiateRoom() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) DestroyRoom(); actualRoomObjectInstantiated = Object.Instantiate<GameObject>(roomObject, Vector3.up * (0f - roomPosY.Value), Quaternion.identity); actualRoomObjectManager = actualRoomObjectInstantiated.GetComponent<ThingRoomManager>(); } public void DestroyRoom() { if ((Object)(object)actualRoomObjectInstantiated != (Object)null) { Object.Destroy((Object)(object)actualRoomObjectInstantiated); Object.Destroy((Object)(object)actualRoomObjectManager); actualRoomObjectManager = null; actualRoomObjectInstantiated = null; } } private void CreateFloatConfig(ConfigEntry<float> configEntry, float min = 0f, float max = 100f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown FloatSliderOptions val = new FloatSliderOptions(); ((BaseRangeOptions<float>)val).Min = min; ((BaseRangeOptions<float>)val).Max = max; ((BaseOptions)val).RequiresRestart = false; FloatSliderConfigItem val2 = new FloatSliderConfigItem(configEntry, val); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2); } private void CreateIntConfig(ConfigEntry<int> configEntry, int min = 0, int max = 100) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown IntSliderOptions val = new IntSliderOptions(); ((BaseRangeOptions<int>)val).Min = min; ((BaseRangeOptions<int>)val).Max = max; ((BaseOptions)val).RequiresRestart = false; IntSliderConfigItem val2 = new IntSliderConfigItem(configEntry, val); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2); } private void CreateStringConfig(ConfigEntry<string> configEntry, bool requireRestart = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown TextInputFieldConfigItem val = new TextInputFieldConfigItem(configEntry, new TextInputFieldOptions { RequiresRestart = requireRestart }); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val); } } public static class PluginInfo { public const string PLUGIN_GUID = "TheThing"; public const string PLUGIN_NAME = "TheThing"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace TheThing.Utils { public class RegisterUtil { public static void RegisterEnemyWithConfig(string configMoonRarity, EnemyType enemy, TerminalNode terminalNode, TerminalKeyword terminalKeyword, float powerLevel, int spawnCount) { enemy.MaxCount = spawnCount; enemy.PowerLevel = powerLevel; var (dictionary, dictionary2) = ConfigParsing(configMoonRarity); Enemies.RegisterEnemy(enemy, dictionary, dictionary2, terminalNode, terminalKeyword); } public static void RegisterScrapWithConfig(string configMoonRarity, Item scrap) { var (dictionary, dictionary2) = ConfigParsing(configMoonRarity); Items.RegisterScrap(scrap, dictionary, dictionary2); } public static void RegisterShopItemWithConfig(bool enabledScrap, Item item, TerminalNode terminalNode, int itemCost, string configMoonRarity) { Items.RegisterShopItem(item, (TerminalNode)null, (TerminalNode)null, terminalNode, itemCost); if (enabledScrap) { RegisterScrapWithConfig(configMoonRarity, item); } } public static (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>(); Dictionary<string, int> dictionary2 = new Dictionary<string, int>(); foreach (string item in from s in configMoonRarity.Split(',') select s.Trim()) { string[] array = item.Split(':'); if (array.Length != 2) { continue; } string text = array[0]; if (!int.TryParse(array[1], out var result)) { continue; } if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2)) { dictionary[result2] = result; continue; } string value = text + "Level"; if (Enum.TryParse<LevelTypes>(value, ignoreCase: true, out result2)) { dictionary[result2] = result; } else { dictionary2[text] = result; } } return (dictionary, dictionary2); } } } namespace TheThing.Scripts { public class EscapeRoomObject : MonoBehaviour, IHittable { private static readonly int Disapear = Animator.StringToHash("disappear"); public Animator animator; public AudioSource AudioSource; public AudioClip onHitSound; public int id; public ThingRoomManager thingRoomManager; private bool alreadyHit = false; public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if (alreadyHit) { return true; } animator.SetTrigger(Disapear); thingRoomManager.OnHitEscapeObject(id); alreadyHit = true; ((Behaviour)((Component)this).GetComponentInChildren<Light>()).enabled = false; AudioSource.PlayOneShot(onHitSound); return true; } } public class LightInformation { public Light Light; public Color color; public float intensity; public FlashlightItem flashlightItem; } [StaticNetcode] public class NetworkThing { public static ThingEnemyAI GetThingEnemyAI(ulong networkId) { List<ThingEnemyAI> list = Object.FindObjectsByType<ThingEnemyAI>((FindObjectsSortMode)0).ToList(); ThingEnemyAI thingEnemyAI = list.Find((ThingEnemyAI e) => ((NetworkBehaviour)e).NetworkObjectId == networkId); if ((Object)(object)thingEnemyAI == (Object)null) { Debug.LogError((object)$"ROLLER BALL NOT FOUND {networkId}"); return null; } return thingEnemyAI; } [ServerRpc] public static void SetPlayerIdServerRpc(ulong networkId, ulong playerId) { SetPlayerIdClientRpc(networkId, playerId); } [ClientRpc] public static void SetPlayerIdClientRpc(ulong networkId, ulong playerId) { ThingEnemyAI thingEnemyAI = GetThingEnemyAI(networkId); if (Object.op_Implicit((Object)(object)thingEnemyAI)) { thingEnemyAI.OnSetPlayerId(playerId); } } [ServerRpc] public static void EnableEscapeObjectServerRpc(int id) { EnableEscapeObjectClientRpc(id); } [ClientRpc] public static void EnableEscapeObjectClientRpc(int id) { TheThingPlugin.instance.actualRoomObjectManager.EnableEscapeObject(id); } [ServerRpc] public static void EscapeRoomServerRpc() { EscapeRoomClientRpc(); } [ClientRpc] public static void EscapeRoomClientRpc() { ((MonoBehaviour)TheThingPlugin.instance.actualRoomObjectManager).StartCoroutine(TheThingPlugin.instance.actualRoomObjectManager.OnEscaped()); } } public class ThingEnemyAI : EnemyAI { [CompilerGenerated] private sealed class <DestroyRoom>d__35 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ThingEnemyAI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DestroyRoom>d__35(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; case 1: <>1__state = -1; TheThingPlugin.instance.DestroyRoom(); 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 <DropItemsAndTeleportPlayer>d__33 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ThingEnemyAI <>4__this; private Transform <playerTransform>5__1; private PlayerControllerB <player>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DropItemsAndTeleportPlayer>d__33(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <playerTransform>5__1 = null; <player>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (((EnemyAI)<>4__this).targetPlayer.playerClientId == GameNetworkManager.Instance.localPlayerController.playerClientId) { <>4__this.playerToKillIsLocal = true; } <playerTransform>5__1 = ((Component)GameNetworkManager.Instance.localPlayerController).transform; if (<>4__this.playerToKillIsLocal) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; Vector3 position = <playerTransform>5__1.position; Vector3 position2 = <playerTransform>5__1.position; Quaternion rotation = <playerTransform>5__1.rotation; localPlayerController.DropAllHeldItemsAndSync(position, position2, ((Quaternion)(ref rotation)).eulerAngles, GameNetworkManager.Instance.localPlayerController.cameraContainerTransform.position, GameNetworkManager.Instance.localPlayerController.cameraContainerTransform.eulerAngles); } <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 1; return true; case 1: <>1__state = -1; ((Component)((EnemyAI)<>4__this).targetPlayer).transform.position = TheThingPlugin.instance.actualRoomObjectInstantiated.transform.position + new Vector3(1f, 1f, 0f); if (<>4__this.playerToKillIsLocal) { <player>5__2 = GameNetworkManager.Instance.localPlayerController; ((Component)<player>5__2).transform.position = TheThingPlugin.instance.actualRoomObjectInstantiated.transform.position + new Vector3(1f, 1f, 0f); <player>5__2 = null; } 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 <JumpScareAnimation>d__34 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ThingEnemyAI <>4__this; private Vector3 <pos>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <JumpScareAnimation>d__34(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_005a: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; case 1: <>1__state = -1; if (<>4__this.playerToKillIsLocal) { GameNetworkManager.Instance.localPlayerController.KillPlayer(Vector3.zero, true, (CauseOfDeath)8, 0, default(Vector3), false); <>4__this.CancelPlayerEffects(); } ((EnemyAI)<>4__this).targetPlayer = null; <>4__this.playerToKillIsLocal = false; <>4__this.playerToKIll = null; <>4__this._teleportTimer = <>4__this._timeBetweenTeleport; if (((NetworkBehaviour)<>4__this).IsOwner) { <pos>5__1 = <>4__this.GetRandomNodeObjectPos(); ((Component)<>4__this).transform.position = <pos>5__1; ((EnemyAI)<>4__this).SwitchToBehaviourState(0); } ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DestroyRoom()); 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 static readonly int Idle = Animator.StringToHash("idle"); private static readonly int Jumpscare = Animator.StringToHash("jumpscare"); public GameObject headObject; public GameObject modelObject; public Light redLight; public AudioClip seePlayerSound; public AudioClip scaryAmbiantSound; public AudioClip JumpscareSound; public float aiInterval; public int lastBehaviorState; public ulong lastPlayerIdToKill; private PlayerControllerB playerToKIll = null; private List<LightInformation> lights = new List<LightInformation>(); public bool playerToKillIsLocal; private Vector3 positionJumpScare; private bool _isActive; private bool _shouldResetLights; private bool _shouldTpToPlayer; private int _sawPlayerCount; private float _lightAnimationDuration = 3f; private float _lightAnimationTimer; private int _lastNodeIndex; private float _timeBetweenTeleport = 10f; private float _teleportTimer; private float _notSeePlayerTimer; private float _changePositionSeePlayerDuration = 45f; public override void Start() { ((EnemyAI)this).Start(); AllClientOnSwitchBehaviorState(); ActivateMonster(active: false); base.agent.speed = 0f; base.debugEnemyAI = true; _timeBetweenTeleport = TheThingPlugin.instance.timeBetweenTeleport.Value; } public override void OnSyncPositionFromServer(Vector3 pos) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = pos; } public override void Update() { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) aiInterval -= Time.deltaTime; _lightAnimationTimer -= Time.deltaTime; _teleportTimer -= Time.deltaTime; if (base.currentBehaviourStateIndex == 1) { _notSeePlayerTimer -= Time.deltaTime; } if (lastBehaviorState != base.currentBehaviourStateIndex) { lastBehaviorState = base.currentBehaviourStateIndex; AllClientOnSwitchBehaviorState(); } if (base.currentBehaviourStateIndex == 2 && GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 0.25f, 100f, 60, -1f, -1)) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.8f, true); } if (_lightAnimationTimer < -0.5f && _shouldResetLights) { ResetLights(); _shouldResetLights = false; } if (aiInterval <= 0f && ((NetworkBehaviour)this).IsOwner) { aiInterval = base.AIIntervalTime; ((EnemyAI)this).DoAIInterval(); } } private void LateUpdate() { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) if (base.currentBehaviourStateIndex == 2 && _lightAnimationTimer > -0.5f) { lights.ForEach(delegate(LightInformation l) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_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) float num = Math.Clamp(_lightAnimationTimer, 0f, _lightAnimationDuration) / _lightAnimationDuration; if (num < 0.2f) { num = 0f; } l.Light.intensity = num * l.intensity; if (Object.op_Implicit((Object)(object)l.flashlightItem)) { l.flashlightItem.flashlightBulb.color = l.color * num; l.flashlightItem.flashlightBulbGlow.color = l.color * num; } }); } if (base.currentBehaviourStateIndex == 1 && !Object.op_Implicit((Object)(object)base.targetPlayer)) { PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false); if (Object.op_Implicit((Object)(object)closestPlayer)) { ((Component)this).transform.LookAt(((Component)closestPlayer.gameplayCamera).transform); ((Component)this).transform.eulerAngles = new Vector3(0f, ((Component)this).transform.eulerAngles.y, 0f); } } if (base.currentBehaviourStateIndex == 4 && Object.op_Implicit((Object)(object)base.targetPlayer)) { if (playerToKillIsLocal) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; ((Component)localPlayerController.gameplayCamera).transform.eulerAngles = new Vector3(0f, ((Component)localPlayerController.gameplayCamera).transform.eulerAngles.y, ((Component)localPlayerController.gameplayCamera).transform.eulerAngles.z); } positionJumpScare = ((Component)base.targetPlayer.gameplayCamera).transform.position + ((Component)base.targetPlayer.gameplayCamera).transform.forward * 1.4f; ((Component)this).transform.position = positionJumpScare - Vector3.up * 2.5f; ((Component)this).transform.LookAt(((Component)base.targetPlayer.gameplayCamera).transform); ((Component)this).transform.eulerAngles = new Vector3(0f, ((Component)this).transform.eulerAngles.y, 0f); } } public override void DoAIInterval() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).SyncPositionToClients(); switch (base.currentBehaviourStateIndex) { case 0: if (!_isActive && _teleportTimer < 0f) { Vector3 randomNodeObjectPos = GetRandomNodeObjectPos(); if (CheckIfPlayerAreInRange(randomNodeObjectPos)) { _notSeePlayerTimer = _changePositionSeePlayerDuration; ((Component)this).transform.position = randomNodeObjectPos; ((EnemyAI)this).SyncPositionToClients(); ((EnemyAI)this).SwitchToBehaviourState(1); } } break; case 1: ((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f, false, false, true); if (_notSeePlayerTimer < 0f) { ((EnemyAI)this).SwitchToBehaviourState(0); } if (!((Object)(object)base.targetPlayer == (Object)null) && ((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false, true)) { NetworkThing.SetPlayerIdServerRpc(((NetworkBehaviour)this).NetworkObjectId, base.targetPlayer.actualClientId); _sawPlayerCount++; _teleportTimer = _timeBetweenTeleport; ((EnemyAI)this).SwitchToBehaviourState(2); } break; case 2: if (_lightAnimationTimer <= 0.5f) { ((EnemyAI)this).SwitchToBehaviourState((_sawPlayerCount >= TheThingPlugin.instance.maxSeePlayerCount.Value) ? 3 : 0); } break; case 3: break; case 4: break; } } public void AllClientOnSwitchBehaviorState() { //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_01b4: Unknown result type (might be due to invalid IL or missing references) base.creatureAnimator.SetBool(Jumpscare, false); ((Behaviour)redLight).enabled = false; ((Behaviour)base.agent).enabled = base.currentBehaviourStateIndex != 4; switch (base.currentBehaviourStateIndex) { case 0: base.targetPlayer = null; ActivateMonster(active: false); _shouldTpToPlayer = false; break; case 1: ActivateMonster(active: true); base.creatureAnimator.SetBool(Idle, true); break; case 2: base.creatureSFX.PlayOneShot(seePlayerSound); _lightAnimationTimer = _lightAnimationDuration; _shouldResetLights = true; GetLightsClose(); break; case 3: ActivateMonster(active: false); TheThingPlugin.instance.InstantiateRoom(); TheThingPlugin.instance.actualRoomObjectManager.ThingEnemyAI = this; SpawnShovel(); if (Object.op_Implicit((Object)(object)base.targetPlayer)) { ((MonoBehaviour)this).StartCoroutine(DropItemsAndTeleportPlayer()); } TheThingPlugin.instance.actualRoomObjectManager.OnPlayerSpawnIntoRoom(); break; case 4: _sawPlayerCount = 0; ActivateMonster(active: true); ((Behaviour)redLight).enabled = true; ((MonoBehaviour)this).StartCoroutine(JumpScareAnimation()); base.creatureAnimator.SetBool(Jumpscare, true); base.creatureSFX.PlayOneShot(JumpscareSound); positionJumpScare = ((Component)base.targetPlayer.gameplayCamera).transform.position + ((Component)base.targetPlayer.gameplayCamera).transform.forward * 1.4f; if (playerToKillIsLocal) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; localPlayerController.JumpToFearLevel(0.9f, true); localPlayerController.disableMoveInput = true; localPlayerController.disableLookInput = true; localPlayerController.disableInteract = true; } break; } } public void OnSetPlayerId(ulong playerId) { lastPlayerIdToKill = playerId; base.targetPlayer = StartOfRound.Instance.allPlayerScripts.ToList().Find((PlayerControllerB p) => p.actualClientId == playerId); } [IteratorStateMachine(typeof(<DropItemsAndTeleportPlayer>d__33))] private IEnumerator DropItemsAndTeleportPlayer() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DropItemsAndTeleportPlayer>d__33(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<JumpScareAnimation>d__34))] private IEnumerator JumpScareAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <JumpScareAnimation>d__34(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<DestroyRoom>d__35))] private IEnumerator DestroyRoom() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DestroyRoom>d__35(0) { <>4__this = this }; } public void MonsterAttackPlayer() { Debug.Log((object)"MONSTER ATTACK"); if (Object.op_Implicit((Object)(object)base.targetPlayer) && base.targetPlayer.isPlayerDead) { ((EnemyAI)this).SwitchToBehaviourState(0); } _shouldTpToPlayer = true; ((EnemyAI)this).SwitchToBehaviourServerRpc(4); } public void CancelMonsterAttack() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) _sawPlayerCount = 0; if (playerToKillIsLocal) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; ((Component)localPlayerController).transform.position = StartOfRound.Instance.insideShipPositions[0].position; } base.targetPlayer = null; playerToKillIsLocal = false; playerToKIll = null; _teleportTimer = _timeBetweenTeleport; if (((NetworkBehaviour)this).IsOwner) { Vector3 randomNodeObjectPos = GetRandomNodeObjectPos(); ((Component)this).transform.position = randomNodeObjectPos; ((EnemyAI)this).SwitchToBehaviourState(0); } try { ((MonoBehaviour)this).StartCoroutine(DestroyRoom()); ((MonoBehaviour)this).StopCoroutine(JumpScareAnimation()); } catch { } } private void CancelPlayerEffects() { if (playerToKillIsLocal) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; localPlayerController.disableMoveInput = false; localPlayerController.disableLookInput = false; localPlayerController.disableInteract = false; } } private void ActivateMonster(bool active) { _isActive = active; modelObject.SetActive(active); } private Vector3 GetRandomNodeObjectPos() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (base.allAINodes.Length != 0) { int num; for (num = Random.Range(0, base.allAINodes.Length); num == _lastNodeIndex; num = Random.Range(0, base.allAINodes.Length)) { } lastBehaviorState = num; return base.allAINodes[num].transform.position; } return ((Component)this).transform.position; } private bool CheckIfPlayerAreInRange(Vector3 position) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) bool result = true; StartOfRound.Instance.allPlayerScripts.ToList().ForEach(delegate(PlayerControllerB p) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((Component)p.gameplayCamera).transform.position, position) < TheThingPlugin.instance.minDistanceBetweenPlayerToTeleport.Value) { result = false; } }); return result; } private void ResetLights() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) foreach (LightInformation light in lights) { if (Object.op_Implicit((Object)(object)light.Light)) { light.Light.intensity = light.intensity; } if (Object.op_Implicit((Object)(object)light.flashlightItem)) { light.Light.color = light.color; } } } private void GetLightsClose() { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) lights.Clear(); List<Light> list = Object.FindObjectsByType<Light>((FindObjectsInactive)1, (FindObjectsSortMode)0).ToList().FindAll((Light light) => Vector3.Distance(((Component)light).transform.position, ((Component)this).transform.position) < 30f && Object.op_Implicit((Object)(object)light)); foreach (Light item in list) { if (!((Object)(object)((Component)item).GetComponentInParent<animatedSun>() != (Object)null) && !(((Object)item).name == "NightVision") && !((Object)item).name.Contains("Spot Light") && !((Object)item).name.Contains("RedLight") && !((Object)item).name.Contains("RadarCamNightVision")) { FlashlightItem componentInParent = ((Component)item).GetComponentInParent<FlashlightItem>(); LightInformation lightInformation = new LightInformation(); lightInformation.Light = item; lightInformation.color = item.color; lightInformation.intensity = item.intensity; lightInformation.flashlightItem = componentInParent; lights.Add(lightInformation); } } } public void SpawnShovel() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer) { return; } GameObject shovel = null; ((NetworkBehaviour)this).NetworkManager.NetworkConfig.Prefabs.NetworkPrefabsLists?.ForEach(delegate(NetworkPrefabsList list) { list.PrefabList?.ToList().ForEach(delegate(NetworkPrefab prefab) { GrabbableObject component = prefab.Prefab.GetComponent<GrabbableObject>(); if ((Object)(object)component != (Object)null && component.itemProperties.itemName == "Shovel") { shovel = prefab.Prefab; } }); }); GameObject val = Object.Instantiate<GameObject>(shovel, TheThingPlugin.instance.actualRoomObjectInstantiated.transform); val.transform.localPosition = TheThingPlugin.instance.actualRoomObjectManager.shovelPosition; val.GetComponent<NetworkObject>().Spawn(false); } public override void OnCollideWithPlayer(Collider other) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && component.actualClientId == GameNetworkManager.Instance.localPlayerController.actualClientId) { base.targetPlayer = GameNetworkManager.Instance.localPlayerController; playerToKillIsLocal = true; NetworkThing.SetPlayerIdServerRpc(((NetworkBehaviour)this).NetworkObjectId, base.targetPlayer.actualClientId); MonsterAttackPlayer(); } } } public class ThingRoomManager : MonoBehaviour { [CompilerGenerated] private sealed class <>c__DisplayClass21_0 { public List<LightInformation> lightsAnimated; internal void <LightAnimation>b__0(LightInformation l) { if (Random.Range(0, 3) == 0) { lightsAnimated.Add(l); } } } [CompilerGenerated] private sealed class <LightAnimation>d__21 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ThingRoomManager <>4__this; private <>c__DisplayClass21_0 <>8__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LightAnimation>d__21(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Expected O, but got Unknown //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass21_0(); if (<>4__this.lights.Count <= 0 || !Object.op_Implicit((Object)(object)<>4__this.lights?[0].Light)) { <>2__current = null; <>1__state = 1; return true; } goto IL_00b3; case 1: <>1__state = -1; goto IL_00b3; case 2: <>1__state = -1; <>4__this.LightsManagement(active: true, <>8__1.lightsAnimated); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 3; return true; case 3: <>1__state = -1; <>4__this.LightsManagement(active: false, <>8__1.lightsAnimated); <>2__current = (object)new WaitForSeconds(0.8f); <>1__state = 4; return true; case 4: <>1__state = -1; <>4__this.LightsManagement(active: true, <>8__1.lightsAnimated); <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 5; return true; case 5: <>1__state = -1; <>4__this.LightsManagement(active: false, <>8__1.lightsAnimated); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 6; return true; case 6: { <>1__state = -1; <>4__this.LightsManagement(active: true, <>8__1.lightsAnimated); return false; } IL_00b3: <>8__1.lightsAnimated = new List<LightInformation>(); <>4__this.lights.ForEach(delegate(LightInformation l) { if (Random.Range(0, 3) == 0) { <>8__1.lightsAnimated.Add(l); } }); <>4__this.LightsManagement(active: false, <>8__1.lightsAnimated); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; 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 <OnEscaped>d__27 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ThingRoomManager <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnEscaped>d__27(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this._hasEscaped = true; ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.LightAnimation()); ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.OnScaryAmbientRunned()); <>4__this.LightsManagement(active: false, <>4__this.lights); <>4__this.ambientSource.PlayOneShot(<>4__this.welcomeSound); <>2__current = (object)new WaitForSeconds(4f); <>1__state = 1; return true; case 1: <>1__state = -1; if (Object.op_Implicit((Object)(object)<>4__this.ThingEnemyAI)) { <>4__this.ThingEnemyAI.CancelMonsterAttack(); } 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 <OnScaryAmbientRunned>d__20 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ThingRoomManager <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnScaryAmbientRunned>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(22f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.GetAllLights(); <>4__this.LightsManagement(active: false, <>4__this.lights); <>4__this.DisableEveryEscapeObject(); <>4__this.ambientSource.PlayOneShot(<>4__this.welcomeSound); if (Object.op_Implicit((Object)(object)<>4__this.ThingEnemyAI) && <>4__this.ThingEnemyAI.playerToKillIsLocal) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.8f, true); } <>2__current = (object)new WaitForSeconds(4f); <>1__state = 2; return true; case 2: <>1__state = -1; if (Object.op_Implicit((Object)(object)<>4__this.ThingEnemyAI)) { <>4__this.ThingEnemyAI.MonsterAttackPlayer(); } <>4__this.lights.Clear(); ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.LightAnimation()); 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(); } } public AudioSource ambientSource; public AudioClip welcomeSound; public AudioClip scaryAmbientSound; public Vector3 shovelPosition; public List<LightInformation> lights = new List<LightInformation>(); public List<EscapeRoomObject> EscapeRoomObjects = new List<EscapeRoomObject>(); public List<int> escapeRoomNumbersHit = new List<int>(); public LocalVolumetricFog localVolumetricFog; public ThingEnemyAI ThingEnemyAI; private LightInformation _playerNightVision; private float _lightAnimationsTimer; private float _scaryAmbientAnimationTimer = 90f; private bool _scarySoundPlayed; private bool _hasEscaped; private int escapeObjectToHit = 2; private int escapeObjectHitCount; public void Start() { _scaryAmbientAnimationTimer = TheThingPlugin.instance.TimeToEscapeRoom.Value - 22f; escapeObjectToHit = TheThingPlugin.instance.monsterToHitToEscapeRoom.Value; localVolumetricFog.parameters.meanFreePath = TheThingPlugin.instance.roomFogDistance.Value; } public void OnPlayerSpawnIntoRoom() { ambientSource.PlayOneShot(welcomeSound); GetAllLights(); DisableEveryEscapeObject(); EnableRandomEscapeObject(0); } public void DisableEveryEscapeObject() { int i = 0; EscapeRoomObjects.ForEach(delegate(EscapeRoomObject o) { o.id = i; i++; ((Component)o).gameObject.SetActive(false); }); } public void Update() { _lightAnimationsTimer -= Time.deltaTime; _scaryAmbientAnimationTimer -= Time.deltaTime; if (_lightAnimationsTimer < 0f && _scaryAmbientAnimationTimer >= 0f) { _lightAnimationsTimer = Random.Range(4, 7); ((MonoBehaviour)this).StartCoroutine(LightAnimation()); } if (_scaryAmbientAnimationTimer < 0f && !_scarySoundPlayed && escapeObjectHitCount < escapeObjectToHit) { _scarySoundPlayed = true; ambientSource.PlayOneShot(scaryAmbientSound); ((MonoBehaviour)this).StartCoroutine(OnScaryAmbientRunned()); } if (Object.op_Implicit((Object)(object)ThingEnemyAI) && ThingEnemyAI.playerToKillIsLocal && GameNetworkManager.Instance.localPlayerController.isPlayerDead && !_hasEscaped) { _hasEscaped = true; NetworkThing.EscapeRoomServerRpc(); } } [IteratorStateMachine(typeof(<OnScaryAmbientRunned>d__20))] private IEnumerator OnScaryAmbientRunned() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnScaryAmbientRunned>d__20(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<LightAnimation>d__21))] private IEnumerator LightAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LightAnimation>d__21(0) { <>4__this = this }; } public Color GetRandomRedColor() { //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_0027: Unknown result type (might be due to invalid IL or missing references) return new Color(Random.Range(0.3f, 0.75f), 0f, 0f, 1f); } public void LightsManagement(bool active, List<LightInformation> lightsInfos) { lightsInfos.ForEach(delegate(LightInformation l) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)l.Light != (Object)null) { l.Light.color = (active ? GetRandomRedColor() : Color.black); } }); } public void GetAllLights() { //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) lights.Clear(); List<Light> list = Object.FindObjectsByType<Light>((FindObjectsInactive)1, (FindObjectsSortMode)0).ToList().FindAll((Light light) => Vector3.Distance(((Component)light).transform.position, ((Component)this).transform.position) < 150f && Vector3.Distance(new Vector3(0f, ((Component)light).transform.position.y, 0f), new Vector3(0f, ((Component)this).transform.position.y, 0f)) < 25f && Object.op_Implicit((Object)(object)light)); foreach (Light item in list) { if (!((Object)(object)((Component)item).GetComponentInParent<animatedSun>() != (Object)null) && !(((Object)((Component)item).transform.parent).name == "HelmetLights") && !((Object)(object)item == (Object)(object)ThingEnemyAI.redLight) && !((Object)((Component)item).transform.parent).name.Contains("EscapeObject") && !((Object)item).name.Contains("Spot Light") && !((Object)item).name.Contains("RedLight") && !((Object)item).name.Contains("RadarCamNightVision") && !((Object)item).name.Contains("Near") && !((Object)item).name.Contains("VisorCamera") && !((Object)item).name.Contains("MainCamera")) { FlashlightItem componentInParent = ((Component)item).GetComponentInParent<FlashlightItem>(); LightInformation lightInformation = new LightInformation(); lightInformation.Light = item; lightInformation.color = item.color; lightInformation.intensity = item.intensity; lightInformation.flashlightItem = componentInParent; if (((Object)item).name == "NightVision") { _playerNightVision = lightInformation; } else { lights.Add(lightInformation); } } } } public void EnableRandomEscapeObject(int notId) { if (ThingEnemyAI.playerToKillIsLocal) { int num = Random.Range(0, EscapeRoomObjects.Count); while (num == notId || escapeRoomNumbersHit.Contains(num)) { num = Random.Range(0, EscapeRoomObjects.Count); } NetworkThing.EnableEscapeObjectServerRpc(num); escapeRoomNumbersHit.Add(num); } } public void EnableEscapeObject(int id) { ((Component)EscapeRoomObjects[id]).gameObject.SetActive(true); } [IteratorStateMachine(typeof(<OnEscaped>d__27))] public IEnumerator OnEscaped() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnEscaped>d__27(0) { <>4__this = this }; } public void OnHitEscapeObject(int id) { escapeObjectHitCount++; if (escapeObjectHitCount == escapeObjectToHit) { NetworkThing.EscapeRoomServerRpc(); } else { EnableRandomEscapeObject(id); } } } }