Decompiled source of Black Phone 2 Mod v1.0.2

BlackPhone.dll

Decompiled 21 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BlackPhone")]
[assembly: AssemblyTitle("BlackPhone")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[BepInPlugin("com.yourname.omniphonespawner", "OmniPhone Spawner", "2.0.0")]
public class OmniPhoneBootstrap : BaseUnityPlugin
{
	private Harmony _harmony;

	public static OmniPhoneBootstrap Instance;

	public static ConfigEntry<int> CFG_PhoneCount;

	public static ConfigEntry<bool> CFG_DebugWorldLabels;

	public static ConfigEntry<bool> CFG_SnapToGround;

	public static ConfigEntry<float> CFG_PostGenDelay;

	public static ConfigEntry<bool> CFG_LogVerbose;

	public static ConfigEntry<float> CFG_RotateXDeg;

	public static ConfigEntry<bool> CFG_OnlyOncePerLevel;

	public static ConfigEntry<bool> CFG_ShowPrompt;

	public static ConfigEntry<bool> CFG_ForceRingOnSpawn;

	public static ConfigEntry<float> CFG_FirstRingDelay;

	public static ConfigEntry<bool> CFG_RingOnlyWhenInteractable;

	public static ConfigEntry<float> CFG_InteractReadyMin;

	public static ConfigEntry<float> CFG_InteractReadyMax;

	public static ConfigEntry<float> CFG_ReactivationCooldown;

	public static ConfigEntry<string> CFG_DisabledLevels;

	internal static string[] DisabledLevelTokens = Array.Empty<string>();

	internal static int GenSerialCounter = 0;

	internal static int LastSpawnedGenSerial = -1;

	internal static Level LastSpawnedLevelRef = null;

	internal static bool SpawnedThisLevel = false;

	private void Awake()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Expected O, but got Unknown
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Expected O, but got Unknown
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Expected O, but got Unknown
		//IL_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: Expected O, but got Unknown
		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Expected O, but got Unknown
		//IL_0360: Unknown result type (might be due to invalid IL or missing references)
		//IL_036a: Expected O, but got Unknown
		Instance = this;
		CFG_PhoneCount = ((BaseUnityPlugin)this).Config.Bind<int>("OmniPhone", "PhoneCount", 1, new ConfigDescription("How many phones to place per level.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>()));
		CFG_DebugWorldLabels = ((BaseUnityPlugin)this).Config.Bind<bool>("OmniPhone", "DebugWorldLabels", false, "Show a tiny 'PhoneOm' label above each spawn.");
		CFG_SnapToGround = ((BaseUnityPlugin)this).Config.Bind<bool>("OmniPhone", "SnapToGround", true, "Raycast down to rest the phone on ground.");
		CFG_PostGenDelay = ((BaseUnityPlugin)this).Config.Bind<float>("OmniPhone", "PostGenDelay", 8f, "Extra seconds to wait AFTER LevelGenerator has Generated=true.");
		CFG_LogVerbose = ((BaseUnityPlugin)this).Config.Bind<bool>("OmniPhone", "LogVerbose", false, "No-op in release.");
		CFG_RotateXDeg = ((BaseUnityPlugin)this).Config.Bind<float>("OmniPhone", "RotateXDeg", 0f, "Extra world-space rotation to apply on the X axis after placement.");
		CFG_OnlyOncePerLevel = ((BaseUnityPlugin)this).Config.Bind<bool>("OmniPhone", "OnlyOncePerLevel", true, "When true, spawn at most once per actual Level (prevents repeated spawns during generation).");
		CFG_ShowPrompt = ((BaseUnityPlugin)this).Config.Bind<bool>("OmniPhone", "ShowPrompt", false, "Show in-world interact prompt above the phone.");
		CFG_ForceRingOnSpawn = ((BaseUnityPlugin)this).Config.Bind<bool>("OmniPhone", "ForceRingOnSpawn", false, "Force the phone to ring shortly after it spawns (ignores Play On Awake on prefab).");
		CFG_FirstRingDelay = ((BaseUnityPlugin)this).Config.Bind<float>("OmniPhone", "FirstRingDelay", 1.25f, new ConfigDescription("Seconds after spawn before first ring if ForceRingOnSpawn is true.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
		CFG_RingOnlyWhenInteractable = ((BaseUnityPlugin)this).Config.Bind<bool>("OmniPhone", "RingOnlyWhenInteractable", true, "When true, the phone only rings during the window when it is actually interactable. Ring = 'click me'.");
		CFG_InteractReadyMin = ((BaseUnityPlugin)this).Config.Bind<float>("OmniPhone", "InteractReadyMin", 30f, new ConfigDescription("Minimum seconds after spawn/cooldown before the phone becomes interactable.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 600f), Array.Empty<object>()));
		CFG_InteractReadyMax = ((BaseUnityPlugin)this).Config.Bind<float>("OmniPhone", "InteractReadyMax", 300f, new ConfigDescription("Maximum seconds after spawn/cooldown before the phone becomes interactable.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 600f), Array.Empty<object>()));
		CFG_ReactivationCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("OmniPhone", "ReactivationCooldown", 120f, new ConfigDescription("Seconds after the phone is answered before it can become interactable again.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 600f), Array.Empty<object>()));
		CFG_DisabledLevels = ((BaseUnityPlugin)this).Config.Bind<string>("OmniPhone", "DisableOnLevels", "Museum", "Comma/semicolon/pipe separated substrings. If the current level name contains any of these, the spawner will skip (e.g., 'Museum').");
		DisabledLevelTokens = ParseDisabledTokens(CFG_DisabledLevels.Value);
		PhonePrefabManager.MaxPhonesPerLevel = CFG_PhoneCount.Value;
		PhonePrefabManager.DebugWorldLabels = CFG_DebugWorldLabels.Value;
		PhonePrefabManager.SnapToGround = CFG_SnapToGround.Value;
		PhonePrefabManager.RotateXDeg = CFG_RotateXDeg.Value;
		PhonePrefabManager.ShowPrompt = CFG_ShowPrompt.Value;
		PhonePrefabManager.ForceRingOnSpawn = CFG_ForceRingOnSpawn.Value;
		PhonePrefabManager.FirstRingDelay = Mathf.Max(0f, CFG_FirstRingDelay.Value);
		PhonePrefabManager.RingOnlyWhenInteractable = CFG_RingOnlyWhenInteractable.Value;
		PhonePrefabManager.InteractReadyMin = Mathf.Max(0f, CFG_InteractReadyMin.Value);
		PhonePrefabManager.InteractReadyMax = Mathf.Max(PhonePrefabManager.InteractReadyMin, CFG_InteractReadyMax.Value);
		PhonePrefabManager.ReactivateCooldown = Mathf.Max(0f, CFG_ReactivationCooldown.Value);
		_harmony = new Harmony("com.yourname.omniphonespawner");
		_harmony.PatchAll();
		SpawnWatchdog.Ensure();
	}

	private void OnDestroy()
	{
		try
		{
			_harmony.UnpatchSelf();
		}
		catch
		{
		}
		PhonePrefabManager.UnloadBundle(unloadAllLoadedObjects: true);
	}

	internal static void Log(string msg)
	{
	}

	internal static void LogWarn(string msg)
	{
	}

	private static string[] ParseDisabledTokens(string raw)
	{
		if (string.IsNullOrWhiteSpace(raw))
		{
			return Array.Empty<string>();
		}
		string[] array = (from s in raw.Split(new char[3] { ',', ';', '|' }, StringSplitOptions.RemoveEmptyEntries)
			select s.Trim().ToLowerInvariant() into s
			where s.Length > 0
			select s).Distinct().ToArray();
		return (array.Length == 0) ? Array.Empty<string>() : array;
	}

	internal static bool LevelIsDisabledByName(string levelName = null)
	{
		if (DisabledLevelTokens == null || DisabledLevelTokens.Length == 0)
		{
			return false;
		}
		string text = (levelName ?? Patch_LevelGenerator_Generate.SafeLevelName()) ?? "";
		string text2 = text.ToLowerInvariant();
		for (int i = 0; i < DisabledLevelTokens.Length; i++)
		{
			if (text2.Contains(DisabledLevelTokens[i]))
			{
				return true;
			}
		}
		return false;
	}
}
[HarmonyPatch(typeof(LevelGenerator), "Generate")]
public static class Patch_LevelGenerator_Generate
{
	[CompilerGenerated]
	private sealed class <CoSpawnAfterGen>d__2 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public int genSerial;

		private LevelGenerator <lg>5__1;

		private float <timeout>5__2;

		private float <postDelay>5__3;

		private string <levelTag>5__4;

		private Level <curLevel>5__5;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <CoSpawnAfterGen>d__2(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<lg>5__1 = null;
			<levelTag>5__4 = null;
			<curLevel>5__5 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				goto IL_0050;
			case 1:
				<>1__state = -1;
				goto IL_0050;
			case 2:
				<>1__state = -1;
				goto IL_00b9;
			case 3:
				{
					<>1__state = -1;
					break;
				}
				IL_0050:
				if (LooksLikeMenuOrSplash())
				{
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				<lg>5__1 = null;
				<timeout>5__2 = Time.time + 30f;
				goto IL_00b9;
				IL_00b9:
				if (Time.time < <timeout>5__2)
				{
					<lg>5__1 = LevelGenerator.Instance;
					if (!((Object)(object)<lg>5__1 != (Object)null) || !<lg>5__1.Generated)
					{
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
				}
				if ((Object)(object)<lg>5__1 == (Object)null || !<lg>5__1.Generated)
				{
					return false;
				}
				<postDelay>5__3 = Mathf.Max(0f, OmniPhoneBootstrap.CFG_PostGenDelay.Value);
				if (<postDelay>5__3 > 0f)
				{
					<>2__current = (object)new WaitForSeconds(<postDelay>5__3);
					<>1__state = 3;
					return true;
				}
				break;
			}
			<levelTag>5__4 = SafeLevelName();
			if (OmniPhoneBootstrap.LevelIsDisabledByName(<levelTag>5__4))
			{
				return false;
			}
			if (OmniPhoneBootstrap.CFG_OnlyOncePerLevel.Value)
			{
				<curLevel>5__5 = null;
				try
				{
					<curLevel>5__5 = <lg>5__1.Level;
				}
				catch
				{
				}
				if ((Object)(object)<curLevel>5__5 != (Object)null && OmniPhoneBootstrap.SpawnedThisLevel && (Object)(object)OmniPhoneBootstrap.LastSpawnedLevelRef == (Object)(object)<curLevel>5__5)
				{
					return false;
				}
				<curLevel>5__5 = null;
			}
			if (OmniPhoneBootstrap.LastSpawnedGenSerial == genSerial)
			{
				return false;
			}
			DoTrySpawnForCurrentLevel(genSerial);
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private static void Prefix(LevelGenerator __instance)
	{
		OmniPhoneBootstrap.GenSerialCounter++;
	}

	private static void Postfix(LevelGenerator __instance)
	{
		int genSerialCounter = OmniPhoneBootstrap.GenSerialCounter;
		if ((Object)(object)OmniPhoneBootstrap.Instance != (Object)null)
		{
			((MonoBehaviour)OmniPhoneBootstrap.Instance).StartCoroutine(CoSpawnAfterGen(genSerialCounter));
		}
	}

	[IteratorStateMachine(typeof(<CoSpawnAfterGen>d__2))]
	private static IEnumerator CoSpawnAfterGen(int genSerial)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <CoSpawnAfterGen>d__2(0)
		{
			genSerial = genSerial
		};
	}

	internal static void DoTrySpawnForCurrentLevel(int genSerial)
	{
		if (LooksLikeMenuOrSplash() || !PhonePrefabManager.EnsurePrefabLoaded())
		{
			return;
		}
		string levelName = SafeLevelName();
		if (OmniPhoneBootstrap.LevelIsDisabledByName(levelName))
		{
			return;
		}
		Level val = null;
		try
		{
			val = (((Object)(object)LevelGenerator.Instance != (Object)null) ? LevelGenerator.Instance.Level : null);
		}
		catch
		{
		}
		if (!OmniPhoneBootstrap.CFG_OnlyOncePerLevel.Value || !((Object)(object)val != (Object)null) || !OmniPhoneBootstrap.SpawnedThisLevel || !((Object)(object)OmniPhoneBootstrap.LastSpawnedLevelRef == (Object)(object)val))
		{
			PhonePrefabManager.ClearAllSpawnedPhones();
			List<Transform> list = PhonePrefabManager.FindLikelyLevelPoints_CurrentWorld();
			if (list.Count == 0)
			{
				PhonePrefabManager.SpawnFallbackNearLocal();
				OmniPhoneBootstrap.LastSpawnedGenSerial = genSerial;
				OmniPhoneBootstrap.LastSpawnedLevelRef = val;
				OmniPhoneBootstrap.SpawnedThisLevel = true;
			}
			else
			{
				PhonePrefabManager.SpawnPhonesFromPoints(list);
				OmniPhoneBootstrap.LastSpawnedGenSerial = genSerial;
				OmniPhoneBootstrap.LastSpawnedLevelRef = val;
				OmniPhoneBootstrap.SpawnedThisLevel = true;
			}
		}
	}

	internal static bool LooksLikeMenuOrSplash()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (SemiFunc.IsMainMenu())
			{
				return true;
			}
			if (SemiFunc.MenuLevel())
			{
				return true;
			}
		}
		catch
		{
		}
		Scene activeScene = SceneManager.GetActiveScene();
		string text = ((Scene)(ref activeScene)).name ?? string.Empty;
		if (text.IndexOf("Lobby", StringComparison.OrdinalIgnoreCase) >= 0)
		{
			return true;
		}
		if (text.IndexOf("Menu", StringComparison.OrdinalIgnoreCase) >= 0)
		{
			return true;
		}
		if (text.IndexOf("Title", StringComparison.OrdinalIgnoreCase) >= 0)
		{
			return true;
		}
		if (text.IndexOf("Splash", StringComparison.OrdinalIgnoreCase) >= 0)
		{
			return true;
		}
		return false;
	}

	internal static string SafeLevelName()
	{
		//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)
		try
		{
			RunManager instance = RunManager.instance;
			if ((Object)(object)instance != (Object)null && (Object)(object)instance.levelCurrent != (Object)null)
			{
				return ((Object)instance.levelCurrent).name;
			}
		}
		catch
		{
		}
		try
		{
			LevelGenerator instance2 = LevelGenerator.Instance;
			if ((Object)(object)instance2 != (Object)null && (Object)(object)instance2.Level != (Object)null)
			{
				return ((Object)instance2.Level).name;
			}
		}
		catch
		{
		}
		Scene activeScene = SceneManager.GetActiveScene();
		return ((Scene)(ref activeScene)).name ?? "unknown";
	}
}
[HarmonyPatch(typeof(RunManager), "ChangeLevel")]
public static class Patch_RunManager_ChangeLevel
{
	private static void Postfix()
	{
		OmniPhoneBootstrap.SpawnedThisLevel = false;
		OmniPhoneBootstrap.LastSpawnedLevelRef = null;
		OmniPhoneBootstrap.LastSpawnedGenSerial = -1;
		PhonePrefabManager.ClearAllSpawnedPhones();
	}
}
public class SpawnWatchdog : MonoBehaviour
{
	private static SpawnWatchdog _i;

	private float _nextCheckAt;

	internal static float Patch_LevelGenerator_Generate_CachedGeneratedAt = -1f;

	public static void Ensure()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		if (!((Object)(object)_i != (Object)null))
		{
			GameObject val = new GameObject("[OmniPhoneSpawner] SpawnWatchdog");
			Object.DontDestroyOnLoad((Object)(object)val);
			_i = val.AddComponent<SpawnWatchdog>();
		}
	}

	private void Update()
	{
		if (Time.time < _nextCheckAt)
		{
			return;
		}
		_nextCheckAt = Time.time + 1f;
		int genSerialCounter = OmniPhoneBootstrap.GenSerialCounter;
		if (genSerialCounter <= 0 || OmniPhoneBootstrap.LastSpawnedGenSerial == genSerialCounter)
		{
			return;
		}
		LevelGenerator instance = LevelGenerator.Instance;
		if ((Object)(object)instance == (Object)null || !instance.Generated)
		{
			return;
		}
		if (Patch_LevelGenerator_Generate_CachedGeneratedAt < 0f)
		{
			Patch_LevelGenerator_Generate_CachedGeneratedAt = Time.time;
		}
		if (Time.time - Patch_LevelGenerator_Generate_CachedGeneratedAt < OmniPhoneBootstrap.CFG_PostGenDelay.Value)
		{
			return;
		}
		string levelName = Patch_LevelGenerator_Generate.SafeLevelName();
		if (OmniPhoneBootstrap.LevelIsDisabledByName(levelName))
		{
			return;
		}
		if (OmniPhoneBootstrap.CFG_OnlyOncePerLevel.Value)
		{
			try
			{
				Level level = instance.Level;
				if ((Object)(object)level != (Object)null && OmniPhoneBootstrap.SpawnedThisLevel && (Object)(object)OmniPhoneBootstrap.LastSpawnedLevelRef == (Object)(object)level)
				{
					return;
				}
			}
			catch
			{
			}
		}
		Patch_LevelGenerator_Generate.DoTrySpawnForCurrentLevel(genSerialCounter);
	}
}
public static class PhonePrefabManager
{
	public class PhoneOmSeedHint : MonoBehaviour
	{
		public Vector3 SeedWorld;
	}

	private const string PrefabName = "PhoneOm";

	private const string BundleBaseName = "omblackphone";

	private static AssetBundle _loadedBundle;

	private static GameObject _cachedPrefab;

	private static readonly List<GameObject> _spawned = new List<GameObject>();

	private static string _pluginDir;

	public static int MaxPhonesPerLevel = 1;

	public static bool DebugWorldLabels = false;

	public static bool SnapToGround = true;

	public static float RotateXDeg = -90f;

	public static bool ShowPrompt = false;

	public static bool ForceRingOnSpawn = false;

	public static float FirstRingDelay = 1.25f;

	public static bool RingOnlyWhenInteractable = true;

	public static float InteractReadyMin = 30f;

	public static float InteractReadyMax = 300f;

	public static float ReactivateCooldown = 120f;

	private static readonly string[] NEEDLES = new string[15]
	{
		"levelpoint", "level spawn", "levelspawn", "enemyspawn", "spawnpoint", "spawn point", "aispawn", "respawnpoint", "respawn", "wavespawn",
		"spawner", "ghostspawn", "eventspawn", "huntspawn", "ghostpoint"
	};

	public static void ProbeBundleOnce()
	{
	}

	private static string GetPluginDir()
	{
		if (!string.IsNullOrEmpty(_pluginDir))
		{
			return _pluginDir;
		}
		try
		{
			OmniPhoneBootstrap instance = OmniPhoneBootstrap.Instance;
			object obj;
			if (instance == null)
			{
				obj = null;
			}
			else
			{
				PluginInfo info = ((BaseUnityPlugin)instance).Info;
				obj = ((info != null) ? info.Location : null);
			}
			string text = (string)obj;
			if (string.IsNullOrEmpty(text))
			{
				text = Assembly.GetExecutingAssembly().Location;
			}
			_pluginDir = Path.GetDirectoryName(text);
			if (string.IsNullOrEmpty(_pluginDir))
			{
				_pluginDir = Directory.GetCurrentDirectory();
			}
		}
		catch
		{
			_pluginDir = Directory.GetCurrentDirectory();
		}
		return _pluginDir;
	}

	public static bool EnsurePrefabLoaded()
	{
		if ((Object)(object)_cachedPrefab != (Object)null)
		{
			return true;
		}
		string pluginDir = GetPluginDir();
		string[] array = new string[4] { "omblackphone", "omblackphone.unity3d", "omblackphone.assetbundle", "omblackphone.bundle" };
		for (int i = 0; i < array.Length; i++)
		{
			string text = Path.Combine(pluginDir, array[i]);
			if (!File.Exists(text))
			{
				continue;
			}
			try
			{
				_loadedBundle = AssetBundle.LoadFromFile(text);
				if (!((Object)(object)_loadedBundle == (Object)null))
				{
					GameObject val = _loadedBundle.LoadAsset<GameObject>("PhoneOm");
					if ((Object)(object)val != (Object)null)
					{
						_cachedPrefab = val;
						return true;
					}
					GameObject val2 = ((IEnumerable<GameObject>)_loadedBundle.LoadAllAssets<GameObject>()).FirstOrDefault((Func<GameObject, bool>)((GameObject a) => Object.op_Implicit((Object)(object)a) && string.Equals(((Object)a).name, "PhoneOm", StringComparison.OrdinalIgnoreCase)));
					if ((Object)(object)val2 != (Object)null)
					{
						_cachedPrefab = val2;
						return true;
					}
					_loadedBundle.Unload(false);
					_loadedBundle = null;
				}
			}
			catch
			{
				if ((Object)(object)_loadedBundle != (Object)null)
				{
					try
					{
						_loadedBundle.Unload(false);
					}
					catch
					{
					}
					_loadedBundle = null;
				}
			}
		}
		return false;
	}

	public static void ClearAllSpawnedPhones()
	{
		for (int num = _spawned.Count - 1; num >= 0; num--)
		{
			GameObject val = _spawned[num];
			if (Object.op_Implicit((Object)(object)val))
			{
				Object.Destroy((Object)(object)val);
			}
			_spawned.RemoveAt(num);
		}
	}

	public static void UnloadBundle(bool unloadAllLoadedObjects = false)
	{
		ClearAllSpawnedPhones();
		if ((Object)(object)_loadedBundle != (Object)null)
		{
			try
			{
				_loadedBundle.Unload(unloadAllLoadedObjects);
			}
			catch
			{
			}
			_loadedBundle = null;
			_cachedPrefab = null;
		}
	}

	internal static bool TryGetAudioClip(string name, out AudioClip clip)
	{
		string name2 = name;
		clip = null;
		try
		{
			if ((Object)(object)_loadedBundle == (Object)null)
			{
				return false;
			}
			clip = _loadedBundle.LoadAsset<AudioClip>(name2);
			if ((Object)(object)clip != (Object)null)
			{
				return true;
			}
			AudioClip[] source = _loadedBundle.LoadAllAssets<AudioClip>();
			clip = ((IEnumerable<AudioClip>)source).FirstOrDefault((Func<AudioClip, bool>)((AudioClip a) => (Object)(object)a != (Object)null && string.Equals(((Object)a).name, name2, StringComparison.OrdinalIgnoreCase)));
			return (Object)(object)clip != (Object)null;
		}
		catch
		{
			clip = null;
			return false;
		}
	}

	private static bool LooksLikeSpawnType(string typeNameLower)
	{
		for (int i = 0; i < NEEDLES.Length; i++)
		{
			if (typeNameLower.Contains(NEEDLES[i]))
			{
				return true;
			}
		}
		return false;
	}

	private static bool LooksLikeSpawnName(string nameLower)
	{
		for (int i = 0; i < NEEDLES.Length; i++)
		{
			if (nameLower.Contains(NEEDLES[i]))
			{
				return true;
			}
		}
		return false;
	}

	public static List<Transform> FindLikelyLevelPoints_CurrentWorld()
	{
		List<Transform> list = new List<Transform>(128);
		MonoBehaviour[] array = Object.FindObjectsOfType<MonoBehaviour>(true);
		foreach (MonoBehaviour val in array)
		{
			if ((Object)(object)val == (Object)null)
			{
				continue;
			}
			GameObject gameObject = ((Component)val).gameObject;
			if (Object.op_Implicit((Object)(object)gameObject) && gameObject.activeInHierarchy && !((Object)gameObject).name.StartsWith("[OmniPhoneSpawner]"))
			{
				string typeNameLower = ((object)val).GetType().Name.ToLowerInvariant();
				if (LooksLikeSpawnType(typeNameLower))
				{
					list.Add(((Component)val).transform);
				}
			}
		}
		Transform[] array2 = Object.FindObjectsOfType<Transform>(true);
		foreach (Transform val2 in array2)
		{
			if ((Object)(object)val2 == (Object)null)
			{
				continue;
			}
			GameObject gameObject2 = ((Component)val2).gameObject;
			if (Object.op_Implicit((Object)(object)gameObject2) && gameObject2.activeInHierarchy && !((Object)gameObject2).name.StartsWith("[OmniPhoneSpawner]"))
			{
				string nameLower = ((Object)val2).name.ToLowerInvariant();
				if (LooksLikeSpawnName(nameLower))
				{
					list.Add(val2);
				}
			}
		}
		return list.Distinct().ToList();
	}

	public static void SpawnPhonesFromPoints(List<Transform> points)
	{
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: 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_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		if (points == null || points.Count == 0)
		{
			SpawnFallbackNearLocal();
			return;
		}
		for (int i = 0; i < points.Count; i++)
		{
			int num = Random.Range(i, points.Count);
			int index = i;
			int index2 = num;
			Transform value = points[num];
			Transform value2 = points[i];
			points[index] = value;
			points[index2] = value2;
		}
		int num2 = Mathf.Clamp(MaxPhonesPerLevel, 1, points.Count);
		int num3 = 0;
		NavMeshHit val3 = default(NavMeshHit);
		RaycastHit val5 = default(RaycastHit);
		for (int j = 0; j < points.Count; j++)
		{
			if (num3 >= num2)
			{
				break;
			}
			Transform val = points[j];
			if ((Object)(object)val == (Object)null)
			{
				continue;
			}
			Vector3 val2 = val.position;
			Quaternion rotation = val.rotation;
			if (NavMesh.SamplePosition(val2, ref val3, 3f, -1))
			{
				val2 = ((NavMeshHit)(ref val3)).position;
			}
			if (SnapToGround)
			{
				Vector3 val4 = val2 + Vector3.up * 2f;
				if (Physics.Raycast(val4, Vector3.down, ref val5, 6f, -1, (QueryTriggerInteraction)1))
				{
					val2 = ((RaycastHit)(ref val5)).point + Vector3.up * 0.02f;
				}
			}
			if (HasGroundSupport(val2, 4f))
			{
				SpawnOne(val2, rotation, num3, ((Object)val).name, val.position);
				num3++;
			}
		}
		if (num3 == 0)
		{
			SpawnFallbackNearLocal();
		}
	}

	private static bool HasGroundSupport(Vector3 posOnMesh, float maxDown)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = posOnMesh + Vector3.up * 1.5f;
		RaycastHit val2 = default(RaycastHit);
		return Physics.Raycast(val, Vector3.down, ref val2, 1.5f + maxDown, -1, (QueryTriggerInteraction)1);
	}

	public static void SpawnFallbackNearLocal()
	{
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_cachedPrefab == (Object)null && !EnsurePrefabLoaded())
		{
			return;
		}
		PlayerAvatar val = FindLocalPlayer();
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		Transform transform = ((Component)val).transform;
		float num = 6f;
		float num2 = ((Random.value < 0.5f) ? (-2f) : 2f);
		Vector3 val2 = transform.position - transform.forward * num + transform.right * num2;
		Quaternion baseRotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
		if (SnapToGround)
		{
			Vector3 val3 = val2 + Vector3.up * 2f;
			RaycastHit val4 = default(RaycastHit);
			if (Physics.Raycast(val3, Vector3.down, ref val4, 6f, -1, (QueryTriggerInteraction)1))
			{
				val2 = ((RaycastHit)(ref val4)).point + Vector3.up * 0.02f;
			}
		}
		SpawnOne(val2, baseRotation, 0, "FallbackNearLocal", val2);
	}

	private static void SpawnOne(Vector3 position, Quaternion baseRotation, int index, string label, Vector3 seedWorld)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)_cachedPrefab == (Object)null) || EnsurePrefabLoaded())
		{
			Quaternion val = Quaternion.Euler(RotateXDeg, 0f, 0f) * baseRotation;
			GameObject val2 = Object.Instantiate<GameObject>(_cachedPrefab, position, val);
			((Object)val2).name = "PhoneOm (Level Point)";
			if (DebugWorldLabels)
			{
				AttachLabel(val2.transform, "PhoneOm");
			}
			Collider val3 = val2.GetComponentInChildren<Collider>();
			if ((Object)(object)val3 == (Object)null)
			{
				val3 = (Collider)(object)val2.AddComponent<SphereCollider>();
			}
			SphereCollider val4 = (SphereCollider)(object)((val3 is SphereCollider) ? val3 : null);
			if (val4 != null)
			{
				((Collider)val4).isTrigger = true;
				val4.radius = Mathf.Max(1f, val4.radius);
			}
			else
			{
				val3.isTrigger = true;
			}
			if ((Object)(object)val2.GetComponent<PhoneOmBehaviour>() == (Object)null)
			{
				val2.AddComponent<PhoneOmBehaviour>();
			}
			PhoneOmSeedHint phoneOmSeedHint = val2.AddComponent<PhoneOmSeedHint>();
			phoneOmSeedHint.SeedWorld = seedWorld;
			if ((Object)(object)val2.GetComponent<PhoneOmInteractFX>() == (Object)null)
			{
				val2.AddComponent<PhoneOmInteractFX>();
			}
			_spawned.Add(val2);
		}
	}

	private static void AttachLabel(Transform root, string text)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Expected O, but got Unknown
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			GameObject val = new GameObject("Phone_Label");
			val.transform.SetParent(root, false);
			val.transform.localPosition = new Vector3(0f, 1.1f, 0f);
			TextMesh val2 = val.AddComponent<TextMesh>();
			val2.text = text;
			val2.fontSize = 42;
			val2.characterSize = 0.03f;
			val2.color = Color.white;
			val.AddComponent<SimpleBillboard>();
		}
		catch
		{
		}
	}

	private static PlayerAvatar FindLocalPlayer()
	{
		try
		{
			PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(true);
			foreach (PlayerAvatar val in array)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Type type = ((object)val).GetType();
				try
				{
					FieldInfo field = type.GetField("isLocal", BindingFlags.Instance | BindingFlags.NonPublic);
					if (field != null && field.FieldType == typeof(bool) && (bool)field.GetValue(val))
					{
						return val;
					}
				}
				catch
				{
				}
				try
				{
					PropertyInfo property = type.GetProperty("IsLocal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					if (property != null && property.PropertyType == typeof(bool) && (bool)property.GetValue(val))
					{
						return val;
					}
				}
				catch
				{
				}
			}
		}
		catch
		{
		}
		return null;
	}
}
public class PhoneOmBehaviour : MonoBehaviour
{
	private enum Phase
	{
		Warmup,
		Active,
		Cooldown,
		Legacy
	}

