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 Empress Backrooms v1.0.1
BepInEx\plugins\Empress-Backrooms\EmpressBackrooms.dll
Decompiled a week 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.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using REPOLib.Modules; using REPOLib.Objects.Sdk; using TMPro; using Unity.AI.Navigation; using UnityEngine; using UnityEngine.AI; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Empress")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EmpressBackrooms")] [assembly: AssemblyTitle("EmpressBackrooms")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 Empress.REPO.Backrooms { internal static class BackroomsAccess { private delegate void ModuleSetAllChecklistDelegate(Module module); private delegate void LevelGeneratorGenerateDoneDelegate(LevelGenerator instance, PhotonMessageInfo info); private static readonly FieldInfo EnvironmentSetupDoneField = AccessTools.Field(typeof(EnvironmentDirector), "SetupDone"); private static readonly FieldInfo EnvironmentMainCameraField = AccessTools.Field(typeof(EnvironmentDirector), "MainCamera"); private static readonly FieldInfo EnvironmentAmbientColorField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColor"); private static readonly FieldInfo EnvironmentAmbientColorNewField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorNew"); private static readonly FieldInfo EnvironmentAmbientColorPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorPrevious"); private static readonly FieldInfo EnvironmentAmbientColorAdaptationField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptation"); private static readonly FieldInfo EnvironmentAmbientColorAdaptationNewField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptationNew"); private static readonly FieldInfo EnvironmentAmbientColorAdaptationPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptationPrevious"); private static readonly FieldInfo EnvironmentDarkAdaptationLerpField = AccessTools.Field(typeof(EnvironmentDirector), "DarkAdaptationLerp"); private static readonly FieldInfo EnvironmentFogColorField = AccessTools.Field(typeof(EnvironmentDirector), "FogColor"); private static readonly FieldInfo EnvironmentFogColorNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogColorNew"); private static readonly FieldInfo EnvironmentFogColorPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogColorPrevious"); private static readonly FieldInfo EnvironmentFogStartDistanceField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistance"); private static readonly FieldInfo EnvironmentFogStartDistanceNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistanceNew"); private static readonly FieldInfo EnvironmentFogStartDistancePreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistancePrevious"); private static readonly FieldInfo EnvironmentFogEndDistanceField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistance"); private static readonly FieldInfo EnvironmentFogEndDistanceNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistanceNew"); private static readonly FieldInfo EnvironmentFogEndDistancePreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistancePrevious"); private static readonly FieldInfo LevelGeneratorAllPlayersReadyField = AccessTools.Field(typeof(LevelGenerator), "AllPlayersReady"); private static readonly FieldInfo LevelGeneratorEnemyReadyField = AccessTools.Field(typeof(LevelGenerator), "EnemyReady"); private static readonly FieldInfo LevelGeneratorModulesSpawnedField = AccessTools.Field(typeof(LevelGenerator), "ModulesSpawned"); private static readonly FieldInfo LevelGeneratorPlayerSpawnedField = AccessTools.Field(typeof(LevelGenerator), "playerSpawned"); private static readonly FieldInfo RunManagerLevelPreviousField = AccessTools.Field(typeof(RunManager), "levelPrevious"); private static readonly FieldInfo PlayerAvatarIsDisabledField = AccessTools.Field(typeof(PlayerAvatar), "isDisabled"); private static readonly FieldInfo PlayerAvatarDeadSetField = AccessTools.Field(typeof(PlayerAvatar), "deadSet"); private static readonly FieldInfo PlayerAvatarTumbleField = AccessTools.Field(typeof(PlayerAvatar), "tumble"); private static readonly FieldInfo RoundDirectorExtractionPointsField = AccessTools.Field(typeof(RoundDirector), "extractionPoints"); private static readonly FieldInfo RoundDirectorExtractionPointsCompletedField = AccessTools.Field(typeof(RoundDirector), "extractionPointsCompleted"); private static readonly FieldInfo RoundDirectorExtractionPointListField = AccessTools.Field(typeof(RoundDirector), "extractionPointList"); private static readonly FieldInfo RoundDirectorHaulGoalField = AccessTools.Field(typeof(RoundDirector), "haulGoal"); private static readonly FieldInfo RoundDirectorHaulGoalMaxField = AccessTools.Field(typeof(RoundDirector), "haulGoalMax"); private static readonly FieldInfo RoundDirectorExtractionPointActiveField = AccessTools.Field(typeof(RoundDirector), "extractionPointActive"); private static readonly FieldInfo RoundDirectorAllExtractionCompletedField = AccessTools.Field(typeof(RoundDirector), "allExtractionPointsCompleted"); private static readonly FieldInfo ValuableDirectorTargetAmountField = AccessTools.Field(typeof(ValuableDirector), "valuableTargetAmount"); private static readonly FieldInfo ValuableDirectorTotalMaxValueField = AccessTools.Field(typeof(ValuableDirector), "totalMaxValue"); private static readonly FieldInfo LevelValuablesTinyField = AccessTools.Field(typeof(LevelValuables), "tiny"); private static readonly FieldInfo LevelValuablesSmallField = AccessTools.Field(typeof(LevelValuables), "small"); private static readonly FieldInfo LevelValuablesMediumField = AccessTools.Field(typeof(LevelValuables), "medium"); private static readonly FieldInfo LevelValuablesBigField = AccessTools.Field(typeof(LevelValuables), "big"); private static readonly FieldInfo LevelValuablesWideField = AccessTools.Field(typeof(LevelValuables), "wide"); private static readonly FieldInfo LevelValuablesTallField = AccessTools.Field(typeof(LevelValuables), "tall"); private static readonly FieldInfo LevelValuablesVeryTallField = AccessTools.Field(typeof(LevelValuables), "veryTall"); private static readonly FieldInfo LevelValuablePresetsField = AccessTools.Field(typeof(Level), "ValuablePresets"); private static readonly FieldInfo ModuleSetupDoneField = AccessTools.Field(typeof(Module), "SetupDone"); private static readonly FieldInfo ModuleStartRoomField = AccessTools.Field(typeof(Module), "StartRoom"); private static readonly FieldInfo ModuleGridXField = AccessTools.Field(typeof(Module), "GridX"); private static readonly FieldInfo ModuleGridYField = AccessTools.Field(typeof(Module), "GridY"); private static readonly FieldInfo ModuleFirstField = AccessTools.Field(typeof(Module), "First"); private static readonly FieldInfo LevelPointInStartRoomField = AccessTools.Field(typeof(LevelPoint), "inStartRoom"); private static readonly FieldInfo ItemAttributesHasIconField = AccessTools.Field(typeof(ItemAttributes), "hasIcon"); private static readonly MethodInfo ModuleSetAllChecklistMethod = AccessTools.Method(typeof(Module), "SetAllChecklist", (Type[])null, (Type[])null); private static readonly MethodInfo LevelGeneratorGenerateDoneMethod = AccessTools.Method(typeof(LevelGenerator), "GenerateDone", new Type[1] { typeof(PhotonMessageInfo) }, (Type[])null); private static readonly ModuleSetAllChecklistDelegate ModuleSetAllChecklistCall = CreateDelegate<ModuleSetAllChecklistDelegate>(ModuleSetAllChecklistMethod); private static readonly LevelGeneratorGenerateDoneDelegate LevelGeneratorGenerateDoneCall = CreateDelegate<LevelGeneratorGenerateDoneDelegate>(LevelGeneratorGenerateDoneMethod); public static void SetEnvironmentFog(EnvironmentDirector director, Color color, float startDistance, float endDistance) { //IL_0006: 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_0028: Unknown result type (might be due to invalid IL or missing references) SetField(EnvironmentFogColorField, director, color); SetField(EnvironmentFogColorNewField, director, color); SetField(EnvironmentFogColorPreviousField, director, color); SetField(EnvironmentFogStartDistanceField, director, startDistance); SetField(EnvironmentFogStartDistanceNewField, director, startDistance); SetField(EnvironmentFogStartDistancePreviousField, director, startDistance); SetField(EnvironmentFogEndDistanceField, director, endDistance); SetField(EnvironmentFogEndDistanceNewField, director, endDistance); SetField(EnvironmentFogEndDistancePreviousField, director, endDistance); } public static void SetEnvironmentAmbient(EnvironmentDirector director, Color ambient, Color adaptation) { //IL_0006: 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_0028: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) SetField(EnvironmentAmbientColorField, director, ambient); SetField(EnvironmentAmbientColorNewField, director, ambient); SetField(EnvironmentAmbientColorPreviousField, director, ambient); SetField(EnvironmentAmbientColorAdaptationField, director, adaptation); SetField(EnvironmentAmbientColorAdaptationNewField, director, adaptation); SetField(EnvironmentAmbientColorAdaptationPreviousField, director, adaptation); } public static void SetEnvironmentDarkAdaptation(EnvironmentDirector director, float value) { SetField(EnvironmentDarkAdaptationLerpField, director, value); } public static Camera GetEnvironmentMainCamera(EnvironmentDirector director) { return Get<Camera>(EnvironmentMainCameraField, director); } public static void SetEnvironmentMainCamera(EnvironmentDirector director, Camera camera) { SetField(EnvironmentMainCameraField, director, camera); } public static void SetEnvironmentSetupDone(EnvironmentDirector director, bool value) { SetField(EnvironmentSetupDoneField, director, value); } public static void SetAllPlayersReady(LevelGenerator generator, bool value) { SetField(LevelGeneratorAllPlayersReadyField, generator, value); } public static bool GetAllPlayersReady(LevelGenerator generator) { return GetBool(LevelGeneratorAllPlayersReadyField, generator); } public static void SetEnemyReady(LevelGenerator generator, bool value) { SetField(LevelGeneratorEnemyReadyField, generator, value); } public static void SetModulesSpawned(LevelGenerator generator, int value) { SetField(LevelGeneratorModulesSpawnedField, generator, value); } public static void SetPlayerSpawnedCount(LevelGenerator generator, int value) { SetField(LevelGeneratorPlayerSpawnedField, generator, value); } public static int GetPlayerSpawnedCount(LevelGenerator generator) { return GetInt(LevelGeneratorPlayerSpawnedField, generator); } public static void SetLevelPrevious(RunManager manager, Level level) { SetField(RunManagerLevelPreviousField, manager, level); } public static bool GetIsDisabled(PlayerAvatar avatar) { return GetBool(PlayerAvatarIsDisabledField, avatar); } public static bool GetDeadSet(PlayerAvatar avatar) { return GetBool(PlayerAvatarDeadSetField, avatar); } public static PlayerTumble GetPlayerTumble(PlayerAvatar avatar) { return Get<PlayerTumble>(PlayerAvatarTumbleField, avatar); } public static int GetValuableTargetAmount(ValuableDirector director) { return GetInt(ValuableDirectorTargetAmountField, director); } public static float GetValuableTotalMaxValue(ValuableDirector director) { if (ValuableDirectorTotalMaxValueField == null || (Object)(object)director == (Object)null) { return 0f; } object value = ValuableDirectorTotalMaxValueField.GetValue(director); if (value is float) { return (float)value; } return 0f; } public static int GetHaulGoal(RoundDirector director) { return GetInt(RoundDirectorHaulGoalField, director); } public static int GetHaulGoalMax(RoundDirector director) { return GetInt(RoundDirectorHaulGoalMaxField, director); } public static void SetHaulGoal(RoundDirector director, int value) { SetField(RoundDirectorHaulGoalField, director, value); } public static bool GetExtractionPointActive(RoundDirector director) { return GetBool(RoundDirectorExtractionPointActiveField, director); } public static bool GetAllExtractionPointsCompleted(RoundDirector director) { return GetBool(RoundDirectorAllExtractionCompletedField, director); } public static void ResetRoundExtraction(RoundDirector director) { SetField(RoundDirectorExtractionPointsField, director, 0); SetField(RoundDirectorExtractionPointsCompletedField, director, 0); Get<List<GameObject>>(RoundDirectorExtractionPointListField, director)?.Clear(); } public static List<LevelValuables> GetValuablePresets(Level level) { return Get<List<LevelValuables>>(LevelValuablePresetsField, level); } public static List<PrefabRef> GetValuableList(LevelValuables valuables, Type type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected I4, but got Unknown return Get<List<PrefabRef>>((int)type switch { 0 => LevelValuablesTinyField, 1 => LevelValuablesSmallField, 2 => LevelValuablesMediumField, 3 => LevelValuablesBigField, 4 => LevelValuablesWideField, 5 => LevelValuablesTallField, _ => LevelValuablesVeryTallField, }, valuables); } public static void SetValuablePresets(Level level, List<LevelValuables> presets) { SetField(LevelValuablePresetsField, level, presets); } public static bool PresetHasContent(LevelValuables preset) { if ((Object)(object)preset == (Object)null) { return false; } if (CountList(LevelValuablesTinyField, preset) <= 0 && CountList(LevelValuablesSmallField, preset) <= 0 && CountList(LevelValuablesMediumField, preset) <= 0 && CountList(LevelValuablesBigField, preset) <= 0 && CountList(LevelValuablesWideField, preset) <= 0 && CountList(LevelValuablesTallField, preset) <= 0) { return CountList(LevelValuablesVeryTallField, preset) > 0; } return true; } public static void ConfigureStartRoomModule(Module module, int gridX, int gridY) { ModuleSetAllChecklistCall?.Invoke(module); SetField(ModuleSetupDoneField, module, true); SetField(ModuleStartRoomField, module, true); SetField(ModuleFirstField, module, true); SetField(ModuleGridXField, module, gridX); SetField(ModuleGridYField, module, gridY); } public static void MarkLevelPointInStartRoom(LevelPoint point, bool value) { SetField(LevelPointInStartRoomField, point, value); } public static bool GetItemHasIcon(ItemAttributes attributes) { return GetBool(ItemAttributesHasIconField, attributes); } public static void GenerateDone(LevelGenerator generator) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) LevelGeneratorGenerateDoneCall?.Invoke(generator, default(PhotonMessageInfo)); } private static int CountList(FieldInfo field, object instance) { if (!(((field != null && instance != null) ? field.GetValue(instance) : null) is ICollection collection)) { return 0; } return collection.Count; } private static T Get<T>(FieldInfo field, object instance) where T : class { if (field == null || instance == null) { return null; } return field.GetValue(instance) as T; } private static bool GetBool(FieldInfo field, object instance) { if (field == null || instance == null) { return false; } object value = field.GetValue(instance); bool flag = default(bool); int num; if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } private static int GetInt(FieldInfo field, object instance) { if (field == null || instance == null) { return 0; } object value = field.GetValue(instance); if (value is int) { return (int)value; } return 0; } private static void SetField(FieldInfo field, object instance, object value) { if (!(field == null) && instance != null) { field.SetValue(instance, value); } } private static TDelegate CreateDelegate<TDelegate>(MethodInfo method) where TDelegate : Delegate { if (method == null) { return null; } return AccessTools.MethodDelegate<TDelegate>(method, (object)null, true); } } internal static class BackroomsAudio { private const int SampleRate = 44100; private static AudioClip _hum; private static AudioClip _growl; private static AudioClip _hit; private static AudioClip _death; private static AudioClip _shift; private static AudioClip _drip; private static AudioClip _sting; private static AudioClip _whisper; private static AudioClip _bang; private static AudioClip _buzz; private static AudioClip _footstep; private static AudioClip _scream; private static AudioClip _charge; private static bool _initialized; public static AudioClip HumClip => _hum; public static void Initialize() { if (!_initialized) { _initialized = true; _hum = BuildHum(); _growl = BuildGrowl(); _hit = BuildHit(); _death = BuildDeath(); _shift = BuildShift(); _drip = BuildDrip(); _sting = BuildSting(); _whisper = BuildWhisper(); _bang = BuildBang(); _buzz = BuildBuzz(); _footstep = BuildFootstep(); _scream = BuildScream(); _charge = BuildCharge(); } } public static void PlayGrowl(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_growl, position, 0.55f, 0.8f, 1.05f); } public static void PlayHit(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_hit, position, 0.7f, 0.9f, 1.1f); } public static void PlayDeath(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_death, position, 0.8f, 0.9f, 1.05f); } public static void PlayShift(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_shift, position, 0.9f, 0.98f, 1.02f); } public static void PlayDrip(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_drip, position, 0.4f, 0.85f, 1.2f); } public static void PlaySting(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_sting, position, 0.6f, 0.95f, 1.05f); } public static void PlayWhisper(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_whisper, position, 0.5f, 0.92f, 1.12f); } public static void PlayBang(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_bang, position, 0.85f, 0.85f, 1f); } public static void PlayBuzz(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_buzz, position, 0.5f, 0.9f, 1.15f); } public static void PlayFootstep(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_footstep, position, 0.45f, 0.9f, 1.1f); } public static void PlayScream(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_scream, position, 0.7f, 0.92f, 1.08f); } public static void PlayCharge(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Play(_charge, position, 1f, 0.95f, 1.05f); } private static void Play(AudioClip clip, Vector3 position, float volume, float pitchMin = 0.97f, float pitchMax = 1.03f) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown if (!((Object)(object)clip == (Object)null)) { float num = ((EmpressBackroomsPlugin.Settings != null) ? EmpressBackroomsPlugin.Settings.MasterVolume.Value : 0.85f); if (!(num <= 0f)) { GameObject val = new GameObject("Empress Backrooms Audio"); val.transform.position = position; AudioSource val2 = val.AddComponent<AudioSource>(); val2.clip = clip; val2.volume = Mathf.Clamp01(volume * num); val2.pitch = Random.Range(pitchMin, pitchMax); val2.spatialBlend = 1f; val2.rolloffMode = (AudioRolloffMode)1; val2.minDistance = 2f; val2.maxDistance = 32f; val2.dopplerLevel = 0f; val2.Play(); Object.Destroy((Object)val, clip.length / Mathf.Max(0.5f, val2.pitch) + 0.2f); } } } private static AudioClip MakeClip(string name, float[] data) { AudioClip obj = AudioClip.Create(name, data.Length, 1, 44100, false); obj.SetData(data, 0); return obj; } private static AudioClip BuildHum() { int num = 176400; int num2 = 13230; float[] array = new float[num + num2]; for (int i = 0; i < array.Length; i++) { float num3 = (float)i / 44100f; float num4 = Mathf.Sin(MathF.PI * 120f * num3) * 0.5f; float num5 = Mathf.Sin(MathF.PI * 240f * num3) * 0.28f; float num6 = Mathf.Sign(Mathf.Sin(MathF.PI * 240f * num3)) * 0.05f; float num7 = 0.85f + 0.15f * Mathf.PerlinNoise(num3 * 7f, 0f); array[i] = (num4 + num5 + num6) * 0.18f * num7; } float[] array2 = new float[num]; Array.Copy(array, array2, num); for (int j = 0; j < num2; j++) { float num8 = (float)j / (float)num2; array2[j] = array2[j] * num8 + array[num + j] * (1f - num8); } return MakeClip("EmpressBackroomsHum", array2); } private static AudioClip BuildGrowl() { int num = 57329; float[] array = new float[num]; float num2 = 0f; float num3 = Random.Range(0f, 40f); for (int i = 0; i < num; i++) { float num4 = (float)i / 44100f; float num5 = num4 / 1.3f; float num6 = 70f + 30f * Mathf.PerlinNoise(num3, num4 * 5f) - 20f * num5; num2 += MathF.PI * 2f * num6 / 44100f; float num7 = Mathf.Sin(num2) + 0.4f * Mathf.Sin(num2 * 2.5f); float num8 = (Mathf.PerlinNoise(num3 + 3f, num4 * 60f) - 0.5f) * 0.5f; float num9 = Mathf.Sin(num5 * MathF.PI); array[i] = Mathf.Clamp((num7 * 0.4f + num8) * num9, -1f, 1f) * 0.6f; } return MakeClip("EmpressBackroomsGrowl", array); } private static AudioClip BuildHit() { int num = 15435; float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = Mathf.Exp((0f - num2) / 0.06f); float num4 = Mathf.Sin(MathF.PI * 360f * num2); float num5 = (Random.value * 2f - 1f) * Mathf.Exp((0f - num2) / 0.03f); array[i] = Mathf.Clamp((num4 * 0.5f + num5 * 0.6f) * num3, -1f, 1f) * 0.7f; } return MakeClip("EmpressBackroomsHit", array); } private static AudioClip BuildDeath() { int num = 48510; float[] array = new float[num]; float num2 = 0f; for (int i = 0; i < num; i++) { float num3 = (float)i / 44100f; float num4 = num3 / 1.1f; float num5 = 220f * Mathf.Exp((0f - num4) * 2.2f) + 40f; num2 += MathF.PI * 2f * num5 / 44100f; float num6 = Mathf.Sin(num2) + 0.3f * Mathf.Sin(num2 * 3.1f); float num7 = (Mathf.PerlinNoise(7f, num3 * 40f) - 0.5f) * (1f - num4); float num8 = Mathf.Exp((0f - num4) * 2.5f); array[i] = Mathf.Clamp((num6 * 0.4f + num7) * num8, -1f, 1f) * 0.65f; } return MakeClip("EmpressBackroomsDeath", array); } private static AudioClip BuildShift() { int num = 105840; float[] array = new float[num]; float num2 = 0f; for (int i = 0; i < num; i++) { float num3 = (float)i / 44100f; float num4 = num3 / 2.4f; float num5 = 28f + 14f * Mathf.Sin(num4 * MathF.PI); num2 += MathF.PI * 2f * num5 / 44100f; float num6 = Mathf.Sin(num2); float num7 = (Mathf.PerlinNoise(2f, num3 * 3f) - 0.5f) * 0.4f; float num8 = Mathf.Sin(num4 * MathF.PI); array[i] = Mathf.Clamp((num6 * 0.7f + num7) * num8, -1f, 1f) * 0.7f; } return MakeClip("EmpressBackroomsShift", array); } private static AudioClip BuildDrip() { int num = 26460; float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = 150f + 360f * Mathf.Exp((0f - num2) / 0.018f); float num4 = Mathf.Exp((0f - num2) / 0.09f); float num5 = Mathf.Sin(MathF.PI * 2f * num3 * num2); float num6 = Mathf.Sin(MathF.PI * 392f * num2) * Mathf.Exp((0f - num2) / 0.16f) * 0.3f; array[i] = (num5 * num4 + num6) * 0.34f; } return MakeClip("EmpressBackroomsDrip", array); } private static AudioClip BuildSting() { int num = 52920; float[] array = new float[num]; float[] array2 = new float[4] { 196f, 207f, 233f, 311f }; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = num2 / 1.2f; float num4 = ((num3 < 0.2f) ? (num3 / 0.2f) : Mathf.Exp((0f - (num3 - 0.2f)) * 3f)); float num5 = 0f; for (int j = 0; j < array2.Length; j++) { num5 += Mathf.Sin(MathF.PI * 2f * array2[j] * num2 + (float)j); } array[i] = Mathf.Clamp(num5 * 0.18f * num4, -1f, 1f) * 0.6f; } return MakeClip("EmpressBackroomsSting", array); } private static AudioClip BuildWhisper() { int num = 70560; float[] array = new float[num]; float num2 = Random.Range(0f, 50f); float num3 = 0f; for (int i = 0; i < num; i++) { float num4 = (float)i / 44100f; float num5 = num4 / 1.6f; float num6 = Random.value * 2f - 1f; num3 = num3 * 0.82f + num6 * 0.18f; float num7 = 1f + 0.6f * Mathf.Sin(MathF.PI * 9f * num4 + num2); float num8 = (Random.value * 2f - 1f) * 0.3f * Mathf.PerlinNoise(num2, num4 * 24f); float num9 = Mathf.Clamp01(Mathf.PerlinNoise(num2 + 9f, num4 * 6f) * 1.6f - 0.3f); float num10 = Mathf.Sin(num5 * MathF.PI); array[i] = Mathf.Clamp((num3 * num7 + num8) * num9 * num10, -1f, 1f) * 0.5f; } return MakeClip("EmpressBackroomsWhisper", array); } private static AudioClip BuildBang() { int num = 61740; float[] array = new float[num]; float num2 = 0f; for (int i = 0; i < num; i++) { float num3 = (float)i / 44100f; float num4 = 90f * Mathf.Exp((0f - num3) / 0.08f) + 32f; num2 += MathF.PI * 2f * num4 / 44100f; float num5 = Mathf.Sin(num2); float num6 = (Random.value * 2f - 1f) * Mathf.Exp((0f - num3) / 0.012f); float num7 = Mathf.Sin(MathF.PI * 96f * num3) * Mathf.Exp((0f - num3) / 0.5f) * 0.25f; float num8 = Mathf.Exp((0f - num3) / 0.32f); array[i] = Mathf.Clamp((num5 * 0.7f + num6 * 0.5f) * num8 + num7, -1f, 1f) * 0.8f; } return MakeClip("EmpressBackroomsBang", array); } private static AudioClip BuildBuzz() { int num = 39690; float[] array = new float[num]; float num2 = Random.Range(0f, 30f); for (int i = 0; i < num; i++) { float num3 = (float)i / 44100f; float num4 = num3 / 0.9f; float num5 = Mathf.Sign(Mathf.Sin(MathF.PI * 240f * num3)); float num6 = Mathf.Sign(Mathf.Sin(MathF.PI * 720f * num3)) * 0.4f; float num7 = ((Mathf.PerlinNoise(num2, num3 * 90f) > 0.45f) ? 1f : 0.2f); float num8 = (Random.value * 2f - 1f) * 0.35f * ((Mathf.PerlinNoise(num2 + 5f, num3 * 200f) > 0.6f) ? 1f : 0f); float num9 = (1f - num4) * (0.6f + 0.4f * Mathf.Sin(MathF.PI * 26f * num3)); array[i] = Mathf.Clamp(((num5 + num6) * num7 * 0.3f + num8) * num9, -1f, 1f) * 0.5f; } return MakeClip("EmpressBackroomsBuzz", array); } private static AudioClip BuildFootstep() { int num = 13230; float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = Mathf.Sin(MathF.PI * 190f * num2) * Mathf.Exp((0f - num2) / 0.05f); float num4 = (Random.value * 2f - 1f) * Mathf.Exp((0f - num2) / 0.02f) * 0.4f; array[i] = Mathf.Clamp(num3 * 0.7f + num4, -1f, 1f) * 0.55f; } return MakeClip("EmpressBackroomsFootstep", array); } private static AudioClip BuildScream() { int num = 66150; float[] array = new float[num]; float num2 = 0f; float num3 = Random.Range(0f, 20f); for (int i = 0; i < num; i++) { float num4 = (float)i / 44100f; float num5 = num4 / 1.5f; float num6 = 1f + 0.06f * Mathf.Sin(MathF.PI * 13f * num4); float num7 = (300f + 240f * Mathf.Sin(num5 * MathF.PI * 0.7f)) * num6; num2 += MathF.PI * 2f * num7 / 44100f; float num8 = Mathf.Sin(num2) + 0.5f * Mathf.Sin(num2 * 2f) + 0.3f * Mathf.Sin(num2 * 3f); float num9 = (Mathf.PerlinNoise(num3, num4 * 70f) - 0.5f) * 0.4f; float num10 = ((num5 < 0.15f) ? (num5 / 0.15f) : Mathf.Exp((0f - (num5 - 0.15f)) * 2.2f)); array[i] = Mathf.Clamp((num8 * 0.3f + num9) * num10, -1f, 1f) * 0.6f; } return MakeClip("EmpressBackroomsScream", array); } private static AudioClip BuildCharge() { int num = 83790; float[] array = new float[num]; float num2 = 0f; float num3 = Random.Range(0f, 25f); for (int i = 0; i < num; i++) { float num4 = (float)i / 44100f; float num5 = num4 / 1.9f; float num6 = 42f + 70f * num5 + 8f * Mathf.PerlinNoise(num3, num4 * 6f); num2 += MathF.PI * 2f * num6 / 44100f; float num7 = Mathf.Sin(num2) + 0.5f * Mathf.Sin(num2 * 2f) + 0.3f * Mathf.Sin(num2 * 3.01f); float num8 = Mathf.Sign(Mathf.Sin(num2 * 1.5f)) * 0.18f; float num9 = (Mathf.PerlinNoise(num3 + 4f, num4 * 50f) - 0.5f) * 0.6f; float num10 = Mathf.Clamp01(num5 * 3f) * (1f - 0.3f * num5); array[i] = Mathf.Clamp((num7 * 0.32f + num8 + num9) * num10, -1f, 1f) * 0.85f; } return MakeClip("EmpressBackroomsCharge", array); } } internal enum BackroomsElevatorState { Boarding, Descending, Arrived, ReturnOpen, ReturnClosing, ReturnDeparting } internal sealed class BackroomsElevator : MonoBehaviour { private const float DescentDuration = 10f; private const float Thickness = 0.3f; private BackroomsMap _map; private Transform _leftPanel; private Transform _rightPanel; private Material _buttonLens; private float _half; private float _frontZ; private float _leftClosedX; private float _rightClosedX; private float _leftOpenX; private float _rightOpenX; private float _panelZ; private BackroomsElevatorState _state; private float _doorOpen; private float _descentTimer; private float _promptTimer; private float _effectTimer; private float _exitTimer; private int _lastCountdown = -1; private bool _sealed; private bool _returnMode; private float _returnCountdown; private float _departTimer; private float _healTimer; private int _lastReturnCount = -1; private bool _departed; private bool _outsideKilled; public static BackroomsElevator Create(Transform parent, BackroomsMap map) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Empress Backrooms Elevator"); val.transform.SetParent(parent, false); BackroomsElevator backroomsElevator = val.AddComponent<BackroomsElevator>(); backroomsElevator._map = map; backroomsElevator.Build(); return backroomsElevator; } public static BackroomsElevator CreateReturn(Transform parent, BackroomsMap map) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Empress Backrooms Exit Elevator"); val.transform.SetParent(parent, false); BackroomsElevator backroomsElevator = val.AddComponent<BackroomsElevator>(); backroomsElevator._map = map; backroomsElevator._returnMode = true; backroomsElevator._state = BackroomsElevatorState.ReturnOpen; backroomsElevator.Build(); backroomsElevator._doorOpen = 1f; backroomsElevator.ApplyDoor(); return backroomsElevator; } private void Build() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) _half = _map.ElevatorDoorHalfWidth; _frontZ = _map.ElevatorDoorCenter.z; float num = _frontZ - 5.25f; float num2 = (_frontZ + num) * 0.5f; float num3 = _frontZ - num; float num4 = 3f; Box("Car Floor", new Vector3(0f, -0.15f, num2), new Vector3(_half * 2f + 0.3f, 0.3f, num3), BackroomsMaterials.ConcreteMaterial, solid: true); Box("Car Ceiling", new Vector3(0f, num4 + 0.15f, num2), new Vector3(_half * 2f + 0.3f, 0.3f, num3), BackroomsMaterials.ConcreteMaterial, solid: true); Box("Car Back", new Vector3(0f, num4 * 0.5f, num), new Vector3(_half * 2f + 0.3f, num4, 0.3f), BackroomsMaterials.MetalPanelMaterial, solid: true); Box("Car West", new Vector3(0f - _half, num4 * 0.5f, num2), new Vector3(0.3f, num4, num3), BackroomsMaterials.MetalPanelMaterial, solid: true); Box("Car East", new Vector3(_half, num4 * 0.5f, num2), new Vector3(0.3f, num4, num3), BackroomsMaterials.MetalPanelMaterial, solid: true); Box("Car Trim Back", new Vector3(0f, 1.1f, num + 0.06f), new Vector3(_half * 2f, 0.1f, 0.06f), BackroomsMaterials.TrimMaterial, solid: false); Light obj = new GameObject("Car Light").AddComponent<Light>(); ((Component)obj).transform.SetParent(((Component)this).transform, false); ((Component)obj).transform.localPosition = new Vector3(0f, num4 - 0.25f, num2); obj.type = (LightType)2; obj.color = new Color(0.9f, 0.95f, 1f); obj.intensity = 1.3f; obj.range = 8f; Box("Car Light Panel", new Vector3(0f, num4 - 0.07f, num2), new Vector3(1.4f, 0.08f, 1.4f), BackroomsMaterials.FluorescentOnMaterial, solid: false); Box("Door Frame Header", new Vector3(0f, num4 - 0.18f, _frontZ), new Vector3(_half * 2f + 0.4f, 0.36f, 0.16f), BackroomsMaterials.TrimMaterial, solid: true); Box("Door Frame West", new Vector3(0f - _half - 0.08f, num4 * 0.5f, _frontZ), new Vector3(0.16f, num4, 0.16f), BackroomsMaterials.TrimMaterial, solid: true); Box("Door Frame East", new Vector3(_half + 0.08f, num4 * 0.5f, _frontZ), new Vector3(0.16f, num4, 0.16f), BackroomsMaterials.TrimMaterial, solid: true); _panelZ = _frontZ - 0.12f; float num5 = num4 - 0.12f; _leftClosedX = (0f - _half) * 0.5f; _rightClosedX = _half * 0.5f; _leftOpenX = 0f - _half - 0.42f; _rightOpenX = _half + 0.42f; _leftPanel = Box("Door Panel Left", new Vector3(_leftClosedX, num5 * 0.5f, _panelZ), new Vector3(_half + 0.02f, num5, 0.12f), BackroomsMaterials.MetalPanelMaterial, solid: true).transform; _rightPanel = Box("Door Panel Right", new Vector3(_rightClosedX, num5 * 0.5f, _panelZ), new Vector3(_half + 0.02f, num5, 0.12f), BackroomsMaterials.MetalPanelMaterial, solid: true).transform; Box("Door Seam Left", new Vector3(0f, num5 * 0.5f, _panelZ - 0.07f), new Vector3(0.04f, num5 - 0.1f, 0.02f), BackroomsMaterials.TrimMaterial, solid: false).transform.SetParent(_leftPanel, true); Box("Door Seam Right", new Vector3(0f, num5 * 0.5f, _panelZ - 0.07f), new Vector3(0.04f, num5 - 0.1f, 0.02f), BackroomsMaterials.TrimMaterial, solid: false).transform.SetParent(_rightPanel, true); Vector3 elevatorButtonAnchor = _map.ElevatorButtonAnchor; Box("Button Housing", elevatorButtonAnchor, new Vector3(0.1f, 0.42f, 0.3f), BackroomsMaterials.TrimMaterial, solid: false); _buttonLens = BackroomsMaterials.CreateEmissive(new Color(0.4f, 1f, 0.5f), 2.4f); Box("Button Lens", elevatorButtonAnchor + new Vector3(-0.07f, 0.04f, 0f), new Vector3(0.04f, 0.16f, 0.16f), _buttonLens, solid: false); ApplyDoor(); } private GameObject Box(string name, Vector3 localPosition, Vector3 size, Material material, bool solid) { //IL_0026: 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) GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = name; val.transform.SetParent(((Component)this).transform, false); val.transform.localPosition = localPosition; val.transform.localScale = size; Renderer component = val.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null && (Object)(object)material != (Object)null) { component.sharedMaterial = material; } if (!solid) { Collider component2 = val.GetComponent<Collider>(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } } return val; } private void Update() { if (!_sealed) { float deltaTime = Time.deltaTime; bool flag = SemiFunc.IsMasterClientOrSingleplayer(); float num = ((_state == BackroomsElevatorState.Arrived || _state == BackroomsElevatorState.ReturnOpen || _state == BackroomsElevatorState.ReturnClosing) ? 1f : 0f); _doorOpen = Mathf.MoveTowards(_doorOpen, num, deltaTime * 0.85f); ApplyDoor(); if (_returnMode) { UpdateReturn(deltaTime, flag); } else if (_state == BackroomsElevatorState.Boarding) { UpdateBoarding(deltaTime); } else if (_state == BackroomsElevatorState.Descending) { UpdateDescending(deltaTime, flag); } else if (_state == BackroomsElevatorState.Arrived && flag) { UpdateArrived(deltaTime); } UpdateButtonGlow(); } } private void ApplyDoor() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_leftPanel != (Object)null) { Vector3 localPosition = _leftPanel.localPosition; localPosition.x = Mathf.Lerp(_leftClosedX, _leftOpenX, _doorOpen); _leftPanel.localPosition = localPosition; } if ((Object)(object)_rightPanel != (Object)null) { Vector3 localPosition2 = _rightPanel.localPosition; localPosition2.x = Mathf.Lerp(_rightClosedX, _rightOpenX, _doorOpen); _rightPanel.localPosition = localPosition2; } } private void UpdateBoarding(float dt) { //IL_0016: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = LocalAvatar(); if (!((Object)(object)val == (Object)null) && !(Vector3.Distance(((Component)val).transform.position, _map.ElevatorButtonAnchor) > 2.4f)) { _promptTimer -= dt; if (_promptTimer <= 0f) { _promptTimer = 2.5f; SemiFunc.UIFocusText("Press [Interact] to descend.", new Color(0.6f, 1f, 0.7f), Color.white, 2.5f); } if (SemiFunc.InputDown((InputKey)2)) { RequestDescent(); } } } private void RequestDescent() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (_state == BackroomsElevatorState.Boarding) { if (!AllAboard()) { SemiFunc.UIFocusText("Wait for everyone to step inside.", new Color(1f, 0.8f, 0.4f), Color.white, 2.5f); BackroomsAudio.PlayHit(_map.ElevatorButtonAnchor); } else if (SemiFunc.IsMasterClientOrSingleplayer()) { BeginDescent(); } else { EmpressBackroomsPlugin.RaiseToOthers(195, new object[1] { 1 }); } } } private void BeginDescent() { if (_state == BackroomsElevatorState.Boarding && AllAboard()) { _descentTimer = 10f; SetState(BackroomsElevatorState.Descending); EmpressBackroomsPlugin.RaiseToAll(195, new object[2] { 0, 1 }); } } private void UpdateDescending(float dt, bool host) { //IL_0065: 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) _effectTimer -= dt; if (_effectTimer <= 0f) { _effectTimer = 0.5f; SemiFunc.CameraShakeImpact(1.4f, 0.4f); if (Random.value > 0.5f) { BackroomsAudio.PlayShift(((Object)(object)LocalAvatar() != (Object)null) ? ((Component)LocalAvatar()).transform.position : ((Component)this).transform.position); } } if (host) { _descentTimer -= dt; int num = Mathf.Clamp(Mathf.CeilToInt(_descentTimer), 0, 10); if (num != _lastCountdown) { _lastCountdown = num; EmpressBackroomsPlugin.RaiseToAll(195, new object[2] { 2, num }); } if (_descentTimer <= 0f) { SetState(BackroomsElevatorState.Arrived); EmpressBackroomsPlugin.RaiseToAll(195, new object[2] { 0, 2 }); } } } private void UpdateArrived(float dt) { if (!(_doorOpen < 0.85f)) { if (NobodyAboard()) { _exitTimer += dt; } else { _exitTimer = 0f; } if (_exitTimer > 2f) { EmpressBackroomsPlugin.RaiseToAll(195, new object[1] { 3 }); } } } private void UpdateReturn(float dt, bool host) { //IL_0102: 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) HealOccupants(dt); if (_state == BackroomsElevatorState.ReturnOpen) { UpdateReturnBoarding(dt); } else if (_state == BackroomsElevatorState.ReturnClosing) { if (host) { _returnCountdown -= dt; int num = Mathf.Clamp(Mathf.CeilToInt(_returnCountdown), 0, 9); if (num != _lastReturnCount) { _lastReturnCount = num; EmpressBackroomsPlugin.RaiseToAll(195, new object[2] { 12, num }); } if (_returnCountdown <= 0f) { BeginDepart(); } } } else { if (_state != BackroomsElevatorState.ReturnDeparting) { return; } _effectTimer -= dt; if (_effectTimer <= 0f) { _effectTimer = 0.5f; SemiFunc.CameraShakeImpact(1.6f, 0.4f); if (Random.value > 0.5f) { BackroomsAudio.PlayShift(((Object)(object)LocalAvatar() != (Object)null) ? ((Component)LocalAvatar()).transform.position : ((Component)this).transform.position); } } if (!host) { return; } _departTimer -= dt; if (_departTimer <= 0f && !_departed) { _departed = true; if ((Object)(object)RunManager.instance != (Object)null) { RunManager.instance.ChangeLevel(true, false, (ChangeLevelType)0); } } } } private void UpdateReturnBoarding(float dt) { //IL_0016: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = LocalAvatar(); if (!((Object)(object)val == (Object)null) && !(Vector3.Distance(((Component)val).transform.position, _map.ElevatorButtonAnchor) > 2.4f)) { _promptTimer -= dt; if (_promptTimer <= 0f) { _promptTimer = 2.5f; SemiFunc.UIFocusText("Press [Interact] to leave the Backrooms.", new Color(0.6f, 1f, 0.7f), Color.white, 2.5f); } if (SemiFunc.InputDown((InputKey)2)) { RequestDepart(); } } } private void RequestDepart() { if (_state == BackroomsElevatorState.ReturnOpen) { if (SemiFunc.IsMasterClientOrSingleplayer()) { BeginClosing(); return; } EmpressBackroomsPlugin.RaiseToOthers(195, new object[1] { 11 }); } } private void BeginClosing() { //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) if (_state == BackroomsElevatorState.ReturnOpen) { _returnCountdown = 5f; _lastReturnCount = -1; SetState(BackroomsElevatorState.ReturnClosing); SemiFunc.UIBigMessage("THE DOORS WILL CLOSE", "{v}", 26f, new Color(1f, 0.7f, 0.3f), Color.white); EmpressBackroomsPlugin.RaiseToAll(195, new object[2] { 10, 4 }); } } private void BeginDepart() { //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) KillPlayersOutside(); _departTimer = 8f; _effectTimer = 0f; SetState(BackroomsElevatorState.ReturnDeparting); SemiFunc.UIBigMessage("LEAVING THE BACKROOMS", "{!}", 30f, new Color(0.6f, 1f, 0.7f), Color.white); EmpressBackroomsPlugin.RaiseToAll(195, new object[2] { 10, 5 }); } private void KillPlayersOutside() { //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_007c: Unknown result type (might be due to invalid IL or missing references) if (_outsideKilled || (Object)(object)GameDirector.instance == (Object)null || GameDirector.instance.PlayerList == null) { return; } _outsideKilled = true; Bounds elevatorBounds = _map.ElevatorBounds; ((Bounds)(ref elevatorBounds)).Expand(0.5f); foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (!((Object)(object)player == (Object)null) && !BackroomsAccess.GetDeadSet(player) && !BackroomsAccess.GetIsDisabled(player) && !((Bounds)(ref elevatorBounds)).Contains(((Component)player).transform.position)) { player.PlayerDeath(-1); } } } private void HealOccupants(float dt) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (_state == BackroomsElevatorState.ReturnDeparting) { return; } _healTimer -= dt; if (_healTimer > 0f) { return; } _healTimer = 1f; PlayerAvatar val = LocalAvatar(); if (!((Object)(object)val == (Object)null) && !((Object)(object)val.playerHealth == (Object)null)) { Bounds elevatorBounds = _map.ElevatorBounds; ((Bounds)(ref elevatorBounds)).Expand(0.4f); if (((Bounds)(ref elevatorBounds)).Contains(((Component)val).transform.position)) { val.playerHealth.Heal(1000, true); } } } private void UpdateButtonGlow() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_buttonLens == (Object)null) && _buttonLens.HasProperty("_EmissionColor")) { Color val = ((_state != BackroomsElevatorState.Boarding && _state != BackroomsElevatorState.ReturnOpen) ? ((_state != BackroomsElevatorState.Descending && _state != BackroomsElevatorState.ReturnClosing) ? (new Color(1f, 0.2f, 0.2f) * 1.6f) : (new Color(1f, 0.5f, 0.2f) * 2.4f)) : (new Color(0.4f, 1f, 0.5f) * (2f + Mathf.Sin(Time.time * 4f) * 0.8f))); _buttonLens.SetColor("_EmissionColor", val); } } internal void OnNetwork(object[] data) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: 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_01bd: 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) if (_sealed || data == null || data.Length < 1 || !(data[0] is int num)) { return; } if (num == 0 && data.Length >= 2 && data[1] is int num2) { if (num2 == 1 && _state == BackroomsElevatorState.Boarding) { SemiFunc.UIBigMessage("DESCENDING", "{v}", 26f, new Color(1f, 0.7f, 0.3f), Color.white); } SetState((BackroomsElevatorState)Mathf.Clamp(num2, 0, 2)); return; } if (num == 1 && SemiFunc.IsMasterClientOrSingleplayer()) { BeginDescent(); return; } if (num == 2 && data.Length >= 2 && data[1] is int num3) { _lastCountdown = num3; if (num3 > 0) { SemiFunc.UIFocusText(num3.ToString(), new Color(1f, 0.7f, 0.3f), Color.white, 0.9f); } else { SemiFunc.UIBigMessage("THE DOORS OPEN", "{!}", 26f, new Color(0.9f, 0.85f, 0.5f), Color.white); } return; } switch (num) { case 3: SealIntoWall(); return; case 10: { if (data.Length < 2 || !(data[1] is int num4)) { break; } BackroomsElevatorState backroomsElevatorState = (BackroomsElevatorState)Mathf.Clamp(num4, 0, 5); if (_state != backroomsElevatorState) { switch (backroomsElevatorState) { case BackroomsElevatorState.ReturnClosing: SemiFunc.UIBigMessage("THE DOORS WILL CLOSE", "{v}", 26f, new Color(1f, 0.7f, 0.3f), Color.white); break; case BackroomsElevatorState.ReturnDeparting: SemiFunc.UIBigMessage("LEAVING THE BACKROOMS", "{!}", 30f, new Color(0.6f, 1f, 0.7f), Color.white); break; } } SetState(backroomsElevatorState); return; } } if (num == 11 && SemiFunc.IsMasterClientOrSingleplayer()) { BeginClosing(); } else if (num == 12 && data.Length >= 2 && data[1] is int num5) { _lastReturnCount = num5; if (num5 > 0) { SemiFunc.UIFocusText(num5.ToString(), new Color(1f, 0.7f, 0.3f), Color.white, 0.9f); } else { SemiFunc.UIBigMessage("DOORS SEALING", "{v}", 26f, new Color(1f, 0.4f, 0.3f), Color.white); } } } private void SetState(BackroomsElevatorState state) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (_state != state) { _state = state; if (state == BackroomsElevatorState.Arrived) { BackroomsAudio.PlaySting(((Component)this).transform.position); } } } private void SealIntoWall() { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) if (_sealed) { return; } _sealed = true; Transform parent = ((Component)this).transform.parent; if ((Object)(object)parent != (Object)null) { GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = "Empress Backrooms Elevator Seal"; val.transform.SetParent(parent, false); val.transform.localPosition = new Vector3(0f, 1.5f, _frontZ); val.transform.localScale = new Vector3(_half * 2f + 0.5f, 3f, 0.3f); Renderer component = val.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { component.sharedMaterial = BackroomsMaterials.WallpaperMaterial; } if ((Object)(object)BackroomsRuntime.Instance != (Object)null) { BackroomsRuntime.Instance.RegisterElevatorSeal(val); } } BackroomsAudio.PlaySting(((Component)this).transform.position); Object.Destroy((Object)(object)((Component)this).gameObject); } private bool AllAboard() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) List<PlayerAvatar> list = PlayablePlayers(); if (list.Count == 0) { return true; } Bounds elevatorBounds = _map.ElevatorBounds; ((Bounds)(ref elevatorBounds)).Expand(0.6f); for (int i = 0; i < list.Count; i++) { if (!((Bounds)(ref elevatorBounds)).Contains(((Component)list[i]).transform.position)) { return false; } } return true; } private bool NobodyAboard() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) List<PlayerAvatar> list = PlayablePlayers(); if (list.Count == 0) { return false; } Bounds elevatorBounds = _map.ElevatorBounds; ((Bounds)(ref elevatorBounds)).Expand(0.4f); for (int i = 0; i < list.Count; i++) { if (((Bounds)(ref elevatorBounds)).Contains(((Component)list[i]).transform.position)) { return false; } } return true; } private static List<PlayerAvatar> PlayablePlayers() { List<PlayerAvatar> list = new List<PlayerAvatar>(); if ((Object)(object)GameDirector.instance != (Object)null && GameDirector.instance.PlayerList != null) { for (int i = 0; i < GameDirector.instance.PlayerList.Count; i++) { PlayerAvatar val = GameDirector.instance.PlayerList[i]; if ((Object)(object)val != (Object)null && !BackroomsAccess.GetIsDisabled(val) && !BackroomsAccess.GetDeadSet(val)) { list.Add(val); } } } return list; } private static PlayerAvatar LocalAvatar() { if (!((Object)(object)PlayerController.instance != (Object)null)) { return null; } return PlayerController.instance.playerAvatarScript; } } internal static class Constants { public const float WallHeight = 3f; } internal enum BackroomsEnemyState { Idle, Search, Hunt, Recover, Dead } internal enum BackroomsEnemyKind { Smiler, SmokeCharger } internal sealed class BackroomsEnemy : MonoBehaviour { private const float SightRange = 25f; private const float LoseSightMemory = 3.6f; private const float SearchDuration = 5f; private const float AttackRange = 1.9f; private const float DesiredHeight = 2.15f; private NavMeshAgent _agent; private CapsuleCollider _trigger; private GameObject _visual; private Animation _animation; private Animator _animator; private readonly List<Material> _materials = new List<Material>(); private Vector3 _lastSeenPosition; private Vector3 _roamTarget; private Vector3 _lastAnimPosition; private Vector3 _clientPosition; private float _clientYaw; private float _clientLerp; private float _baseSpeed = 2.6f; private float _memoryTimer; private float _searchTimer; private float _attackCooldown; private float _recoverTimer; private float _reacquireTimer; private float _roamRepick; private float _vocalTimer; private float _roarTimer; private float _hurtFlash; private float _vanishTimer; private bool _charger; private bool _vanished; private bool _wantReappear; private bool _clientHidden; private bool _hasLastSeen; private bool _isHost; private bool _pendingHit; public int Id { get; private set; } public BackroomsEnemyKind Kind { get; private set; } public BackroomsEnemyState State { get; private set; } public int Health { get; private set; } public int MaxHealth { get; private set; } public bool Dead => State == BackroomsEnemyState.Dead; public bool Hidden => _vanished; public bool WantsReappear { get { if (_vanished) { return _wantReappear; } return false; } } public Vector3 Position => ((Component)this).transform.position; public float Yaw => ((Component)this).transform.eulerAngles.y; public Vector3 EyePoint => ((Component)this).transform.position + Vector3.up * 1.55f; public static BackroomsEnemy Create(Transform parent, int id, float baseSpeed, bool isHost, BackroomsEnemyKind kind = BackroomsEnemyKind.Smiler) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(((kind == BackroomsEnemyKind.SmokeCharger) ? "Empress Backrooms Smoke " : "Empress Backrooms Smiler ") + id); val.transform.SetParent(parent, false); BackroomsEnemy backroomsEnemy = val.AddComponent<BackroomsEnemy>(); backroomsEnemy.Id = id; backroomsEnemy.Kind = kind; backroomsEnemy._charger = kind == BackroomsEnemyKind.SmokeCharger; backroomsEnemy._isHost = isHost; backroomsEnemy._baseSpeed = (backroomsEnemy._charger ? Mathf.Max(baseSpeed, 3f) : baseSpeed); backroomsEnemy.MaxHealth = (backroomsEnemy._charger ? 220 : 180); backroomsEnemy.Health = backroomsEnemy.MaxHealth; backroomsEnemy.BuildBody(); CapsuleCollider val2 = val.AddComponent<CapsuleCollider>(); ((Collider)val2).isTrigger = true; val2.radius = 0.52f; val2.height = 2.1f; val2.center = new Vector3(0f, 1.05f, 0f); backroomsEnemy._trigger = val2; Rigidbody obj = val.AddComponent<Rigidbody>(); obj.isKinematic = true; obj.useGravity = false; obj.interpolation = (RigidbodyInterpolation)1; NavMeshAgent val3 = val.AddComponent<NavMeshAgent>(); val3.radius = 0.42f; val3.height = 2.05f; val3.speed = backroomsEnemy._baseSpeed; val3.angularSpeed = 540f; val3.acceleration = 22f; val3.stoppingDistance = 1.15f; val3.autoBraking = true; val3.updateRotation = false; ((Behaviour)val3).enabled = false; backroomsEnemy._agent = val3; return backroomsEnemy; } private void BuildBody() { //IL_0040: 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) _visual = (_charger ? BackroomsSmokeAssets.CreateSmoke(((Component)this).transform) : BackroomsSmilerAssets.CreateSmiler(((Component)this).transform)); if (!((Object)(object)_visual == (Object)null)) { _visual.transform.localPosition = Vector3.zero; _visual.transform.localRotation = Quaternion.identity; NormalizeVisual(); CacheMaterials(); StartAnimation(); } } private void NormalizeVisual() { //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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = _visual.GetComponentsInChildren<Renderer>(true); if (componentsInChildren.Length != 0) { Bounds bounds = componentsInChildren[0].bounds; for (int i = 1; i < componentsInChildren.Length; i++) { ((Bounds)(ref bounds)).Encapsulate(componentsInChildren[i].bounds); } float num = Mathf.Max(0.01f, ((Bounds)(ref bounds)).size.y); float num2 = 2.15f / num; Transform transform = _visual.transform; transform.localScale *= num2; componentsInChildren = _visual.GetComponentsInChildren<Renderer>(true); bounds = componentsInChildren[0].bounds; for (int j = 1; j < componentsInChildren.Length; j++) { ((Bounds)(ref bounds)).Encapsulate(componentsInChildren[j].bounds); } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((Bounds)(ref bounds)).center.x - ((Component)this).transform.position.x, ((Bounds)(ref bounds)).min.y - ((Component)this).transform.position.y, ((Bounds)(ref bounds)).center.z - ((Component)this).transform.position.z); Transform transform2 = _visual.transform; transform2.localPosition -= val; } } private void CacheMaterials() { if (_charger) { return; } Renderer[] componentsInChildren = _visual.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] materials = componentsInChildren[i].materials; for (int j = 0; j < materials.Length; j++) { if ((Object)(object)materials[j] != (Object)null && !_materials.Contains(materials[j])) { _materials.Add(materials[j]); } } } } private void StartAnimation() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown _animation = _visual.GetComponentInChildren<Animation>(true); if ((Object)(object)_animation != (Object)null) { string text = null; foreach (AnimationState item in _animation) { AnimationState val = item; if (!((TrackedReference)(object)val == (TrackedReference)null)) { val.wrapMode = (WrapMode)2; val.speed = 1f; if (text == null) { text = val.name; } } } _animation.wrapMode = (WrapMode)2; if (!string.IsNullOrEmpty(text)) { _animation.Play(text); } } _animator = _visual.GetComponentInChildren<Animator>(true); if ((Object)(object)_animator != (Object)null) { _animator.speed = 1f; } } public void PlaceOnNavMesh(Vector3 position, Quaternion rotation) { //IL_0027: 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_003a: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_005b: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) NavMeshHit val = default(NavMeshHit); if (_isHost && NavMesh.SamplePosition(position, ref val, 8f, -1)) { position = ((NavMeshHit)(ref val)).position; } ((Component)this).transform.position = position; ((Component)this).transform.rotation = rotation; _clientPosition = position; _clientYaw = ((Quaternion)(ref rotation)).eulerAngles.y; _lastAnimPosition = position; _lastSeenPosition = position; if (_isHost && (Object)(object)_agent != (Object)null) { ((Behaviour)_agent).enabled = true; if (_agent.isOnNavMesh) { _agent.Warp(position); } } } public void SetState(BackroomsEnemyState state) { if (State != BackroomsEnemyState.Dead) { State = state; } } public void BeginVanish(float duration) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (State != BackroomsEnemyState.Dead) { _vanished = true; _wantReappear = false; _vanishTimer = duration; State = BackroomsEnemyState.Recover; SetVisualHidden(hidden: true); BackroomsAudio.PlaySting(((Component)this).transform.position); if ((Object)(object)_agent != (Object)null && ((Behaviour)_agent).enabled && _agent.isOnNavMesh) { _agent.isStopped = true; } } } public void Reappear(Vector3 spot) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if (State != BackroomsEnemyState.Dead) { _vanished = false; _wantReappear = false; _hasLastSeen = false; _memoryTimer = 0f; _reacquireTimer = Random.Range(1.5f, 2.5f); _searchTimer = 5f; State = BackroomsEnemyState.Search; ((Component)this).transform.position = spot; _clientPosition = spot; _lastAnimPosition = spot; if ((Object)(object)_agent != (Object)null && ((Behaviour)_agent).enabled && _agent.isOnNavMesh) { _agent.Warp(spot); } SetVisualHidden(hidden: false); BackroomsAudio.PlayGrowl(spot); } } private void SetVisualHidden(bool hidden) { if ((Object)(object)_visual != (Object)null && _visual.activeSelf == hidden) { _visual.SetActive(!hidden); } if ((Object)(object)_trigger != (Object)null) { ((Collider)_trigger).enabled = !hidden; } } public bool HostThink(float dt, bool canSeeTarget, Vector3 targetPosition, float distance, IList<Vector3> waypoints) { //IL_00d5: 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_015e: Unknown result type (might be due to invalid IL or missing references) if (State == BackroomsEnemyState.Dead || (Object)(object)_agent == (Object)null || !((Behaviour)_agent).enabled) { return false; } if (_vanished) { _vanishTimer -= dt; if (_vanishTimer <= 0f) { _wantReappear = true; } if (_agent.isOnNavMesh) { _agent.isStopped = true; } return false; } _attackCooldown -= dt; _recoverTimer -= dt; _reacquireTimer -= dt; _vocalTimer -= dt; _roarTimer -= dt; bool flag = canSeeTarget && distance <= 25f; if (flag && _reacquireTimer <= 0f) { _lastSeenPosition = targetPosition; _hasLastSeen = true; _memoryTimer = 3.6f; _searchTimer = 5f; if (State != BackroomsEnemyState.Hunt && State != BackroomsEnemyState.Recover) { AlertVocal(); } if (State != BackroomsEnemyState.Recover) { State = BackroomsEnemyState.Hunt; } } else if (_memoryTimer > 0f) { _memoryTimer -= dt; } bool result = false; switch (State) { case BackroomsEnemyState.Hunt: result = ThinkHunt(flag, targetPosition, distance); break; case BackroomsEnemyState.Recover: ThinkRecover(); break; case BackroomsEnemyState.Search: ThinkSearch(dt, waypoints); break; default: ThinkIdle(dt, waypoints); break; } UpdateRotation(dt); UpdateAnimation(dt); UpdateMaterials(dt); return result; } private bool ThinkHunt(bool canSeeTarget, Vector3 targetPosition, float distance) { //IL_001a: 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 (_recoverTimer > 0f) { State = BackroomsEnemyState.Recover; return false; } if (canSeeTarget) { SetDestination(targetPosition, _charger ? (_baseSpeed * 2.5f) : (_baseSpeed * ((distance > 6f) ? 1.18f : 0.92f)), stop: false); } else { if (!(_memoryTimer > 0f) || !_hasLastSeen) { State = BackroomsEnemyState.Search; _searchTimer = 5f; return false; } SetDestination(_lastSeenPosition, _baseSpeed * (_charger ? 1.4f : 0.9f), stop: false); } float num = (_charger ? 2.5f : 1.9f); if (canSeeTarget && distance <= num && _attackCooldown <= 0f) { _attackCooldown = Random.Range(4.5f, 6.5f); _recoverTimer = Random.Range(2.2f, 3.2f); _reacquireTimer = Random.Range(1.2f, 2f); State = BackroomsEnemyState.Recover; if (_charger) { ChargeRoar(); } else { Growl(); } return true; } return false; } private void ThinkRecover() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) SetDestination(((Component)this).transform.position, _baseSpeed * 0.25f, stop: true); if (_recoverTimer <= 0f) { State = (_hasLastSeen ? BackroomsEnemyState.Search : BackroomsEnemyState.Idle); _searchTimer = Mathf.Max(_searchTimer, 2.5f); } } private void ThinkSearch(float dt, IList<Vector3> waypoints) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) _searchTimer -= dt; if (_hasLastSeen) { SetDestination(_lastSeenPosition, _baseSpeed * 0.62f, stop: false); } else { ThinkIdle(dt, waypoints); } if (_searchTimer <= 0f || (_agent.isOnNavMesh && !_agent.pathPending && _agent.remainingDistance < 1.5f)) { _hasLastSeen = false; _memoryTimer = 0f; _reacquireTimer = Random.Range(2f, 4f); State = BackroomsEnemyState.Idle; } } private void ThinkIdle(float dt, IList<Vector3> waypoints) { //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_00b3: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) _roamRepick -= dt; if (_roamRepick <= 0f || (_agent.isOnNavMesh && !_agent.pathPending && _agent.remainingDistance < 2f)) { _roamRepick = Random.Range(5f, 10f); if (waypoints != null && waypoints.Count > 0) { _roamTarget = waypoints[Random.Range(0, waypoints.Count)]; } } if (_roamTarget != Vector3.zero) { SetDestination(_roamTarget, _baseSpeed * 0.45f, stop: false); } else { SetDestination(((Component)this).transform.position, 0f, stop: true); } } private void SetDestination(Vector3 position, float speed, bool stop) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_agent == (Object)null) && ((Behaviour)_agent).enabled && _agent.isOnNavMesh) { _agent.speed = Mathf.Max(0f, speed); _agent.isStopped = stop; if (!stop) { _agent.SetDestination(position); } } } private void UpdateRotation(float dt) { //IL_001b: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (((Object)(object)_agent != (Object)null && ((Behaviour)_agent).enabled) ? _agent.velocity : Vector3.zero); val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.02f)) { Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, dt * 8f); } } private void UpdateAnimation(float dt) { //IL_0006: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown Vector3 val = ((Component)this).transform.position - _lastAnimPosition; float num = ((Vector3)(ref val)).magnitude / Mathf.Max(0.0001f, dt); _lastAnimPosition = ((Component)this).transform.position; float speed = ((State == BackroomsEnemyState.Dead) ? 0f : Mathf.Clamp(num / Mathf.Max(0.1f, _baseSpeed), 0.45f, 1.6f)); if ((Object)(object)_animation != (Object)null) { foreach (AnimationState item in _animation) { AnimationState val2 = item; if ((TrackedReference)(object)val2 != (TrackedReference)null) { val2.speed = speed; } } if (!_animation.isPlaying) { _animation.Play(); } } if ((Object)(object)_animator != (Object)null) { _animator.speed = speed; } } private void UpdateMaterials(float dt) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) if (_hurtFlash > 0f) { _hurtFlash -= dt * 2.4f; } Color val = Color.red * Mathf.Clamp01(_hurtFlash) * 1.4f; for (int i = 0; i < _materials.Count; i++) { Material val2 = _materials[i]; if (!((Object)(object)val2 == (Object)null) && val2.HasProperty("_EmissionColor")) { if (_hurtFlash > 0f) { val2.EnableKeyword("_EMISSION"); val2.SetColor("_EmissionColor", val); } else { val2.SetColor("_EmissionColor", Color.black); } } } } private void Growl() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!(_vocalTimer > 0f)) { _vocalTimer = Random.Range(3.5f, 6f); BackroomsAudio.PlayGrowl(((Component)this).transform.position); } } private void AlertVocal() { if (_charger) { ChargeRoar(); } else { Growl(); } } private void ChargeRoar() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!(_roarTimer > 0f)) { _roarTimer = Random.Range(2.5f, 4f); BackroomsAudio.PlayCharge(((Component)this).transform.position); } } public void ClientTick(float dt) { //IL_002a: 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_003b: 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_0079: Unknown result type (might be due to invalid IL or missing references) _clientLerp = Mathf.Min(1f, _clientLerp + dt * 12f); ((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, _clientPosition, _clientLerp); float num = Mathf.LerpAngle(((Component)this).transform.eulerAngles.y, _clientYaw, dt * 9f); ((Component)this).transform.rotation = Quaternion.Euler(0f, num, 0f); UpdateAnimation(dt); UpdateMaterials(dt); } public void ApplyClientSync(Vector3 position, float yaw, BackroomsEnemyState state, int health, bool hidden) { //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_0012: Unknown result type (might be due to invalid IL or missing references) if (_clientHidden && !hidden) { ((Component)this).transform.position = position; _clientLerp = 1f; } else { _clientLerp = 0f; } _clientHidden = hidden; _clientPosition = position; _clientYaw = yaw; if (health < Health) { _hurtFlash = 1f; } Health = health; if (state == BackroomsEnemyState.Dead && State != BackroomsEnemyState.Dead) { Kill(playEffect: false); return; } State = state; SetVisualHidden(hidden); } public bool ConsumeHit() { if (!_pendingHit) { return false; } _pendingHit = false; return true; } private void OnTriggerEnter(Collider other) { //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) if (!_isHost || State == BackroomsEnemyState.Dead || (Object)(object)other == (Object)null) { return; } Rigidbody attachedRigidbody = other.attachedRigidbody; if ((Object)(object)attachedRigidbody == (Object)null || attachedRigidbody.isKinematic || (Object)(object)((Component)other).GetComponentInParent<PlayerAvatar>() != (Object)null || (Object)(object)((Component)other).GetComponentInParent<BackroomsEnemy>() != (Object)null) { return; } Vector3 velocity = attachedRigidbody.velocity; float magnitude = ((Vector3)(ref velocity)).magnitude; if (!(magnitude < 3.5f)) { float num = Mathf.Clamp(attachedRigidbody.mass, 0.5f, 6f); int num2 = Mathf.RoundToInt(magnitude * num * 1.5f); if (num2 >= 6) { ApplyDamage(num2); } } } public void ApplyDamage(int damage) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (_isHost && State != BackroomsEnemyState.Dead && damage > 0) { Health -= damage; _hurtFlash = 1f; _pendingHit = true; BackroomsAudio.PlayHit(((Component)this).transform.position); if (Health <= 0) { Kill(playEffect: true); return; } _recoverTimer = Mathf.Max(_recoverTimer, 1.5f); State = BackroomsEnemyState.Recover; } } public void Kill(bool playEffect) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (State == BackroomsEnemyState.Dead) { return; } State = BackroomsEnemyState.Dead; Health = 0; if ((Object)(object)_agent != (Object)null) { if (((Behaviour)_agent).enabled && _agent.isOnNavMesh) { _agent.isStopped = true; } ((Behaviour)_agent).enabled = false; } if (playEffect) { BackroomsAudio.PlayDeath(((Component)this).transform.position); } ((MonoBehaviour)this).StartCoroutine(DeathFall()); } private IEnumerator DeathFall() { float t = 0f; Quaternion from = ((Component)this).transform.rotation; Quaternion to = from * Quaternion.Euler(0f, 0f, (Random.value > 0.5f) ? 85f : (-85f)); Vector3 fromPos = ((Component)this).transform.position; Vector3 toPos = fromPos - Vector3.up * 0.2f; while (t < 1f) { t += Time.deltaTime * 1.5f; ((Component)this).transform.rotation = Quaternion.Slerp(from, to, t); ((Component)this).transform.position = Vector3.Lerp(fromPos, toPos, t); UpdateAnimation(Time.deltaTime); yield return null; } yield return (object)new WaitForSeconds(3f); float fade = 0f; Vector3 startScale = ((Component)this).transform.localScale; while (fade < 1f) { fade += Time.deltaTime * 0.8f; ((Component)this).transform.localScale = Vector3.Lerp(startScale, startScale * 0.02f, fade); yield return null; } Object.Destroy((Object)(object)((Component)this).gameObject); } public void Dispose() { Object.Destroy((Object)(object)((Component)this).gameObject); } } internal static class BackroomsLevelRegistry { private static readonly FieldRef<LevelContent, Level> LevelContentLevelRef = AccessTools.FieldRefAccess<LevelContent, Level>("_level"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentStartRoomsRef = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_startRooms"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal3"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage3"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd3"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction3"); private static readonly FieldRef<LevelContent, GameObject> LevelContentConnectObjectRef = AccessTools.FieldRefAccess<LevelContent, GameObject>("_connectObject"); private static readonly FieldRef<LevelContent, GameObject> LevelContentBlockObjectRef = AccessTools.FieldRefAccess<LevelContent, GameObject>("_blockObject"); public static Level RegisterLevel() { //IL_00e9: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) Level val = ScriptableObject.CreateInstance<Level>(); ((Object)val).name = "Level - Empress Backrooms"; val.NarrativeName = "Empress - The Backrooms"; LevelValuables val2 = ScriptableObject.CreateInstance<LevelValuables>(); ((Object)val2).name = "Valuables - Empress Backrooms"; val2.tiny = new List<PrefabRef>(); val2.small = new List<PrefabRef>(); val2.medium = new List<PrefabRef>(); val2.big = new List<PrefabRef>(); val2.wide = new List<PrefabRef>(); val2.tall = new List<PrefabRef>(); val2.veryTall = new List<PrefabRef>(); SetLevelField(val, "ModuleAmount", 0); SetLevelField(val, "PassageMaxAmount", 0); SetLevelField(val, "HasEnemies", false); SetLevelField(val, "ValuablePresets", new List<LevelValuables> { val2 }); SetLevelField(val, "AmbiencePresets", new List<LevelAmbience>()); SetLevelField(val, "FogColor", (object)new Color(0.16f, 0.15f, 0.07f)); SetLevelField(val, "FogStartDistance", 8f); SetLevelField(val, "FogEndDistance", 55f); SetLevelField(val, "AmbientColor", (object)new Color(0.42f, 0.39f, 0.2f)); SetLevelField(val, "AmbientColorAdaptation", (object)new Color(0.2f, 0.19f, 0.1f)); SetLevelField(val, "ColorTemperature", 4f); SetLevelField(val, "ColorFilter", (object)new Color(1f, 0.96f, 0.78f, 1f)); SetLevelField(val, "BloomIntensity", 1.1f); SetLevelField(val, "BloomThreshold", 1f); SetLevelField(val, "VignetteColor", (object)new Color(0.05f, 0.04f, 0f, 1f)); SetLevelField(val, "VignetteIntensity", 0.38f); SetLevelField(val, "VignetteSmoothness", 0.85f); SetLevelField(val, "DiscordIcon", "level"); EnsureLevelFieldInstance(val, "LoadingGraphic01"); EnsureLevelFieldInstance(val, "LoadingGraphic02"); EnsureLevelFieldInstance(val, "LoadingGraphic03"); EnsureLevelFieldInstance(val, "ConnectObject"); EnsureLevelFieldInstance(val, "BlockObject"); LevelContent val3 = ScriptableObject.CreateInstance<LevelContent>(); ((Object)val3).name = "Empress Backrooms Content"; LevelContentLevelRef.Invoke(val3) = val; LevelContentStartRoomsRef.Invoke(val3) = new List<GameObject>(); LevelContentModulesNormal1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesNormal2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesNormal3Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesPassage1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesPassage2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesPassage3Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesDeadEnd1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesDeadEnd2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesDeadEnd3Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesExtraction1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesExtraction2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesExtraction3Ref.Invoke(val3) = new List<GameObject>(); LevelContentConnectObjectRef.Invoke(val3) = null; LevelContentBlockObjectRef.Invoke(val3) = null; Levels.RegisterLevel(val3); return val; } public static void BorrowValuablePool(Level backroomsLevel) { if ((Object)(object)backroomsLevel == (Object)null) { return; } List<LevelValuables> valuablePresets = BackroomsAccess.GetValuablePresets(backroomsLevel); if (valuablePresets == null || !PoolHasContent(valuablePresets)) { List<LevelValuables> list = CollectContentValuables(); if (list.Count > 0) { BackroomsAccess.SetValuablePresets(backroomsLevel, list); EmpressBackroomsPlugin.DebugLog("Empress Backrooms borrowed " + list.Count + " valuable group(s) from loaded assets."); } else { EmpressBackroomsPlugin.DebugLog("Empress Backrooms found no LevelValuables with content in memory."); } } } public static List<LevelValuables> FindValuablePool() { List<LevelValuables> valuablePresets = BackroomsAccess.GetValuablePresets(EmpressBackroomsPlugin.BackroomsLevel); if (valuablePresets != null && PoolHasContent(valuablePresets)) { return valuablePresets; } return CollectContentValuables(); } private static List<LevelValuables> CollectContentValuables() { List<LevelValuables> list = new List<LevelValuables>(); LevelValuables[] array = Resources.FindObjectsOfTypeAll<LevelValuables>(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && BackroomsAccess.PresetHasContent(array[i]) && !list.Contains(array[i])) { list.Add(array[i]); } } return list; } public static PrefabRef FindExtractionPrefab() { Level[] array = Resources.FindObjectsOfTypeAll<Level>(); int num = 0; foreach (Level val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)EmpressBackroomsPlugin.BackroomsLevel)) { num++; PrefabRef val2 = FirstValid(val.ModulesExtraction1) ?? FirstValid(val.ModulesExtraction2) ?? FirstValid(val.ModulesExtraction3); if (val2 != null) { EmpressBackroomsPlugin.DebugLog("Empress Backrooms borrowed extraction from level '" + ((Object)val).name + "'."); return val2; } } } EmpressBackroomsPlugin.DebugLog("Empress Backrooms scanned " + num + " level(s) but found no extraction module PrefabRef."); return null; } private static PrefabRef FirstValid(List<PrefabRef> refs) { if (refs == null) { return null; } for (int i = 0; i < refs.Count; i++) { if (refs[i] != null && refs[i].IsValid()) { return refs[i]; } } return null; } private static bool PoolHasContent(List<LevelValuables> presets) { for (int i = 0; i < presets.Count; i++) { if (BackroomsAccess.PresetHasContent(presets[i])) { return true; } } return false; } private static void SetLevelField(Level level, string fieldName, object value) { FieldInfo fieldInfo = AccessTools.Field(typeof(Level), fieldName); if (!(fieldInfo == null) && value != null && fieldInfo.FieldType.IsInstanceOfType(value)) { fieldInfo.SetValue(level, value); } } private static void EnsureLevelFieldInstance(Level level, string fieldName) { FieldInfo fieldInfo = AccessTools.Field(typeof(Level), fieldName); if (!(fieldInfo == null) && fieldInfo.FieldType.IsClass && !(fieldInfo.FieldType == typeof(string)) && fieldInfo.GetValue(level) == null) { object uninitializedObject = FormatterServices.GetUninitializedObject(fieldInfo.FieldType); fieldInfo.SetValue(level, uninitializedObject); } } } internal enum BackroomsTheme { Office, Pool, Dark } internal sealed class BackroomsValuableSpot { public Vector3 Position; public Vector3 Forward; public Type Type; } internal sealed class BackroomsMap { public Vector3 PlayerStart = new Vector3(0f, 1f, 0f); public readonly List<Vector3> SpawnPositions = new List<Vector3>(); public Vector3 ExtractionPosition; public Quaternion ExtractionRotation = Quaternion.identity; public readonly List<BackroomsValuableSpot> ValuableSpots = new List<BackroomsValuableSpot>(); public readonly List<Vector3> Waypoints = new List<Vector3>(); public readonly List<Vector3> EnemySpawnPoints = new List<Vector3>(); public readonly List<Light> CeilingLights = new List<Light>(); public readonly List<Renderer> CeilingPanels = new List<Renderer>(); public readonly List<GameObject> EmergencyLights = new List<GameObject>(); public Bounds NavBounds; public bool HasElevator; public Vector3 ElevatorDoorCenter; public float ElevatorDoorHalfWidth = 1.6f; public Vector3 ElevatorButtonAnchor; public Bounds ElevatorBounds; } internal static class BackroomsMapBuilder { private const int GX = 10; private const int GZ = 10; private const float C = 6.5f; private const float H = 3f; private const float T = 0.3f; private const float SublevelOpenZ = 32.5f; private const float SublevelOpenHalf = 2.2f; private const float SublevelDepth = 4f; public static BackroomsMap Build(Transform parent, int seed) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) BackroomsMaterials.EnsureCreated(); Random random = new Random(seed); BackroomsMap backroomsMap = new BackroomsMap(); bool[,] openV = new bool[10, 10]; bool[,] openH = new bool[10, 10]; CarveMaze(random, openV, openH); int num = 5; int num2 = 5; OpenAtrium(openV, openH, num, num2); BackroomsTheme[,] theme = AssignThemes(); BuildFloorsAndCeilings(parent, backroomsMap, theme, random); BuildWalls(parent, backroomsMap, theme, openV, openH); BuildPerimeter(parent, backroomsMap.ElevatorDoorHalfWidth, 32.5f, 2.2f); BuildPillars(parent); BuildPoolWater(parent, theme); BuildWaypointsAndSpawns(backroomsMap, theme, num, num2); BuildValuableSpots(backroomsMap, random, theme, num, num2); BuildSublevel(parent, backroomsMap); BuildElevator(parent, backroomsMap); backroomsMap.PlayerStart = new Vector3(0f, 1f, -5.5f); backroomsMap.ExtractionPosition = Cell(num,