Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of DozerEntity v1.0.0
BepInEx/plugins/DozerEntity.dll
Decompiled 6 months agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("DozerEntity")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DozerEntity")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("707b5311-bc50-4ec1-ac25-901818a7c6a1")] [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")] namespace DozerEntity; public class DozerBehaviour : MonoBehaviour { private enum DozerState { Hidden, ClosedEyes, OpenEyes, Screamer } private DozerState currentState = DozerState.Hidden; private float timer = 0f; private float nextAppearTime = 0f; private float cooldownTimer = 0f; private float cooldownTime = 0f; private bool isOnCooldown = false; private float previousVolume = 1f; private GameObject overlayObject; private Image overlayImage; private Image blackBackground; private AudioSource audioSource; private AudioClip closedSound; private Sprite[] closedSprites = (Sprite[])(object)new Sprite[2]; private Sprite openSprite; private Sprite[] screamerSprites = (Sprite[])(object)new Sprite[6]; private float animTimer = 0f; private int animFrame = 0; private float animSpeed = 0.3f; private string modFolder; private AudioClip LoadAudioClip(string filename) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown string text = Path.Combine(modFolder, filename); if (!File.Exists(text)) { Debug.LogError((object)("Dozer Entity: звук не найден — " + text)); return null; } WWW val = new WWW("file://" + text); try { while (!val.isDone) { } return val.GetAudioClip(false, false, (AudioType)20); } finally { ((IDisposable)val)?.Dispose(); } } private void Start() { modFolder = Path.Combine(Paths.PluginPath, "DozerEntity"); LoadSprites(); closedSound = LoadAudioClip("closed_sound.wav"); audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); audioSource.loop = true; audioSource.volume = 1f; CreateOverlay(); nextAppearTime = Random.Range(Plugin.MinSpawnTime.Value, Plugin.MaxSpawnTime.Value); } private void LoadSprites() { closedSprites[0] = LoadSprite("closed_1.png"); closedSprites[1] = LoadSprite("closed_2.png"); openSprite = LoadSprite("open.png"); for (int i = 0; i < 6; i++) { screamerSprites[i] = LoadSprite($"screamer_{i + 1}.png"); } } private void ForceHide() { currentState = DozerState.Hidden; timer = 0f; overlayObject.SetActive(false); ((Component)blackBackground).gameObject.SetActive(false); AudioListener.volume = previousVolume; isOnCooldown = false; audioSource.Stop(); } private Sprite LoadSprite(string filename) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) string text = Path.Combine(modFolder, filename); if (!File.Exists(text)) { Debug.LogError((object)("Dozer Entity: файл не найден — " + text)); return null; } byte[] array = File.ReadAllBytes(text); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } private void Update() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null) { return; } if (currentState == DozerState.Hidden || currentState == DozerState.ClosedEyes || currentState == DozerState.OpenEyes) { previousVolume = AudioListener.volume; } if (isOnCooldown) { cooldownTimer += Time.deltaTime; if (cooldownTimer >= cooldownTime) { isOnCooldown = false; cooldownTimer = 0f; timer = 0f; nextAppearTime = Random.Range(Plugin.MinSpawnTime.Value, Plugin.MaxSpawnTime.Value); } } else if (val.isPlayerDead) { if (currentState != 0) { overlayObject.SetActive(false); ((Component)blackBackground).gameObject.SetActive(false); audioSource.Stop(); currentState = DozerState.Hidden; timer = 0f; isOnCooldown = false; } } else { if (!IsPlayerInGame()) { return; } if (val.quickMenuManager.isMenuOpen) { overlayObject.SetActive(false); ((Component)blackBackground).gameObject.SetActive(false); return; } timer += Time.deltaTime; switch (currentState) { case DozerState.Hidden: if (isOnCooldown) { cooldownTimer += Time.deltaTime; if (cooldownTimer >= cooldownTime) { isOnCooldown = false; cooldownTimer = 0f; timer = 0f; nextAppearTime = Random.Range(Plugin.MinSpawnTime.Value, Plugin.MaxSpawnTime.Value); } } else if (timer >= nextAppearTime) { ShowClosedEyes(); } break; case DozerState.ClosedEyes: AnimateClosed(); if (timer >= Plugin.EyeOpenDelay.Value) { OpenEyes(); } break; case DozerState.OpenEyes: if (!IsPlayerSafe()) { TriggerScreamer(); } else if (timer >= Plugin.OpenEyesDuration.Value) { Hide(); } break; case DozerState.Screamer: AnimateScreamer(); if (timer >= 1.5f) { KillPlayer(); } break; } } } private void AnimateClosed() { if (currentState != DozerState.ClosedEyes) { return; } animTimer += Time.deltaTime; if (animTimer >= animSpeed) { animTimer = 0f; animFrame = (animFrame + 1) % 2; if ((Object)(object)closedSprites[animFrame] != (Object)null) { overlayImage.sprite = closedSprites[animFrame]; } } } private void AnimateScreamer() { animTimer += Time.deltaTime; if (animTimer >= 0.1f) { animTimer = 0f; animFrame++; if (animFrame >= 6) { overlayObject.SetActive(false); } else if ((Object)(object)screamerSprites[animFrame] != (Object)null) { overlayImage.sprite = screamerSprites[animFrame]; } } } private void ShowClosedEyes() { currentState = DozerState.ClosedEyes; timer = 0f; animFrame = 0; animTimer = 0f; overlayObject.SetActive(true); if ((Object)(object)closedSprites[0] != (Object)null) { overlayImage.sprite = closedSprites[0]; } if ((Object)(object)closedSound != (Object)null) { audioSource.clip = closedSound; audioSource.Play(); } } private void OpenEyes() { currentState = DozerState.OpenEyes; timer = 0f; animFrame = 0; animTimer = 0f; if ((Object)(object)openSprite != (Object)null) { overlayImage.sprite = openSprite; } audioSource.Stop(); } private void TriggerScreamer() { currentState = DozerState.Screamer; timer = 0f; animFrame = 0; animTimer = 0f; previousVolume = AudioListener.volume; AudioListener.volume = 0f; ((Component)blackBackground).gameObject.SetActive(true); overlayObject.SetActive(false); overlayObject.SetActive(true); if ((Object)(object)screamerSprites[0] != (Object)null) { overlayImage.sprite = screamerSprites[0]; } } public void ResetDozer() { currentState = DozerState.Hidden; timer = 0f; nextAppearTime = Random.Range(Plugin.MinSpawnTime.Value, Plugin.MaxSpawnTime.Value); overlayObject.SetActive(false); } private void Hide() { currentState = DozerState.Hidden; timer = 0f; overlayObject.SetActive(false); ((Component)blackBackground).gameObject.SetActive(false); isOnCooldown = true; cooldownTimer = 0f; nextAppearTime = Random.Range(Plugin.MinSpawnTime.Value, Plugin.MaxSpawnTime.Value); audioSource.Stop(); } private void KillPlayer() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController != (Object)null) { localPlayerController.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 1, default(Vector3)); } AudioListener.volume = previousVolume; overlayObject.SetActive(false); ((Component)blackBackground).gameObject.SetActive(false); audioSource.Stop(); currentState = DozerState.Hidden; timer = 0f; isOnCooldown = false; } private bool IsPlayerSafe() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null) { return true; } bool isCrouching = val.isCrouching; Vector3 velocity = val.thisController.velocity; bool flag = ((Vector3)(ref velocity)).magnitude > 0.1f; return isCrouching && !flag; } private bool IsPlayerInGame() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null) { return false; } if (val.isPlayerDead) { return false; } return !val.isInHangarShipRoom && (Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.shipHasLanded; } private void CreateOverlay() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ff: 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_012d: 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) GameObject val = new GameObject("DozerCanvas"); Canvas val2 = val.AddComponent<Canvas>(); val2.renderMode = (RenderMode)0; val2.sortingOrder = 100; Object.DontDestroyOnLoad((Object)(object)val); GameObject val3 = new GameObject("DozerBlackBg"); val3.transform.SetParent(val.transform, false); blackBackground = val3.AddComponent<Image>(); ((Graphic)blackBackground).color = new Color(0f, 0f, 0f, 1f); RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; val3.SetActive(false); overlayObject = new GameObject("DozerImage"); overlayObject.transform.SetParent(val.transform, false); overlayImage = overlayObject.AddComponent<Image>(); RectTransform component2 = overlayObject.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0.5f, 0.5f); component2.anchorMax = new Vector2(0.5f, 0.5f); component2.sizeDelta = new Vector2(400f, 400f); component2.anchoredPosition = Vector2.zero; overlayObject.SetActive(false); } } [HarmonyPatch(typeof(PlayerControllerB), "Start")] public class DozerPatch { private static void Postfix(PlayerControllerB __instance) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown if (((NetworkBehaviour)__instance).IsOwner && !((Object)(object)Object.FindObjectOfType<DozerBehaviour>() != (Object)null)) { int num = Random.Range(0, 100); if (num >= Plugin.SpawnChance.Value) { Debug.Log((object)$"Dozer Entity: не появится в этом раунде (бросок {num}, нужно < {Plugin.SpawnChance.Value})"); return; } GameObject val = new GameObject("DozerManager"); val.AddComponent<DozerBehaviour>(); Object.DontDestroyOnLoad((Object)(object)val); Debug.Log((object)$"Dozer Entity: менеджер создан! (бросок {num})"); } } } [HarmonyPatch(typeof(PlayerControllerB), "SpawnDeadAnimation")] public class DozerRespawnPatch { private static void Postfix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner) { DozerBehaviour dozerBehaviour = Object.FindObjectOfType<DozerBehaviour>(); if ((Object)(object)dozerBehaviour != (Object)null) { dozerBehaviour.ResetDozer(); Debug.Log((object)"Dozer Entity: сброс после возрождения!"); } } } } [HarmonyPatch(typeof(PlayerControllerB), "Start")] public class KookooPatch { private static void Postfix(PlayerControllerB __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown if (((NetworkBehaviour)__instance).IsOwner && !((Object)(object)Object.FindObjectOfType<KookooBehaviour>() != (Object)null)) { GameObject val = new GameObject("KookooManager"); val.AddComponent<KookooBehaviour>(); Object.DontDestroyOnLoad((Object)(object)val); Debug.Log((object)"Kookoo: менеджер создан!"); } } } public class KookooBehaviour : MonoBehaviour { private enum KookooState { Hidden, ShowNumber, Countdown, Finished, Screamer } private KookooState currentState = KookooState.Hidden; private float timer = 0f; private float nextAppearTime = 0f; private int targetNumber = 0; private int currentCount = 0; private GameObject overlayRoot; private Image kookooImage; private Image borderImage; private Image armImage; private Image clockImage; private Image numberImage; private Image blackBackground; private Sprite[] kookooSprites = (Sprite[])(object)new Sprite[2]; private Sprite borderSprite; private Sprite[] armSprites = (Sprite[])(object)new Sprite[5]; private Sprite[] numberSprites = (Sprite[])(object)new Sprite[10]; private Sprite[] clockSprites = (Sprite[])(object)new Sprite[8]; private Sprite[] finishedSprites = (Sprite[])(object)new Sprite[4]; private float animTimer = 0f; private int animFrame = 0; private float kookooAnimTimer = 0f; private int kookooAnimFrame = 0; private AudioSource audioSource; private string modFolder; private void Start() { modFolder = Path.Combine(Paths.PluginPath, "DozerEntity"); LoadSprites(); CreateOverlay(); audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); nextAppearTime = Random.Range(Plugin.MinSpawnTime.Value, Plugin.MaxSpawnTime.Value); } private void LoadSprites() { kookooSprites[0] = LoadSprite("kookoo_1.png"); kookooSprites[1] = LoadSprite("kookoo_2.png"); borderSprite = LoadSprite("kookoo_border.png"); for (int i = 0; i < 5; i++) { armSprites[i] = LoadSprite($"kookoo_arm_{i + 1}.png"); } for (int j = 0; j < 10; j++) { numberSprites[j] = LoadSprite($"kookoo_num_{j}.png"); } for (int k = 0; k < 8; k++) { clockSprites[k] = LoadSprite($"kookoo_clock_{k + 1}.png"); } for (int l = 0; l < 4; l++) { finishedSprites[l] = LoadSprite($"kookoo_finished_{l + 1}.png"); } } private Sprite LoadSprite(string filename) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) string text = Path.Combine(modFolder, filename); if (!File.Exists(text)) { Debug.LogError((object)("Kookoo: файл не найден — " + text)); return null; } byte[] array = File.ReadAllBytes(text); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } private void Update() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null) { return; } if (currentState == KookooState.Hidden || currentState == KookooState.ShowNumber || currentState == KookooState.Countdown) { } if (val.isPlayerDead) { ForceHide(); } else { if (!IsPlayerInGame()) { return; } timer += Time.deltaTime; AnimateKookoo(); switch (currentState) { case KookooState.Hidden: if (timer >= nextAppearTime) { ShowNumber(); } break; case KookooState.ShowNumber: AnimateArm(); if (timer >= 2f) { StartCountdown(); } break; case KookooState.Countdown: AnimateClock(); UpdateCountdownNumber(); if (currentCount >= targetNumber) { ShowFinished(); } break; case KookooState.Finished: AnimateFinished(); if (timer >= 1f) { CheckPlayer(); } break; case KookooState.Screamer: if (timer >= 1.5f) { KillPlayer(); } break; } } } private void ShowNumber() { currentState = KookooState.ShowNumber; timer = 0f; animFrame = 0; targetNumber = Random.Range(3, 11); overlayRoot.SetActive(true); ((Component)armImage).gameObject.SetActive(true); ((Component)clockImage).gameObject.SetActive(false); if ((Object)(object)numberSprites[targetNumber - 1] != (Object)null) { numberImage.sprite = numberSprites[targetNumber - 1]; } } private void StartCountdown() { currentState = KookooState.Countdown; timer = 0f; animFrame = 0; animTimer = 0f; currentCount = 0; ((Component)armImage).gameObject.SetActive(false); ((Component)clockImage).gameObject.SetActive(true); if ((Object)(object)numberSprites[0] != (Object)null) { numberImage.sprite = numberSprites[0]; } } private void UpdateCountdownNumber() { int num = Mathf.FloorToInt(timer); if (num != currentCount && num <= targetNumber) { currentCount = num; if ((Object)(object)numberSprites[currentCount] != (Object)null) { numberImage.sprite = numberSprites[currentCount]; } } } private void ShowFinished() { currentState = KookooState.Finished; timer = 0f; animFrame = 0; animTimer = 0f; ((Component)clockImage).gameObject.SetActive(false); } private void CheckPlayer() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null) { Hide(); } else if ((Object)(object)val.currentlyHeldObjectServer != (Object)null) { TriggerScreamer(); } else { Hide(); } } private void TriggerScreamer() { currentState = KookooState.Screamer; timer = 0f; ((Component)blackBackground).gameObject.SetActive(true); AudioListener.volume = 0f; } private void KillPlayer() { //IL_001f: 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_002f: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val != (Object)null) { val.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 1, default(Vector3)); } AudioListener.volume = 1f; ForceHide(); } private void Hide() { currentState = KookooState.Hidden; timer = 0f; overlayRoot.SetActive(false); ((Component)blackBackground).gameObject.SetActive(false); nextAppearTime = Random.Range(Plugin.MinSpawnTime.Value, Plugin.MaxSpawnTime.Value); } private void ForceHide() { currentState = KookooState.Hidden; timer = 0f; overlayRoot.SetActive(false); ((Component)blackBackground).gameObject.SetActive(false); AudioListener.volume = 1f; } private void AnimateKookoo() { if (currentState == KookooState.Hidden) { return; } kookooAnimTimer += Time.deltaTime; if (kookooAnimTimer >= 0.3f) { kookooAnimTimer = 0f; kookooAnimFrame = (kookooAnimFrame + 1) % 2; if ((Object)(object)kookooSprites[kookooAnimFrame] != (Object)null) { kookooImage.sprite = kookooSprites[kookooAnimFrame]; } } } private void AnimateArm() { animTimer += Time.deltaTime; if (animTimer >= 0.2f) { animTimer = 0f; animFrame = (animFrame + 1) % 5; if ((Object)(object)armSprites[animFrame] != (Object)null) { armImage.sprite = armSprites[animFrame]; } } } private void AnimateClock() { animTimer += Time.deltaTime; if (animTimer >= 0.15f) { animTimer = 0f; animFrame = (animFrame + 1) % 8; if ((Object)(object)clockSprites[animFrame] != (Object)null) { clockImage.sprite = clockSprites[animFrame]; } } } private void AnimateFinished() { animTimer += Time.deltaTime; if (animTimer >= 0.15f) { animTimer = 0f; animFrame = (animFrame + 1) % 4; if ((Object)(object)finishedSprites[animFrame] != (Object)null) { clockImage.sprite = finishedSprites[animFrame]; } } } private bool IsPlayerInGame() { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null) { return false; } if (val.isPlayerDead) { return false; } return !val.isInHangarShipRoom && (Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.shipHasLanded; } private void CreateOverlay() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("KookooCanvas"); Canvas val2 = val.AddComponent<Canvas>(); val2.renderMode = (RenderMode)0; val2.sortingOrder = 99; Object.DontDestroyOnLoad((Object)(object)val); GameObject val3 = new GameObject("KookooBlackBg"); val3.transform.SetParent(val.transform, false); blackBackground = val3.AddComponent<Image>(); ((Graphic)blackBackground).color = Color.black; RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; val3.SetActive(false); overlayRoot = new GameObject("KookooRoot"); overlayRoot.transform.SetParent(val.transform, false); overlayRoot.SetActive(false); kookooImage = CreateImage("KookooSprite", overlayRoot.transform, new Vector2(300f, 300f)); borderImage = CreateImage("KookooBorder", overlayRoot.transform, new Vector2(350f, 350f)); armImage = CreateImage("KookooArm", overlayRoot.transform, new Vector2(250f, 250f)); clockImage = CreateImage("KookooClock", overlayRoot.transform, new Vector2(280f, 280f)); numberImage = CreateImage("KookooNumber", overlayRoot.transform, new Vector2(100f, 100f)); } private Image CreateImage(string name, Transform parent, Vector2 size) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_002f: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); Image result = val.AddComponent<Image>(); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.sizeDelta = size; component.anchoredPosition = Vector2.zero; return result; } } [BepInPlugin("com.yourname.dozerentity", "Dozer Entity", "1.0.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("com.yourname.dozerentity"); public static ConfigEntry<int> SpawnChance; public static ConfigEntry<float> EyeOpenDelay; public static ConfigEntry<float> OpenEyesDuration; public static ConfigEntry<float> MinSpawnTime; public static ConfigEntry<float> MaxSpawnTime; private void Awake() { SpawnChance = ((BaseUnityPlugin)this).Config.Bind<int>("General", "SpawnChance", 35, "Шанс появления Дозера за раунд (0-100)"); EyeOpenDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Timing", "EyeOpenDelay", 1.5f, "Время в секундах перед открытием глаз"); OpenEyesDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Timing", "OpenEyesDuration", 3f, "Сколько секунд дозер остаётся с открытыми глазами"); MinSpawnTime = ((BaseUnityPlugin)this).Config.Bind<float>("Timing", "MinSpawnTime", 10f, "Минимальное время в секундах до появления Дозера"); MaxSpawnTime = ((BaseUnityPlugin)this).Config.Bind<float>("Timing", "MaxSpawnTime", 30f, "Максимальное время в секундах до появления Дозера"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Dozer Entity загружен!"); harmony.PatchAll(); } }