	[CompilerGenerated]
	private sealed class <HallucinationRoutine>d__27 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public float seconds;

		public PhoneOmBehaviour <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <HallucinationRoutine>d__27(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(seconds);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <Ticker>d__21 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public PhoneOmBehaviour <>4__this;

		private float <min>5__1;

		private float <max>5__2;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <Ticker>d__21(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (Object.op_Implicit((Object)(object)<>4__this) && Object.op_Implicit((Object)(object)((Component)<>4__this).gameObject))
			{
				if (PhonePrefabManager.RingOnlyWhenInteractable)
				{
					if (<>4__this._phase == Phase.Warmup && Time.time >= <>4__this._nextActivateAt)
					{
						<>4__this.StartRinging();
						<>4__this._phase = Phase.Active;
					}
					if (<>4__this._phase == Phase.Active)
					{
						if (<>4__this._isRinging)
						{
							<>4__this.TryHandleLocalInteract();
						}
						else
						{
							<>4__this.StartRinging();
						}
					}
					if (<>4__this._phase == Phase.Cooldown && Time.time >= <>4__this._nextActivateAt)
					{
						<min>5__1 = Mathf.Max(0f, PhonePrefabManager.InteractReadyMin);
						<max>5__2 = Mathf.Max(<min>5__1, PhonePrefabManager.InteractReadyMax);
						<>4__this._nextActivateAt = Time.time + Random.Range(<min>5__1, <max>5__2);
						<>4__this._phase = Phase.Warmup;
					}
				}
				else
				{
					if (!<>4__this._isRinging && Time.time >= <>4__this._nextRingAt)
					{
						<>4__this.StartRinging();
					}
					if (<>4__this._isRinging)
					{
						<>4__this.TryHandleLocalInteract();
					}
				}
				if (PhonePrefabManager.ShowPrompt)
				{
					<>4__this.UpdatePromptVisual();
				}
				<>2__current = null;
				<>1__state = 1;
				return true;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[Header("Timing (legacy ring window — used only if RingOnlyWhenInteractable=false)")]
	public float ringMin = 45f;

	public float ringMax = 90f;

	public float effectDuration = 25f;

	[Header("Audio")]
	[Tooltip("If true, leave audio alone and let the prefab/scripts drive it.")]
	public bool prefabControlsAudio = false;

	private float _nextRingAt;

	private float _nextActivateAt;

	private bool _isRinging;

	private AudioSource _ringer;

	private TextMesh _promptText;

	private float _promptFade;

	private Phase _phase = Phase.Legacy;

	private PlayerAvatar _localPlayer;

	private Transform _localTr;

	private float _nextLocalRefreshAt = 0f;

	private float _nextNearPollAt = 0f;

	private const float LOCAL_REFRESH_PERIOD = 2f;

	private const float NEAR_POLL_PERIOD = 0.1f;

	private const float INTERACT_DIST = 2.4f;

	private static readonly float INTERACT_DIST_SQR = 5.76f;

	private void Awake()
	{
		AudioSource[] source = ((Component)this).GetComponentsInChildren<AudioSource>(true) ?? Array.Empty<AudioSource>();
		_ringer = ((IEnumerable<AudioSource>)source).FirstOrDefault((Func<AudioSource, bool>)((AudioSource s) => (Object)(object)s != (Object)null && (Object)(object)s.clip != (Object)null)) ?? ((IEnumerable<AudioSource>)source).FirstOrDefault((Func<AudioSource, bool>)((AudioSource s) => (Object)(object)s != (Object)null)) ?? ((Component)this).gameObject.AddComponent<AudioSource>();
		if ((Object)(object)_ringer.clip == (Object)null && PhonePrefabManager.TryGetAudioClip("RingaDing", out AudioClip clip))
		{
			_ringer.clip = clip;
		}
		_ringer.playOnAwake = false;
		_ringer.spatialBlend = 1f;
		if (!prefabControlsAudio)
		{
			_ringer.loop = true;
		}
		if (PhonePrefabManager.RingOnlyWhenInteractable)
		{
			_phase = Phase.Warmup;
			float num = Mathf.Max(0f, PhonePrefabManager.InteractReadyMin);
			float num2 = Mathf.Max(num, PhonePrefabManager.InteractReadyMax);
			if (PhonePrefabManager.ForceRingOnSpawn)
			{
				_nextActivateAt = Time.time + Mathf.Max(0f, PhonePrefabManager.FirstRingDelay);
			}
			else
			{
				_nextActivateAt = Time.time + Random.Range(num, num2);
			}
		}
		else
		{
			_phase = Phase.Legacy;
			_nextRingAt = Time.time + (PhonePrefabManager.ForceRingOnSpawn ? Mathf.Max(0f, PhonePrefabManager.FirstRingDelay) : Random.Range(ringMin, ringMax));
		}
		((MonoBehaviour)this).StartCoroutine(Ticker());
	}

	[IteratorStateMachine(typeof(<Ticker>d__21))]
	private IEnumerator Ticker()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <Ticker>d__21(0)
		{
			<>4__this = this
		};
	}

	private void StartRinging()
	{
		_isRinging = true;
		if (!prefabControlsAudio && (Object)(object)_ringer != (Object)null && (Object)(object)_ringer.clip != (Object)null)
		{
			_ringer.mute = false;
			((Behaviour)_ringer).enabled = true;
			if (!_ringer.isPlaying)
			{
				_ringer.Play();
			}
		}
		((Component)this).gameObject.BroadcastMessage("OnBlackPhoneRingStart", (SendMessageOptions)1);
	}

	private void StopRinging()
	{
		_isRinging = false;
		if (!prefabControlsAudio && (Object)(object)_ringer != (Object)null && _ringer.isPlaying)
		{
			_ringer.Stop();
		}
		((Component)this).gameObject.BroadcastMessage("OnBlackPhoneRingStop", (SendMessageOptions)1);
		if (PhonePrefabManager.RingOnlyWhenInteractable)
		{
			HidePrompt();
		}
		else
		{
			_nextRingAt = Time.time + Random.Range(ringMin, ringMax);
		}
	}

	private void TryHandleLocalInteract()
	{
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		if (Time.time >= _nextLocalRefreshAt || (Object)(object)_localPlayer == (Object)null || (Object)(object)_localTr == (Object)null)
		{
			_localPlayer = FindLocalPlayer();
			_localTr = (((Object)(object)_localPlayer != (Object)null) ? ((Component)_localPlayer).transform : null);
			_nextLocalRefreshAt = Time.time + 2f;
		}
		if ((Object)(object)_localTr == (Object)null || Time.time < _nextNearPollAt)
		{
			return;
		}
		_nextNearPollAt = Time.time + 0.1f;
		Vector3 val = _localTr.position - ((Component)this).transform.position;
		float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
		bool flag = sqrMagnitude <= INTERACT_DIST_SQR;
		if (flag && PhonePrefabManager.ShowPrompt)
		{
			ShowPrompt("Press [interact] to answer");
		}
		else
		{
			HidePrompt();
		}
		if (flag && (Object)(object)InputManager.instance != (Object)null && InputManager.instance.KeyDown((InputKey)2))
		{
			StopRinging();
			((Component)this).gameObject.BroadcastMessage("OnBlackPhoneAnswered", (SendMessageOptions)1);
			((MonoBehaviour)this).StartCoroutine(HallucinationRoutine(effectDuration));
			if (PhonePrefabManager.RingOnlyWhenInteractable)
			{
				BeginCooldown();
			}
		}
	}

	private void BeginCooldown()
	{
		_phase = Phase.Cooldown;
		float num = Mathf.Max(0f, PhonePrefabManager.ReactivateCooldown);
		_nextActivateAt = Time.time + num;
	}

	private PlayerAvatar FindLocalPlayer()
	{
		PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(true);
		foreach (PlayerAvatar val in array)
		{
			if ((Object)(object)val == (Object)null)
			{
				continue;
			}
			Type type = ((object)val).GetType();
			try
			{
				FieldInfo field = type.GetField("isLocal", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field != null && field.FieldType == typeof(bool) && (bool)field.GetValue(val))
				{
					return val;
				}
			}
			catch
			{
			}
			try
			{
				PropertyInfo property = type.GetProperty("IsLocal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (property != null && property.PropertyType == typeof(bool) && (bool)property.GetValue(val))
				{
					return val;
				}
			}
			catch
			{
			}
		}
		return null;
	}

	[IteratorStateMachine(typeof(<HallucinationRoutine>d__27))]
	private IEnumerator HallucinationRoutine(float seconds)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <HallucinationRoutine>d__27(0)
		{
			<>4__this = this,
			seconds = seconds
		};
	}

	private void ShowPrompt(string raw)
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		//IL_0059: 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)
		if (PhonePrefabManager.ShowPrompt)
		{
			if ((Object)(object)_promptText == (Object)null)
			{
				GameObject val = new GameObject("BP_Prompt");
				val.transform.SetParent(((Component)this).transform, false);
				val.transform.localPosition = new Vector3(0f, 1.15f, 0f);
				_promptText = val.AddComponent<TextMesh>();
				_promptText.anchor = (TextAnchor)4;
				_promptText.fontSize = 64;
				_promptText.characterSize = 0.03f;
				_promptText.color = new Color(1f, 1f, 1f, 0f);
				val.AddComponent<SimpleBillboard>();
			}
			string text = raw;
			if ((Object)(object)InputManager.instance != (Object)null)
			{
				text = InputManager.instance.InputDisplayReplaceTags(raw);
			}
			if (_promptText.text != text)
			{
				_promptText.text = text;
			}
			_promptFade = Mathf.Min(1f, _promptFade + Time.deltaTime * 8f);
		}
	}

	private void HidePrompt()
	{
		if (PhonePrefabManager.ShowPrompt)
		{
			_promptFade = Mathf.Max(0f, _promptFade - Time.deltaTime * 8f);
		}
	}

	private void UpdatePromptVisual()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		if (PhonePrefabManager.ShowPrompt && !((Object)(object)_promptText == (Object)null))
		{
			Color color = _promptText.color;
			color.a = Mathf.Lerp(color.a, _promptFade, 0.3f);
			_promptText.color = color;
		}
	}
}
public class SimpleBillboard : MonoBehaviour
{
	private void LateUpdate()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		Camera main = Camera.main;
		if (Object.op_Implicit((Object)(object)main))
		{
			((Component)this).transform.rotation = Quaternion.LookRotation(((Component)this).transform.position - ((Component)main).transform.position);
		}
	}
}
public class PhoneOmInteractFX : MonoBehaviour
{
	private sealed class ExtenderHost : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <RunAndClean>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public IEnumerator co;

