using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using HarmonyLib;
using UnityEngine;
using UnityModManagerNet;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Avatar_FaceHugger")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Avatar_FaceHugger")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("79c07eec-d1a1-4129-a477-6026b516b949")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AvatarFaceHuggerMod;
public static class Main
{
public static ModEntry mod;
public static bool enabled;
private static bool Load(ModEntry modEntry)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
mod = modEntry;
modEntry.OnToggle = OnToggle;
Harmony val = new Harmony(modEntry.Info.Id);
Assembly executingAssembly = Assembly.GetExecutingAssembly();
val.PatchAll(executingAssembly);
return true;
}
private static bool OnToggle(ModEntry modEntry, bool value)
{
enabled = value;
return true;
}
}
[HarmonyPatch(typeof(PlayerHUD), "ShowFaceHugger")]
internal static class Avatar_FaceHugger_Patch
{
private static void Prefix(PlayerHUD __instance)
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
if (Main.enabled)
{
__instance.showFaceHugger = true;
((SpriteBase)__instance.faceHugger1).SetSize((float)Traverse.Create((object)__instance).Field("avatarFacingDirection").GetValue<int>() * ((SpriteBase)__instance.faceHugger1).width, ((SpriteBase)__instance.faceHugger1).height);
__instance.avatar.SetLowerLeftPixel(new Vector2(__instance.faceHugger1.lowerLeftPixel.x, 1f));
((Component)__instance.faceHugger1).gameObject.SetActive(true);
}
}
}
[HarmonyPatch(typeof(PlayerHUD), "Start")]
internal static class Start_Patch
{
private static void Postfix(PlayerHUD __instance)
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
if (Main.enabled)
{
Shader shader = ((Renderer)((SpriteBase)__instance.avatar).MeshRenderer).material.shader;
if ((Object)(object)shader != (Object)null)
{
__instance.faceHugger1.meshRender.material.shader = shader;
__instance.faceHugger1.meshRender.material.SetColor("_TintColor", new Color(0.5f, 0.5f, 0.5f, 0.5f));
__instance.faceHugger2.meshRender.material.shader = shader;
__instance.faceHugger2.meshRender.material.SetColor("_TintColor", new Color(0.5f, 0.5f, 0.5f, 0.5f));
}
}
}
}