using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Audio;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ClassLibrary1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClassLibrary1")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ed811e64-2e6b-43f8-8853-cac7ec1b6b3c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace WalkieTalkieMimic;
[BepInPlugin("com.yourname.walkietalkiemimic", "WalkieTalkieMimic", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class WalkieTalkieMimicPlugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
internal static ConfigEntry<float> TransmitDistance;
internal static ConfigEntry<float> WalkieVolume;
internal static ConfigEntry<float> TransmitCooldownMin;
internal static ConfigEntry<float> TransmitCooldownMax;
internal static bool TransmitSlotFree = true;
private void Awake()
{
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
TransmitDistance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "TransmitDistance", 25f, "Distance in meters. Beyond this the masked enemy's voice is routed through walkie-talkies.");
WalkieVolume = ((BaseUnityPlugin)this).Config.Bind<float>("General", "WalkieVolume", 1f, "Volume multiplier for walkie transmission (0.0 - 1.0).");
TransmitCooldownMin = ((BaseUnityPlugin)this).Config.Bind<float>("General", "TransmitCooldownMin", 13f, "Minimum seconds between walkie transmissions per mimic.");
TransmitCooldownMax = ((BaseUnityPlugin)this).Config.Bind<float>("General", "TransmitCooldownMax", 40f, "Maximum seconds between walkie transmissions per mimic.");
new Harmony("com.yourname.walkietalkiemimic").PatchAll();
Log.LogInfo((object)("WalkieTalkieMimic loaded! " + $"Distance={TransmitDistance.Value}m " + $"CooldownMin={TransmitCooldownMin.Value}s " + $"CooldownMax={TransmitCooldownMax.Value}s " + $"Volume={WalkieVolume.Value}"));
}
}
internal static class WalkieInfo
{
private static bool _initialised;
private static AudioClip _clipStart;
private static AudioClip _clipStop;
public static AudioClip ClipStart => _clipStart;
public static AudioClip ClipStop => _clipStop;
public static void Init(WalkieTalkie wt)
{
if (_initialised)
{
return;
}
Type type = ((object)wt).GetType();
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
FieldInfo[] fields = type.GetFields(bindingAttr);
foreach (FieldInfo fieldInfo in fields)
{
if (fieldInfo.FieldType != typeof(AudioClip))
{
continue;
}
object? value = fieldInfo.GetValue(wt);
AudioClip val = (AudioClip)((value is AudioClip) ? value : null);
if (!((Object)(object)val == (Object)null))
{
string text = fieldInfo.Name.ToLowerInvariant();
if ((Object)(object)_clipStart == (Object)null && (text.Contains("on") || text.Contains("start") || text.Contains("open")))
{
_clipStart = val;
WalkieTalkieMimicPlugin.Log.LogInfo((object)("[WalkieInfo] Start clip = '" + fieldInfo.Name + "'"));
}
else if ((Object)(object)_clipStop == (Object)null && (text.Contains("off") || text.Contains("stop") || text.Contains("close")))
{
_clipStop = val;
WalkieTalkieMimicPlugin.Log.LogInfo((object)("[WalkieInfo] Stop clip = '" + fieldInfo.Name + "'"));
}
}
}
fields = type.GetFields(bindingAttr);
foreach (FieldInfo fieldInfo2 in fields)
{
if (!(fieldInfo2.FieldType != typeof(AudioClip[])) && fieldInfo2.GetValue(wt) is AudioClip[] array && array.Length != 0)
{
string text2 = fieldInfo2.Name.ToLowerInvariant();
if ((Object)(object)_clipStart == (Object)null && (text2.Contains("start") || text2.Contains("on") || text2.Contains("open")))
{
_clipStart = array[0];
WalkieTalkieMimicPlugin.Log.LogInfo((object)("[WalkieInfo] Start clip (arr) = '" + fieldInfo2.Name + "'"));
}
else if ((Object)(object)_clipStop == (Object)null && (text2.Contains("stop") || text2.Contains("off") || text2.Contains("close")))
{
_clipStop = array[0];
WalkieTalkieMimicPlugin.Log.LogInfo((object)("[WalkieInfo] Stop clip (arr) = '" + fieldInfo2.Name + "'"));
}
}
}
if ((Object)(object)_clipStart != (Object)null && (Object)(object)_clipStop != (Object)null)
{
_initialised = true;
WalkieTalkieMimicPlugin.Log.LogInfo((object)"[WalkieInfo] Both clips found — initialised.");
}
else
{
WalkieTalkieMimicPlugin.Log.LogWarning((object)$"[WalkieInfo] Clips incomplete (start={(Object)(object)_clipStart != (Object)null}, stop={(Object)(object)_clipStop != (Object)null}) — will retry.");
}
}
public static AudioSource GetSpeaker(WalkieTalkie wt)
{
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
string[] array = new string[4] { "thisAudio", "speakerAudio", "audio", "_audio" };
foreach (string name in array)
{
FieldInfo field = ((object)wt).GetType().GetField(name, bindingAttr);
if (field != null && field.FieldType == typeof(AudioSource))
{
object? value = field.GetValue(wt);
return (AudioSource)((value is AudioSource) ? value : null);
}
}
return ((Component)wt).GetComponentInChildren<AudioSource>();
}
}
[HarmonyPatch(typeof(MaskedPlayerEnemy), "Start")]
internal class MaskedStartPatch
{
private struct MixerCapture
{
public AudioMixerGroup OriginalGroup;
public bool Active;
}
[CompilerGenerated]
private sealed class <WaitForMimicAndSetup>d__1 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public MaskedPlayerEnemy masked;
private Component <audioStreamComp>5__2;
private float <timeout>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WaitForMimicAndSetup>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<audioStreamComp>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<audioStreamComp>5__2 = null;
<timeout>5__3 = Time.time + 10f;
break;
case 1:
{
<>1__state = -1;
if ((Object)(object)masked == (Object)null || ((EnemyAI)masked).isEnemyDead)
{
return false;
}
Component[] componentsInChildren = ((Component)masked).GetComponentsInChildren<Component>(true);
foreach (Component val in componentsInChildren)
{
if ((Object)(object)val != (Object)null && ((object)val).GetType().FullName.Contains("AudioStream"))
{
<audioStreamComp>5__2 = val;
break;
}
}
break;
}
}
if ((Object)(object)<audioStreamComp>5__2 == (Object)null && Time.time < <timeout>5__3)
{
<>2__current = (object)new WaitForSeconds(0.2f);
<>1__state = 1;
return true;
}
if ((Object)(object)<audioStreamComp>5__2 == (Object)null)
{
WalkieTalkieMimicPlugin.Log.LogWarning((object)$"[{((Object)masked).GetInstanceID()}] AudioStream not found.");
return false;
}
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
AudioSource val2 = null;
FieldInfo[] fields = ((object)<audioStreamComp>5__2).GetType().GetFields(bindingAttr);
foreach (FieldInfo fieldInfo in fields)
{
if (fieldInfo.FieldType == typeof(AudioSource))
{
object? value = fieldInfo.GetValue(<audioStreamComp>5__2);
val2 = (AudioSource)((value is AudioSource) ? value : null);
if ((Object)(object)val2 != (Object)null)
{
break;
}
}
}
if ((Object)(object)val2 == (Object)null)
{
val2 = <audioStreamComp>5__2.GetComponent<AudioSource>();
}
if ((Object)(object)val2 == (Object)null)
{
WalkieTalkieMimicPlugin.Log.LogWarning((object)$"[{((Object)masked).GetInstanceID()}] Mirage AudioSource not found.");
return false;
}
WalkieTalkieMimicPlugin.Log.LogInfo((object)$"[{((Object)masked).GetInstanceID()}] Setup complete.");
((MonoBehaviour)masked).StartCoroutine(WalkieTransmitter(masked, val2));
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 <WalkieTransmitter>d__8 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public AudioSource mirageAudio;
public MaskedPlayerEnemy masked;
private OccludeAudio <occlude>5__2;
private MixerCapture <mixerCapture>5__3;
private AudioLowPassFilter <ownedLpf>5__4;
private AudioHighPassFilter <ownedHpf>5__5;
private AudioSource <walkieSpeaker>5__6;
private AudioSource <crossZoneSource>5__7;
private bool <inWalkieMode>5__8;
private bool <wasPlaying>5__9;
private float <lastTransmitEnd>5__10;
private float <nextCooldown>5__11;
private int <lastTimeSamples>5__12;
private WalkieTalkie <walkie>5__13;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WalkieTransmitter>d__8(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<occlude>5__2 = null;
<mixerCapture>5__3 = default(MixerCapture);
<ownedLpf>5__4 = null;
<ownedHpf>5__5 = null;
<walkieSpeaker>5__6 = null;
<crossZoneSource>5__7 = null;
<walkie>5__13 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
//IL_04f2: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<occlude>5__2 = ((Component)mirageAudio).GetComponent<OccludeAudio>();
<mixerCapture>5__3 = default(MixerCapture);
<ownedLpf>5__4 = null;
<ownedHpf>5__5 = null;
<walkieSpeaker>5__6 = null;
<crossZoneSource>5__7 = null;
<inWalkieMode>5__8 = false;
<wasPlaying>5__9 = false;
<lastTransmitEnd>5__10 = -999f;
<nextCooldown>5__11 = WalkieTalkieMimicPlugin.TransmitCooldownMin.Value;
<lastTimeSamples>5__12 = 0;
goto IL_06c4;
case 1:
<>1__state = -1;
goto IL_00d5;
case 2:
<>1__state = -1;
goto IL_00d5;
case 3:
{
<>1__state = -1;
goto IL_0502;
}
IL_00d5:
if ((Object)(object)masked == (Object)null || ((EnemyAI)masked).isEnemyDead)
{
break;
}
if (NearestPlayerDist(masked) <= WalkieTalkieMimicPlugin.TransmitDistance.Value)
{
if (<inWalkieMode>5__8)
{
if ((Object)(object)<walkieSpeaker>5__6 != (Object)null && (Object)(object)WalkieInfo.ClipStop != (Object)null)
{
<walkieSpeaker>5__6.PlayOneShot(WalkieInfo.ClipStop, 1f);
}
ExitWalkieMode(mirageAudio, <occlude>5__2, ref <mixerCapture>5__3, ref <ownedLpf>5__4, ref <ownedHpf>5__5);
if ((Object)(object)<crossZoneSource>5__7 != (Object)null && <crossZoneSource>5__7.isPlaying)
{
<crossZoneSource>5__7.Stop();
}
<inWalkieMode>5__8 = false;
<wasPlaying>5__9 = false;
<walkieSpeaker>5__6 = null;
WalkieTalkieMimicPlugin.TransmitSlotFree = true;
WalkieTalkieMimicPlugin.Log.LogInfo((object)$"[{((Object)masked).GetInstanceID()}] Walked near — stopped walkie tx.");
}
else if ((Object)(object)<occlude>5__2 != (Object)null && !((Behaviour)<occlude>5__2).enabled)
{
((Behaviour)<occlude>5__2).enabled = true;
}
mirageAudio.volume = (mirageAudio.isPlaying ? 1f : 0f);
}
else if (<inWalkieMode>5__8)
{
mirageAudio.volume = WalkieTalkieMimicPlugin.WalkieVolume.Value;
if ((!IsCrossZone(masked)) ? (!mirageAudio.isPlaying) : ((!((Object)(object)<crossZoneSource>5__7 != (Object)null) || !((Object)(object)<crossZoneSource>5__7.clip != (Object)null)) ? (!mirageAudio.isPlaying) : (!<crossZoneSource>5__7.isPlaying)))
{
if ((Object)(object)<walkieSpeaker>5__6 != (Object)null && (Object)(object)WalkieInfo.ClipStop != (Object)null)
{
<walkieSpeaker>5__6.PlayOneShot(WalkieInfo.ClipStop, 1f);
}
ExitWalkieMode(mirageAudio, <occlude>5__2, ref <mixerCapture>5__3, ref <ownedLpf>5__4, ref <ownedHpf>5__5);
<lastTransmitEnd>5__10 = Time.time;
<nextCooldown>5__11 = Random.Range(WalkieTalkieMimicPlugin.TransmitCooldownMin.Value, WalkieTalkieMimicPlugin.TransmitCooldownMax.Value);
<inWalkieMode>5__8 = false;
<wasPlaying>5__9 = false;
<walkieSpeaker>5__6 = null;
WalkieTalkieMimicPlugin.TransmitSlotFree = true;
WalkieTalkieMimicPlugin.Log.LogInfo((object)$"[{((Object)masked).GetInstanceID()}] Walkie done. Next cooldown: {<nextCooldown>5__11:F1}s");
}
}
else
{
mirageAudio.volume = 0f;
int timeSamples = mirageAudio.timeSamples;
bool flag = IsCrossZone(masked);
bool flag2 = mirageAudio.isPlaying || (flag && timeSamples != <lastTimeSamples>5__12 && timeSamples > 0);
<lastTimeSamples>5__12 = timeSamples;
bool num = flag2 && !<wasPlaying>5__9;
<wasPlaying>5__9 = flag2;
if (num && !(Time.time - <lastTransmitEnd>5__10 < <nextCooldown>5__11) && WalkieTalkieMimicPlugin.TransmitSlotFree)
{
<walkie>5__13 = FindWalkie(masked);
if (!((Object)(object)<walkie>5__13 == (Object)null))
{
WalkieInfo.Init(<walkie>5__13);
<walkieSpeaker>5__6 = WalkieInfo.GetSpeaker(<walkie>5__13);
<inWalkieMode>5__8 = true;
WalkieTalkieMimicPlugin.TransmitSlotFree = false;
WalkieTalkieMimicPlugin.Log.LogInfo((object)$"[{((Object)masked).GetInstanceID()}] Walkie transmission started.");
if ((Object)(object)<walkieSpeaker>5__6 != (Object)null && (Object)(object)WalkieInfo.ClipStart != (Object)null)
{
<walkieSpeaker>5__6.PlayOneShot(WalkieInfo.ClipStart, 1f);
<>2__current = (object)new WaitForSeconds(Mathf.Min(WalkieInfo.ClipStart.length, 0.4f));
<>1__state = 3;
return true;
}
goto IL_0502;
}
WalkieTalkieMimicPlugin.Log.LogWarning((object)$"[{((Object)masked).GetInstanceID()}] No walkie found — skipping.");
}
}
goto IL_06c4;
IL_0502:
EnterWalkieMode(mirageAudio, <occlude>5__2, <walkieSpeaker>5__6, ref <mixerCapture>5__3, ref <ownedLpf>5__4, ref <ownedHpf>5__5);
if (IsCrossZone(masked))
{
if ((Object)(object)<crossZoneSource>5__7 == (Object)null)
{
<crossZoneSource>5__7 = ((Component)<walkie>5__13).gameObject.AddComponent<AudioSource>();
<crossZoneSource>5__7.spatialBlend = 0f;
<crossZoneSource>5__7.loop = false;
<crossZoneSource>5__7.playOnAwake = false;
}
<crossZoneSource>5__7.outputAudioMixerGroup = (((Object)(object)<walkieSpeaker>5__6 != (Object)null) ? <walkieSpeaker>5__6.outputAudioMixerGroup : null);
AudioHighPassFilter val = ((Component)<crossZoneSource>5__7).GetComponent<AudioHighPassFilter>();
if ((Object)(object)val == (Object)null)
{
val = ((Component)<crossZoneSource>5__7).gameObject.AddComponent<AudioHighPassFilter>();
}
val.cutoffFrequency = 300f;
val.highpassResonanceQ = 1f;
((Behaviour)val).enabled = true;
AudioLowPassFilter val2 = ((Component)<crossZoneSource>5__7).GetComponent<AudioLowPassFilter>();
if ((Object)(object)val2 == (Object)null)
{
val2 = ((Component)<crossZoneSource>5__7).gameObject.AddComponent<AudioLowPassFilter>();
}
val2.cutoffFrequency = 3000f;
val2.lowpassResonanceQ = 1f;
((Behaviour)val2).enabled = true;
<crossZoneSource>5__7.volume = WalkieTalkieMimicPlugin.WalkieVolume.Value;
if ((Object)(object)mirageAudio.clip != (Object)null)
{
<crossZoneSource>5__7.clip = mirageAudio.clip;
<crossZoneSource>5__7.Play();
}
mirageAudio.volume = 0f;
WalkieTalkieMimicPlugin.Log.LogInfo((object)$"[{((Object)masked).GetInstanceID()}] Cross-zone: walkie mode active");
}
<walkie>5__13 = null;
goto IL_06c4;
IL_06c4:
if ((Object)(object)masked != (Object)null && !((EnemyAI)masked).isEnemyDead)
{
if (<inWalkieMode>5__8)
{
<>2__current = null;
<>1__state = 1;
return true;
}
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 2;
return true;
}
break;
}
WalkieTalkieMimicPlugin.Log.LogInfo((object)$"[{((Object)masked).GetInstanceID()}] Masked dead — cleaning up.");
if (<inWalkieMode>5__8)
{
WalkieTalkieMimicPlugin.TransmitSlotFree = true;
}
if ((Object)(object)<crossZoneSource>5__7 != (Object)null)
{
Object.Destroy((Object)(object)<crossZoneSource>5__7);
}
if ((Object)(object)mirageAudio != (Object)null)
{
ExitWalkieMode(mirageAudio, <occlude>5__2, ref <mixerCapture>5__3, ref <ownedLpf>5__4, ref <ownedHpf>5__5);
}
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 Postfix(MaskedPlayerEnemy __instance)
{
((MonoBehaviour)__instance).StartCoroutine(WaitForMimicAndSetup(__instance));
}
[IteratorStateMachine(typeof(<WaitForMimicAndSetup>d__1))]
private static IEnumerator WaitForMimicAndSetup(MaskedPlayerEnemy masked)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WaitForMimicAndSetup>d__1(0)
{
masked = masked
};
}
private static float NearestPlayerDist(MaskedPlayerEnemy masked)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
float num = float.MaxValue;
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val in allPlayerScripts)
{
if (!((Object)(object)val == (Object)null) && val.isPlayerControlled)
{
float num2 = Vector3.Distance(((Component)masked).transform.position, ((Component)val).transform.position);
if (num2 < num)
{
num = num2;
}
}
}
return num;
}
private static bool IsCrossZone(MaskedPlayerEnemy masked)
{
PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController;
if ((Object)(object)val == (Object)null)
{
return false;
}
return ((EnemyAI)masked).isOutside == val.isInsideFactory;
}
private static WalkieTalkie FindWalkie(MaskedPlayerEnemy masked)
{
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)masked.mimickingPlayer != (Object)null)
{
try
{
Type type = Type.GetType("ReservedWalkieSlot.Patches.WalkiePatcher, ReservedWalkieSlot");
if (type != null)
{
MethodInfo method = type.GetMethod("GetReservedWalkie", BindingFlags.Static | BindingFlags.Public);
if (method != null)
{
object? obj = method.Invoke(null, new object[1] { masked.mimickingPlayer });
WalkieTalkie val = (WalkieTalkie)((obj is WalkieTalkie) ? obj : null);
if ((Object)(object)val != (Object)null && ((GrabbableObject)val).isBeingUsed)
{
return val;
}
}
}
}
catch
{
}
GrabbableObject[] itemSlots = masked.mimickingPlayer.ItemSlots;
foreach (GrabbableObject obj3 in itemSlots)
{
WalkieTalkie val2 = (WalkieTalkie)(object)((obj3 is WalkieTalkie) ? obj3 : null);
if (val2 != null && ((GrabbableObject)val2).isBeingUsed)
{
return val2;
}
}
}
WalkieTalkie result = null;
float num = float.MaxValue;
WalkieTalkie[] array = Object.FindObjectsOfType<WalkieTalkie>();
foreach (WalkieTalkie val3 in array)
{
if (((GrabbableObject)val3).isBeingUsed)
{
float num2 = Vector3.Distance(((Component)masked).transform.position, ((Component)val3).transform.position);
if (num2 < num)
{
num = num2;
result = val3;
}
}
}
return result;
}
private static void EnterWalkieMode(AudioSource mirageAudio, OccludeAudio occlude, AudioSource walkieSpeaker, ref MixerCapture capture, ref AudioLowPassFilter lpf, ref AudioHighPassFilter hpf)
{
if ((Object)(object)occlude != (Object)null)
{
((Behaviour)occlude).enabled = false;
}
mirageAudio.spatialBlend = 0f;
mirageAudio.volume = WalkieTalkieMimicPlugin.WalkieVolume.Value;
if ((Object)(object)walkieSpeaker != (Object)null && (Object)(object)walkieSpeaker.outputAudioMixerGroup != (Object)null)
{
capture.OriginalGroup = mirageAudio.outputAudioMixerGroup;
capture.Active = true;
mirageAudio.outputAudioMixerGroup = walkieSpeaker.outputAudioMixerGroup;
WalkieTalkieMimicPlugin.Log.LogInfo((object)("[Walkie] Routed through LC mixer: '" + ((Object)walkieSpeaker.outputAudioMixerGroup).name + "'"));
}
else
{
capture.Active = false;
WalkieTalkieMimicPlugin.Log.LogWarning((object)"[Walkie] No mixer group — filters only.");
}
if ((Object)(object)hpf == (Object)null)
{
hpf = ((Component)mirageAudio).GetComponent<AudioHighPassFilter>();
}
if ((Object)(object)hpf == (Object)null)
{
hpf = ((Component)mirageAudio).gameObject.AddComponent<AudioHighPassFilter>();
}
hpf.cutoffFrequency = 300f;
hpf.highpassResonanceQ = 1f;
((Behaviour)hpf).enabled = true;
if ((Object)(object)lpf == (Object)null)
{
lpf = ((Component)mirageAudio).GetComponent<AudioLowPassFilter>();
}
if ((Object)(object)lpf == (Object)null)
{
lpf = ((Component)mirageAudio).gameObject.AddComponent<AudioLowPassFilter>();
}
lpf.cutoffFrequency = 3000f;
lpf.lowpassResonanceQ = 1f;
((Behaviour)lpf).enabled = true;
}
private static void ExitWalkieMode(AudioSource mirageAudio, OccludeAudio occlude, ref MixerCapture capture, ref AudioLowPassFilter lpf, ref AudioHighPassFilter hpf)
{
if (capture.Active)
{
mirageAudio.outputAudioMixerGroup = capture.OriginalGroup;
capture.Active = false;
}
if ((Object)(object)lpf != (Object)null)
{
((Behaviour)lpf).enabled = false;
}
if ((Object)(object)hpf != (Object)null)
{
((Behaviour)hpf).enabled = false;
}
mirageAudio.spatialBlend = 1f;
if ((Object)(object)occlude != (Object)null)
{
((Behaviour)occlude).enabled = true;
}
}
[IteratorStateMachine(typeof(<WalkieTransmitter>d__8))]
private static IEnumerator WalkieTransmitter(MaskedPlayerEnemy masked, AudioSource mirageAudio)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WalkieTransmitter>d__8(0)
{
masked = masked,
mirageAudio = mirageAudio
};
}
}