			public ExtenderHost <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <RunAndClean>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(co);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					Object.Destroy((Object)(object)((Component)<>4__this).gameObject);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static void Run(IEnumerator co)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			GameObject val = new GameObject("BP_Extender");
			Object.DontDestroyOnLoad((Object)(object)val);
			ExtenderHost extenderHost = val.AddComponent<ExtenderHost>();
			((MonoBehaviour)extenderHost).StartCoroutine(extenderHost.RunAndClean(co));
		}

		[IteratorStateMachine(typeof(<RunAndClean>d__1))]
		private IEnumerator RunAndClean(IEnumerator co)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <RunAndClean>d__1(0)
			{
				<>4__this = this,
				co = co
			};
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass133_0
	{
		public ChromaticAberration chroma;

		public Func<float> <>9__0;

		public Action<float> <>9__1;

		public Func<float> <>9__2;

		public Action<float> <>9__3;

		internal float <DoChromaticBursts>b__0()
		{
			return ((ParameterOverride<float>)(object)chroma.intensity).value;
		}

		internal void <DoChromaticBursts>b__1(float v)
		{
			((ParameterOverride<float>)(object)chroma.intensity).value = Mathf.Clamp01(v);
		}

		internal float <DoChromaticBursts>b__2()
		{
			return ((ParameterOverride<float>)(object)chroma.intensity).value;
		}

		internal void <DoChromaticBursts>b__3(float v)
		{
			((ParameterOverride<float>)(object)chroma.intensity).value = Mathf.Clamp01(v);
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass134_0
	{
		public LensDistortion lens;

		public Func<float> <>9__0;

		public Action<float> <>9__1;

		public Func<float> <>9__2;

		public Action<float> <>9__3;

		internal float <DoLensWarpPulses>b__0()
		{
			return ((ParameterOverride<float>)(object)lens.intensity).value;
		}

		internal void <DoLensWarpPulses>b__1(float v)
		{
			((ParameterOverride<float>)(object)lens.intensity).value = v;
		}

		internal float <DoLensWarpPulses>b__2()
		{
			return ((ParameterOverride<float>)(object)lens.intensity).value;
		}

		internal void <DoLensWarpPulses>b__3(float v)
		{
			((ParameterOverride<float>)(object)lens.intensity).value = v;
		}
	}

	[CompilerGenerated]
	private sealed class <AnimateFloat>d__145 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public float tIn;

		public float hold;

		public float tOut;

		public Func<float> read;

		public Action<float> write;

		public float from;

		public float to;

		public PhoneOmInteractFX <>4__this;

		private float <t>5__1;

		private float <k>5__2;

		private float <h>5__3;

		private float <curr>5__4;

		private float <t>5__5;

		private float <k>5__6;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <AnimateFloat>d__145(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				if (write == null)
				{
					return false;
				}
				if (tIn > 0f)
				{
					<t>5__1 = 0f;
					goto IL_00ed;
				}
				write(to);
				<>2__current = null;
				<>1__state = 2;
				return true;
			case 1:
				<>1__state = -1;
				goto IL_00ed;
			case 2:
				<>1__state = -1;
				goto IL_0130;
			case 3:
				<>1__state = -1;
				goto IL_017c;
			case 4:
				<>1__state = -1;
				goto IL_0246;
			case 5:
				{
					<>1__state = -1;
					break;
				}
				IL_017c:
				if (<h>5__3 < hold)
				{
					<h>5__3 += Time.deltaTime;
					<>2__current = null;
					<>1__state = 3;
					return true;
				}
				goto IL_0191;
				IL_0191:
				if (tOut > 0f)
				{
					<curr>5__4 = ((read != null) ? read() : to);
					<t>5__5 = 0f;
					goto IL_0246;
				}
				write(from);
				<>2__current = null;
				<>1__state = 5;
				return true;
				IL_00ed:
				if (<t>5__1 < tIn)
				{
					<t>5__1 += Time.deltaTime;
					<k>5__2 = Mathf.SmoothStep(0f, 1f, <t>5__1 / tIn);
					write(Mathf.Lerp(from, to, <k>5__2));
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				goto IL_0130;
				IL_0130:
				if (hold > 0f)
				{
					<h>5__3 = 0f;
					goto IL_017c;
				}
				goto IL_0191;
				IL_0246:
				if (<t>5__5 < tOut)
				{
					<t>5__5 += Time.deltaTime;
					<k>5__6 = Mathf.SmoothStep(0f, 1f, <t>5__5 / tOut);
					write(Mathf.Lerp(<curr>5__4, from, <k>5__6));
					<>2__current = null;
					<>1__state = 4;
					return true;
				}
				break;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <ContinueVisualTail>d__148 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public float seconds;

		public float chromaMax;

		public float lensMin;

		public float lensMax;

		public Vector2 satRange;

		public PhoneOmInteractFX <>4__this;

		private float <end>5__1;

		private float <nextJitterAt>5__2;

		private float <pulse>5__3;

		private float <wobble>5__4;

		private ChromaticAberration <chroma>5__5;

		private LensDistortion <lens>5__6;

		private ColorGrading <cg>5__7;

		private float <target>5__8;

		private float <target>5__9;

		private float <t>5__10;

		private float <sat>5__11;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ContinueVisualTail>d__148(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<chroma>5__5 = null;
			<lens>5__6 = null;
			<cg>5__7 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<end>5__1 = Time.unscaledTime + Mathf.Max(0.1f, seconds);
				<nextJitterAt>5__2 = 0f;
				<pulse>5__3 = Random.Range(0.7f, 1.4f);
				<wobble>5__4 = Random.Range(0.25f, 0.6f);
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (Time.unscaledTime < <end>5__1)
			{
				if (Time.unscaledTime >= <nextJitterAt>5__2)
				{
					if (<>4__this.TryGetSetting<ChromaticAberration>(out <chroma>5__5))
					{
						<target>5__8 = Random.Range(0.1f, Mathf.Clamp01(chromaMax));
						((PostProcessEffectSettings)<chroma>5__5).active = true;
						((ParameterOverride<float>)(object)<chroma>5__5.intensity).value = Mathf.Lerp(((ParameterOverride<float>)(object)<chroma>5__5.intensity).value, <target>5__8, 0.9f);
					}
					if (<>4__this.TryGetSetting<LensDistortion>(out <lens>5__6))
					{
						<target>5__9 = Random.Range(Mathf.Min(lensMin, lensMax), Mathf.Max(lensMin, lensMax));
						((PostProcessEffectSettings)<lens>5__6).active = true;
						((ParameterOverride<float>)(object)<lens>5__6.intensity).value = Mathf.Lerp(((ParameterOverride<float>)(object)<lens>5__6.intensity).value, <target>5__9, 0.85f);
					}
					if (<>4__this.TryGetSetting<ColorGrading>(out <cg>5__7) && (Object)(object)<cg>5__7 != (Object)null)
					{
						<t>5__10 = Mathf.PingPong(Time.unscaledTime * <pulse>5__3, 1f);
						<sat>5__11 = Mathf.Lerp(satRange.x, satRange.y, <t>5__10);
						((ParameterOverride<float>)(object)<cg>5__7.saturation).value = (<sat>5__11 - 1f) * 100f;
						((PostProcessEffectSettings)<cg>5__7).active = true;
					}
					<nextJitterAt>5__2 = Time.unscaledTime + Random.Range(0.35f, 0.9f) * <wobble>5__4;
					<chroma>5__5 = null;
					<lens>5__6 = null;
					<cg>5__7 = null;
				}
				<>2__current = null;
				<>1__state = 1;
				return true;
			}
			<>4__this.RestorePPDefaults();
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <Crossfade>d__141 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public AudioSource from;

		public AudioSource to;

		public float targetVolTo;

		public float seconds;

		public PhoneOmInteractFX <>4__this;

		private float <fromStart>5__1;

		private float <toStart>5__2;

		private float <t>5__3;

		private float <k>5__4;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <Crossfade>d__141(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				if (!Object.op_Implicit((Object)(object)from) || !Object.op_Implicit((Object)(object)to))
				{
					return false;
				}
				if (!to.isPlaying && Object.op_Implicit((Object)(object)to.clip))
				{
					to.Play();
				}
				<fromStart>5__1 = from.volume;
				<toStart>5__2 = to.volume;
				<t>5__3 = 0f;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (<t>5__3 < seconds)
			{
				<t>5__3 += Time.deltaTime;
				<k>5__4 = Mathf.SmoothStep(0f, 1f, <t>5__3 / seconds);
				from.volume = Mathf.Lerp(<fromStart>5__1, 0f, <k>5__4);
				to.volume = Mathf.Lerp(<toStart>5__2, targetVolTo, <k>5__4);
				<>2__current = null;
				<>1__state = 1;
				return true;
			}
			from.volume = 0f;
			to.volume = targetVolTo;
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <DoBloomCuts>d__130 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public float totalSeconds;

		public PhoneOmInteractFX <>4__this;

		private float <endAt>5__1;

		private PostProcessing <pp>5__2;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <DoBloomCuts>d__130(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<pp>5__2 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<endAt>5__1 = Time.time + totalSeconds;
				break;
			case 1:
				<>1__state = -1;
				<pp>5__2 = null;
				break;
			}
			if (Time.time < <endAt>5__1 && !<>4__this._stopping)
			{
				<pp>5__2 = PostProcessing.Instance;
				if ((Object)(object)<pp>5__2 != (Object)null)
				{
					<pp>5__2.BloomDisable(Random.Range(0.8f, 1.2f));
				}
				else
				{
					<>4__this.WarnOnceNoPP();
				}
				<>2__current = (object)new WaitForSeconds(Random.Range(5f, 9f));
				<>1__state = 1;
				return true;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <DoChromaticBursts>d__133 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public float totalSeconds;

		public PhoneOmInteractFX <>4__this;

		private <>c__DisplayClass133_0 <>8__1;

		private float <endAt>5__2;

		private bool <wasActive>5__3;

		private float <baseIntensity>5__4;

		private float <target>5__5;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <DoChromaticBursts>d__133(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>8__1 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>8__1 = new <>c__DisplayClass133_0();
				<endAt>5__2 = Time.time + totalSeconds;
				if (!<>4__this.TryGetSetting<ChromaticAberration>(out <>8__1.chroma))
				{
					return false;
				}
				<wasActive>5__3 = ((PostProcessEffectSettings)<>8__1.chroma).active;
				<baseIntensity>5__4 = Mathf.Clamp01(((ParameterOverride<float>)(object)<>8__1.chroma.intensity).value);
				((PostProcessEffectSettings)<>8__1.chroma).active = true;
				break;
			case 1:
				<>1__state = -1;
				<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.AnimateFloat(0f, 0f, 0.35f, () => ((ParameterOverride<float>)(object)<>8__1.chroma.intensity).value, delegate(float v)
				{
					((ParameterOverride<float>)(object)<>8__1.chroma.intensity).value = Mathf.Clamp01(v);
				}, ((ParameterOverride<float>)(object)<>8__1.chroma.intensity).value, <baseIntensity>5__4));
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(Random.Range(2.8f, 5.2f));
				<>1__state = 3;
				return true;
			case 3:
				<>1__state = -1;
				break;
			}
			if (Time.time < <endAt>5__2 && !<>4__this._stopping)
			{
				<target>5__5 = Random.Range(0.22f, Mathf.Clamp01(<>4__this.chromaticMax));
				<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.AnimateFloat(0.12f, Random.Range(0.15f, 0.35f), 0.4f, () => ((ParameterOverride<float>)(object)<>8__1.chroma.intensity).value, delegate(float v)
				{
					((ParameterOverride<float>)(object)<>8__1.chroma.intensity).value = Mathf.Clamp01(v);
				}, ((ParameterOverride<float>)(object)<>8__1.chroma.intensity).value, <target>5__5));
				<>1__state = 1;
				return true;
			}
			((ParameterOverride<float>)(object)<>8__1.chroma.intensity).value = <baseIntensity>5__4;
			((PostProcessEffectSettings)<>8__1.chroma).active = <wasActive>5__3;
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <DoContrastPulses>d__129 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public float totalSeconds;

		public PhoneOmInteractFX <>4__this;

		private float <endAt>5__1;

		private PostProcessing <pp>5__2;

		private float <amt>5__3;

		private float <speedIn>5__4;

		private float <speedOut>5__5;

		private float <time>5__6;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <DoContrastPulses>d__129(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<pp>5__2 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<endAt>5__1 = Time.time + totalSeconds;
				break;
			case 1:
				<>1__state = -1;
				<pp>5__2 = null;
				break;
			}
			if (Time.time < <endAt>5__1 && !<>4__this._stopping)
			{
				<pp>5__2 = PostProcessing.Instance;
				if ((Object)(object)<pp>5__2 != (Object)null)
				{
					<amt>5__3 = Random.Range(1.15f, 1.35f);
					<speedIn>5__4 = 0.18f;
					<speedOut>5__5 = 0.5f;
					<time>5__6 = Random.Range(0.6f, 1f);
					<pp>5__2.ContrastOverride(<amt>5__3, <speedIn>5__4, <speedOut>5__5, <time>5__6, ((Component)<>4__this).gameObject);
				}
				else
				{
					<>4__this.WarnOnceNoPP();
				}
				<>2__current = (object)new WaitForSeconds(Random.Range(3f, 6f));
				<>1__state = 1;
				return true;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <DoGrainCuts>d__131 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public float totalSeconds;

		public PhoneOmInteractFX <>4__this;

		private float <endAt>5__1;

		private PostProcessing <pp>5__2;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <DoGrainCuts>d__131(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<pp>5__2 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<endAt>5__1 = Time.time + totalSeconds;
				break;
			case 1:
				<>1__state = -1;
				<pp>5__2 = null;
				break;
			}
			if (Time.time < <endAt>5__1 && !<>4__this._stopping)
			{
				<pp>5__2 = PostProcessing.Instance;
				if ((Object)(object)<pp>5__2 != (Object)null)
				{
					<pp>5__2.GrainDisable(Random.Range(1f, 2f));
				}
				else
				{
					<>4__this.WarnOnceNoPP();
				}
				<>2__current = (object)new WaitForSeconds(Random.Range(4f, 8f));
				<>1__state = 1;
				return true;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <DoLensWarpPulses>d__134 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public float totalSeconds;

		public PhoneOmInteractFX <>4__this;

		private <>c__DisplayClass134_0 <>8__1;

		private float <endAt>5__2;

		private bool <wasActive>5__3;

		private float <baseIntensity>5__4;

		private float <target>5__5;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <DoLensWarpPulses>d__134(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>8__1 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>8__1 = new <>c__DisplayClass134_0();
				<endAt>5__2 = Time.time + totalSeconds;
				if (!<>4__this.TryGetSetting<LensDistortion>(out <>8__1.lens))
				{
					return false;
				}
				<wasActive>5__3 = ((PostProcessEffectSettings)<>8__1.lens).active;
				<baseIntensity>5__4 = Mathf.Clamp(((ParameterOverride<float>)(object)<>8__1.lens.intensity).value, -100f, 100f);
				((PostProcessEffectSettings)<>8__1.lens).active = true;
				break;
			case 1:
				<>1__state = -1;
				<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.AnimateFloat(0f, 0f, 0.35f, () => ((ParameterOverride<float>)(object)<>8__1.lens.intensity).value, delegate(float v)
				{
					((ParameterOverride<float>)(object)<>8__1.lens.intensity).value = v;
				}, ((ParameterOverride<float>)(object)<>8__1.lens.intensity).value, <baseIntensity>5__4));
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(Random.Range(3.5f, 6f));
				<>1__state = 3;
				return true;
			case 3:
				<>1__state = -1;
				break;
			}
			if (Time.time < <endAt>5__2 && !<>4__this._stopping)
			{
				<target>5__5 = Mathf.Clamp(Random.Range(<>4__this.lensWarpMin, <>4__this.lensWarpMax), -100f, 100f);
				<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.AnimateFloat(0.18f, Random.Range(0.2f, 0.45f), 0.5f, () => ((ParameterOverride<float>)(object)<>8__1.lens.intensity).value, delegate(float v)
				{
					((ParameterOverride<float>)(object)<>8__1.lens.intensity).value = v;
				}, ((ParameterOverride<float>)(object)<>8__1.lens.intensity).value, <target>5__5));
				<>1__state = 1;
				return true;
			}
			((ParameterOverride<float>)(object)<>8__1.lens.intensity).value = <baseIntensity>5__4;
			((PostProcessEffectSettings)<>8__1.lens).active = <wasActive>5__3;
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <DoLowPassSweeps>d__142 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public float totalSeconds;

		public PhoneOmInteractFX <>4__this;

		private float <endAt>5__1;

		private float <target>5__2;

		private float <t>5__3;

		private float <start>5__4;

		private float <dur>5__5;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <DoLowPassSweeps>d__142(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<endAt>5__1 = Time.time + totalSeconds;
				if (!Object.op_Implicit((Object)(object)<>4__this._whisperA) && !Object.op_Implicit((Object)(object)<>4__this._whisperB))
				{
					return false;
				}
				<>4__this._tempLowPass = ((Component)<>4__this).gameObject.AddComponent<AudioLowPassFilter>();
				<>4__this._tempLowPass.cutoffFrequency = 22000f;
				goto IL_01af;
			case 1:
				<>1__state = -1;
				goto IL_015e;
			case 2:
				{
					<>1__state = -1;
					goto IL_01af;
				}
				IL_015e:
				if (<t>5__3 < <dur>5__5 && !<>4__this._stopping)
				{
					<t>5__3 += Time.deltaTime;
					<>4__this._tempLowPass.cutoffFrequency = Mathf.Lerp(<start>5__4, <target>5__2, Mathf.SmoothStep(0f, 1f, <t>5__3 / <dur>5__5));
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				<>2__current = (object)new WaitForSeconds(Random.Range(0.8f, 1.6f));
				<>1__state = 2;
				return true;
				IL_01af:
				if (!(Time.time < <endAt>5__1) || <>4__this._stopping)
				{
					break;
				}
				<target>5__2 = Random.Range(500f, 3000f);
				<t>5__3 = 0f;
				<start>5__4 = <>4__this._tempLowPass.cutoffFrequency;
				<dur>5__5 = Random.Range(0.4f, 0.9f);
				goto IL_015e;
			}
			<>4__this.ReleaseLowPass();
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <DoSaturationWobbles>d__132 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public float totalSeconds;

		public PhoneOmInteractFX <>4__this;

		private float <endAt>5__1;

		private PostProcessing <pp>5__2;

		private float <target>5__3;

		private float <speedIn>5__4;

		private float <speedOut>5__5;

		private float <time>5__6;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <DoSaturationWobbles>d__132(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<pp>5__2 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<endAt>5__1 = Time.time + totalSeconds;
				break;
			case 1:
				<>1__state = -1;
				<pp>5__2 = null;
				break;
			}
			if (Time.time < <endAt>5__1 && !<>4__this._stopping)
			{
				<pp>5__2 = PostProcessing.Instance;
				if ((Object)(object)<pp>5__2 != (Object)null)
				{
					<target>5__3 = Random.Range(<>4__this.saturationRange.x, <>4__this.saturationRange.y);
					<speedIn>5__4 = 0.18f;
					<speedOut>5__5 = 0.4f;
					<time>5__6 = Random.Range(0.45f, 0.85f);
					<pp>5__2.SaturationOverride(<target>5__3, <speedIn>5__4, <speedOut>5__5, <time>5__6, ((Component)<>4__this).gameObject);
				}
				else
				{
					<>4__this.WarnOnceNoPP();
				}
				<>2__current = (object)new WaitForSeconds(Random.Range(2.5f, 4.5f));
				<>1__state = 1;
				return true;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <FadeOutAndStop>d__140 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public AudioSource a;

		public float seconds;

		public PhoneOmInteractFX <>4__this;

		private float <start>5__1;

		private float <t>5__2;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <FadeOutAndStop>d__140(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				if (!Object.op_Implicit((Object)(object)a))
				{
					return false;
				}
				<start>5__1 = a.volume;
				<t>5__2 = 0f;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (<t>5__2 < seconds)
			{
				<t>5__2 += Time.deltaTime;
				a.volume = Mathf.Lerp(<start>5__1, 0f, Mathf.SmoothStep(0f, 1f, <t>5__2 / seconds));
				<>2__current = null;
				<>1__state = 1;
				return true;
			}
			a.Stop();
			a.volume = 0f;
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <FadeTo>d__139 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public AudioSource a;

		public float targetVol;

		public float seconds;

		public PhoneOmInteractFX <>4__this;

		private float <start>5__1;

		private float <t>5__2;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <FadeTo>d__139(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				if (!Object.op_Implicit((Object)(object)a))
				{
					return false;
				}
				<start>5__1 = a.volume;
				a.volume = <start>5__1;
				<t>5__2 = 0f;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (<t>5__2 < seconds)
			{
				<t>5__2 += Time.deltaTime;
				a.volume = Mathf.Lerp(<start>5__1, targetVol, Mathf.SmoothStep(0f, 1f, <t>5__2 / seconds));
				<>2__current = null;
				<>1__state = 1;
				return true;
			}
			a.volume = targetVol;
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <RingLifetimeTimer>d__96 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public PhoneOmInteractFX <>4__this;

		private float <t>5__1;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <RingLifetimeTimer>d__96(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<t>5__1 = Mathf.Max(0.1f, <>4__this.ringLifetimeMaxSeconds);
				<>2__current = (object)new WaitForSeconds(<t>5__1);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (!<>4__this._answered && !<>4__this._vanishing)
				{
					((Component)<>4__this).gameObject.BroadcastMessage("OnBlackPhoneRingStop", (SendMessageOptions)1);
					((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.SilentHideAndDestroy());
				}
				<>4__this._ringTimer = null;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <RunSequence>d__103 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public float totalSeconds;

		public PhoneOmInteractFX <>4__this;

		private Coroutine <c1>5__1;

		private Coroutine <c2>5__2;

		private Coroutine <c3>5__3;

		private Coroutine <c4>5__4;

		private Coroutine <c5>5__5;

		private Coroutine <c6>5__6;

		private Coroutine <c7>5__7;

		private float <endAt>5__8;

		private float <nextCrossAt>5__9;

		private bool <aIsLeader>5__10;

		private AudioSource <from>5__11;

		private AudioSource <to>5__12;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <RunSequence>d__103(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<c1>5__1 = null;
			<c2>5__2 = null;
			<c3>5__3 = null;
			<c4>5__4 = null;
			<c5>5__5 = null;
			<c6>5__6 = null;
			<c7>5__7 = null;
			<from>5__11 = null;
			<to>5__12 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				if (Object.op_Implicit((Object)(object)<>4__this._clipA))
				{
					<>4__this._whisperA.Play();
				}
				if (Object.op_Implicit((Object)(object)<>4__this._clipB))
				{
					<>4__this._whisperB.Play();
				}
				<>4__this._whisperA.pitch = Random.Range(0.96f, 1.04f);
				<>4__this._whisperB.pitch = Random.Range(0.94f, 1.06f);
				<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.FadeTo(<>4__this._whisperA, <>4__this.whisperVolume, <>4__this.whisperFadeIn));
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<c1>5__1 = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DoContrastPulses(totalSeconds));
				<c2>5__2 = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DoBloomCuts(totalSeconds));
				<c3>5__3 = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DoGrainCuts(totalSeconds));
				<c4>5__4 = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DoLowPassSweeps(totalSeconds));
				<c5>5__5 = null;
				<c6>5__6 = null;
				<c7>5__7 = null;
				if (<>4__this.enableChromaticBursts)
				{
					<c5>5__5 = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DoChromaticBursts(totalSeconds));
				}
				if (<>4__this.enableLensWarpPulses)
				{
					<c6>5__6 = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DoLensWarpPulses(totalSeconds));
				}
				if (<>4__this.enableSaturationWobbles)
				{
					<c7>5__7 = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DoSaturationWobbles(totalSeconds));
				}
				<endAt>5__8 = Time.time + totalSeconds;
				<nextCrossAt>5__9 = Time.time + Random.Range(4f, 8f);
				goto IL_03c0;
			case 2:
				<>1__state = -1;
				<nextCrossAt>5__9 = Time.time + Random.Range(6f, 12f);
				<from>5__11 = null;
				<to>5__12 = null;
				goto IL_03a8;
			case 3:
				<>1__state = -1;
				goto IL_03c0;
			case 4:
				<>1__state = -1;
				<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.FadeOutAndStop(<>4__this._whisperB, <>4__this.whisperFadeOut));
				<>1__state = 5;
				return true;
			case 5:
				{
					<>1__state = -1;
					break;
				}
				IL_03a8:
				<>2__current = null;
				<>1__state = 3;
				return true;
				IL_03c0:
				if (Time.time < <endAt>5__8 && !<>4__this._stopping)
				{
					if (Time.time >= <nextCrossAt>5__9)
					{
						<aIsLeader>5__10 = <>4__this._whisperA.volume >= <>4__this._whisperB.volume;
						<from>5__11 = (<aIsLeader>5__10 ? <>4__this._whisperA : <>4__this._whisperB);
						<to>5__12 = (<aIsLeader>5__10 ? <>4__this._whisperB : <>4__this._whisperA);
						<to>5__12.pitch = Random.Range(0.92f, 1.08f);
						<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.Crossfade(<from>5__11, <to>5__12, <>4__this.whisperVolume, 0.9f));
						<>1__state = 2;
						return true;
					}
					goto IL_03a8;
				}
				if (<c1>5__1 != null)
				{
					((MonoBehaviour)<>4__this).StopCoroutine(<c1>5__1);
				}
				if (<c2>5__2 != null)
				{
					((MonoBehaviour)<>4__this).StopCoroutine(<c2>5__2);
				}
				if (<c3>5__3 != null)
				{
					((MonoBehaviour)<>4__this).StopCoroutine(<c3>5__3);
				}
				if (<c4>5__4 != null)
				{
					((MonoBehaviour)<>4__this).StopCoroutine(<c4>5__4);
				}
				if (<c5>5__5 != null)
				{
					((MonoBehaviour)<>4__this).StopCoroutine(<c5>5__5);
				}
				if (<c6>5__6 != null)
				{
					((MonoBehaviour)<>4__this).StopCoroutine(<c6>5__6);
				}
				if (<c7>5__7 != null)
				{
					((MonoBehaviour)<>4__this).StopCoroutine(<c7>5__7);
				}
				if (((Behaviour)<>4__this).isActiveAndEnabled)
				{
					<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.FadeOutAndStop(<>4__this._whisperA, <>4__this.whisperFadeOut));
					<>1__state = 4;
					return true;
				}
				if (Object.op_Implicit((Object)(object)<>4__this._whisperA))
				{
					<>4__this._whisperA.Stop();
					<>4__this._whisperA.volume = 0f;
				}
				if (Object.op_Implicit((Object)(object)<>4__this._whisperB))
				{
					<>4__this._whisperB.Stop();
					<>4__this._whisperB.volume = 0f;
				}
				break;
			}
			<>4__this.ReleaseLowPass();
			if (<>4__this.postDestroyEffectHoldSeconds <= 0.05f)
			{
				<>4__this.RestorePPDefaults();
			}
			<>4__this._run = null;
			<>4__this._stopping = false;
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <ShrinkSmokeAndHideThenDestroy>d__104 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public PhoneOmInteractFX <>4__this;

		private Vector3 <start>5__1;

		private float <t>5__2;

		private float <dur>5__3;

		private Collider[] <>s__4;

		private int <>s__5;

		private Collider <c>5__6;

		private float <k>5__7;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ShrinkSmokeAndHideThenDestroy>d__104(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>s__4 = null;
			<c>5__6 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>4__this._vanishing = true;
				<>s__4 = ((Component)<>4__this).GetComponentsInChildren<Collider>(true);
				for (<>s__5 = 0; <>s__5 < <>s__4.Length; <>s__5++)
				{
					<c>5__6 = <>s__4[<>s__5];
					<c>5__6.enabled = false;
					<c>5__6 = null;
				}
				<>s__4 = null;
				<start>5__1 = ((Component)<>4__this).transform.localScale;
				<t>5__2 = 0f;
				<dur>5__3 = Mathf.Max(0.05f, <>4__this.vanishShrinkTime);
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (<t>5__2 < <dur>5__3)
			{
				<t>5__2 += Time.deltaTime;
				<k>5__7 = Mathf.SmoothStep(0f, 1f, <t>5__2 / <dur>5__3);
				((Component)<>4__this).transform.localScale = Vector3.Lerp(<start>5__1, Vector3.zero, <k>5__7);
				<>2__current = null;
				<>1__state = 1;
				return true;
			}
			((Component)<>4__this).transform.localScale = Vector3.zero;
			<>4__this.SpawnBlackSmoke(((Component)<>4__this).transform.position);
			<>4__this.SetAllRenderersEnabled(enabled: false);
			Object.Destroy((Object)(object)((Component)<>4__this).gameObject, Mathf.Max(0.1f, <>4__this.vanishDestroyDelay));
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <SilentHideAndDestroy>d__105 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public PhoneOmInteractFX <>4__this;

		private Collider[] <>s__1;

		private int <>s__2;

		private Collider <c>5__3;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <SilentHideAndDestroy>d__105(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>s__1 = null;
			<c>5__3 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>4__this._vanishing = true;
				<>s__1 = ((Component)<>4__this).GetComponentsInChildren<Collider>(true);
				for (<>s__2 = 0; <>s__2 < <>s__1.Length; <>s__2++)
				{
					<c>5__3 = <>s__1[<>s__2];
					<c>5__3.enabled = false;
					<c>5__3 = null;
				}
				<>s__1 = null;
				<>4__this.SetAllRenderersEnabled(enabled: false);
				<>2__current = null;
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				Object.Destroy((Object)(object)((Component)<>4__this).gameObject, Mathf.Max(0.1f, <>4__this.vanishDestroyDelay));
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <SnapPhoneToPaintingAnchorNearSeed>d__119 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public PhoneOmInteractFX <>4__this;

		private List<Transform> <candidates>5__1;

		private IOrderedEnumerable<Transform> <ordered>5__2;

		private Transform <anchor>5__3;

		private Vector3 <pos>5__4;

		private Quaternion <rot>5__5;

		private Transform <chosenRoot>5__6;

		private RaycastHit <hit>5__7;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <SnapPhoneToPaintingAnchorNearSeed>d__119(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<candidates>5__1 = null;
			<ordered>5__2 = null;
			<anchor>5__3 = null;
			<chosenRoot>5__6 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: 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_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = null;
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<candidates>5__1 = CollectPaintingCandidates(includeInactive: true);
				if (<candidates>5__1.Count == 0)
				{
					return false;
				}
				<ordered>5__2 = <candidates>5__1.OrderBy((Transform t) => Vector3.SqrMagnitude(t.position - <>4__this._spawnSeedPos)).ThenBy<Transform, string>((Transform t) => Object.op_Implicit((Object)(object)t) ? ((Object)t).name : string.Empty, StringComparer.Ordinal);
				<anchor>5__3 = <ordered>5__2.FirstOrDefault();
				if ((Object)(object)<anchor>5__3 == (Object)null)
				{
					return false;
				}
				<pos>5__4 = <anchor>5__3.position + <anchor>5__3.forward * Mathf.Max(0f, <>4__this.phoneForwardOffsetFallback) - <anchor>5__3.up * Mathf.Max(0f, <>4__this.phoneDownOffsetFallback);
				if (<>4__this.enforceMinY && <pos>5__4.y < <>4__this.phoneMinY)
				{
					<pos>5__4.y = <>4__this.phoneMinY;
				}
				<rot>5__5 = <anchor>5__3.rotation * Quaternion.Euler(<>4__this.mountEuler);
				if (Physics.CheckSphere(<pos>5__4, 0.1f))
				{
					if (Physics.Raycast(<anchor>5__3.position, <anchor>5__3.forward, ref <hit>5__7, 0.5f))
					{
						<pos>5__4 = ((RaycastHit)(ref <hit>5__7)).point + <anchor>5__3.forward * 0.02f;
					}
					else
					{
						<pos>5__4 += <anchor>5__3.forward * 0.02f;
					}
				}
				<>4__this.FlushToWall(ref <pos>5__4, <rot>5__5);
				((Component)<>4__this).transform.SetPositionAndRotation(<pos>5__4, <rot>5__5);
				<>4__this._snappedFromSeed = true;
				<chosenRoot>5__6 = GetPaintingRoot(<anchor>5__3) ?? <anchor>5__3;
				_reservedPaintingRoots.Add(<chosenRoot>5__6);
				<>4__this.ReserveNearbyPaintingAroundPhone();
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <SnapToWallAfterSeed>d__90 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public PhoneOmInteractFX <>4__this;

		private int <frames>5__1;

		private float <softTimeout>5__2;

		private int <i>5__3;

		private bool <done>5__4;

		private LevelGenerator <lg>5__5;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <SnapToWallAfterSeed>d__90(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<lg>5__5 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<frames>5__1 = Mathf.Max(0, <>4__this.phoneWallSearchWarmupFrames);
				<i>5__3 = 0;
				goto IL_007e;
			case 1:
				<>1__state = -1;
				<i>5__3++;
				goto IL_007e;
			case 2:
				<>1__state = -1;
				goto IL_0113;
			case 3:
				{
					<>1__state = -1;
					break;
				}
				IL_007e:
				if (<i>5__3 < <frames>5__1)
				{
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				<softTimeout>5__2 = Time.time + 1f;
				goto IL_0113;
				IL_0113:
				if (Time.time < <softTimeout>5__2)
				{
					<done>5__4 = true;
					try
					{
						<lg>5__5 = LevelGenerator.Instance;
						<done>5__4 = (Object)(object)<lg>5__5 == (Object)null || <lg>5__5.Generated;
						<lg>5__5 = null;
					}
					catch
					{
						<done>5__4 = true;
					}
					if (!<done>5__4)
					{
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
				}
				if (<>4__this.TrySnapToWall(<>4__this._spawnSeedPos, <>4__this.phoneWallSearchRadius))
				{
					<>4__this._snappedFromSeed = true;
					<>4__this.ReserveNearbyPaintingAroundPhone();
					return false;
				}
				if (<>4__this.enablePaintingFallback)
				{
					<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.SnapPhoneToPaintingAnchorNearSeed());
					<>1__state = 3;
					return true;
				}
				break;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <SwapPaintingsOnce>d__121 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public PhoneOmInteractFX <>4__this;

		private List<Transform> <targets>5__1;

		private int <swapped>5__2;

		private List<Transform>.Enumerator <>s__3;

		private Transform <t>5__4;

		private Vector3 <pos>5__5;

		private Quaternion <rot>5__6;

		private Transform <parent>5__7;

		private GameObject <inst>5__8;

		private Renderer[] <>s__9;

		private int <>s__10;

		private Renderer <r>5__11;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <SwapPaintingsOnce>d__121(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			int num = <>1__state;
			if (num == -3 || num == 1)
			{
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}
			<targets>5__1 = null;
			<>s__3 = default(List<Transform>.Enumerator);
			<t>5__4 = null;
			<parent>5__7 = null;
			<inst>5__8 = null;
			<>s__9 = null;
			<r>5__11 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00e3: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (migh