using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Audio;
using BepInEx;
using Mimic;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LethalMimic")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalMimic")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("fdad52c4-d0fa-4b10-b21d-a2cdc7f7e65c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.timox.lethalmimic", "Lethal Mimic", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private GameObject mimic;
private VoiceRecorder recorder;
private void Awake()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogInfo((object)"Lethal Mimic chargé !");
mimic = new GameObject("Mimic");
MimicController mimicController = mimic.AddComponent<MimicController>();
GameObject val = GameObject.FindWithTag("Player");
if ((Object)(object)val != (Object)null)
{
mimicController.player = val.transform;
}
recorder = mimic.AddComponent<VoiceRecorder>();
recorder.StartRecording();
}
private void OnDestroy()
{
if ((Object)(object)recorder != (Object)null)
{
recorder.StopRecording();
}
}
}
namespace Mimic
{
public class MimicController : MonoBehaviour
{
public Transform player;
private MimicVoicePlayer voicePlayer;
private float nextSpeakTime = 0f;
private float speakInterval = 5f;
private void Awake()
{
voicePlayer = ((Component)this).gameObject.AddComponent<MimicVoicePlayer>();
}
private void Update()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)player != (Object)null)
{
((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, player.position, Time.deltaTime);
if (Time.time >= nextSpeakTime)
{
voicePlayer.PlayRandomClip();
nextSpeakTime = Time.time + speakInterval;
}
}
}
}
public class MimicVoicePlayer : MonoBehaviour
{
private AudioSource audioSource;
private void Awake()
{
audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
}
public void PlayRandomClip()
{
if (VoiceMemory.Clips.Count > 0)
{
int index = Random.Range(0, VoiceMemory.Clips.Count);
audioSource.clip = VoiceMemory.Clips[index];
audioSource.Play();
}
}
}
}
namespace Audio
{
public static class VoiceMemory
{
public static List<AudioClip> Clips = new List<AudioClip>();
}
public class VoiceRecorder : MonoBehaviour
{
private AudioClip recording;
private bool isRecording = false;
public void StartRecording()
{
if (!isRecording)
{
recording = Microphone.Start((string)null, false, 10, 44100);
isRecording = true;
Debug.Log((object)"Enregistrement commencé !");
}
}
public void StopRecording()
{
if (isRecording)
{
Microphone.End((string)null);
VoiceMemory.Clips.Add(recording);
isRecording = false;
Debug.Log((object)"Enregistrement terminé !");
}
}
}
}