Reorganize, revert changes for "fixing" Atlas maps

This commit is contained in:
msk
2023-07-31 00:12:10 -07:00
parent cf4b2847be
commit 73d8a5b89d
5 changed files with 70 additions and 41 deletions
+9 -32
View File
@@ -1,7 +1,6 @@
using HarmonyLib;
using System.Reflection;
using UnityEngine;
using UnityEngine.UI;
using FistVR;
namespace TNHQoLImprovements
@@ -13,9 +12,6 @@ namespace TNHQoLImprovements
{
public static TNH_Manager tnhManager;
private static Transform[] hands;
private static GameObject tnhInfo;
public static bool InHold()
{
if (tnhManager == null)
@@ -24,39 +20,20 @@ namespace TNHQoLImprovements
return tnhManager.Phase == TNH_Phase.Hold;
}
// Bring extra info into game over
public static void Patch(Harmony harmony)
{
var original = typeof(TNH_Manager).GetMethod("SetPhase", BindingFlags.NonPublic | BindingFlags.Instance);
var patch = typeof(InPlay).GetMethod("MoveStatsToController", BindingFlags.NonPublic | BindingFlags.Static);
harmony.Patch(original, postfix: new HarmonyMethod(patch));
}
private static void MoveStatsToController(TNH_Phase p)
{
if (tnhManager == null)
return;
if (p == TNH_Phase.Dead || p == TNH_Phase.Completed)
{
int handSide = tnhManager.RadarHand == TNH_RadarHand.Left ? 0 : 1;
tnhInfo.transform.SetParent(hands[handSide], false);
tnhInfo.GetComponent<TNHInfo>().GameOverPos();
}
}
void Start()
{
tnhManager = FindObjectOfType<TNH_Manager>();
var rig = Object.FindObjectOfType<FVRMovementManager>().transform;
hands = new Transform[] {
rig.transform.GetChild(1), rig.transform.GetChild(0)
};
TNHInfo.instance = Instantiate<GameObject>(MeatKitPlugin.bundle.LoadAsset<GameObject>("TNHInfo"),
FindObjectOfType<TAH_Reticle>().transform.GetChild(3))
.GetComponent<TNHInfo>();
TNHInfo.instance.transform.localScale = new Vector3(0.002f, 0.002f, 0.002f);
}
tnhInfo = Instantiate<GameObject>(MeatKitPlugin.bundle.LoadAsset<GameObject>("TNHInfo"), FindObjectOfType<TAH_Reticle>().transform.GetChild(3));
tnhInfo.transform.localScale = new Vector3(0.002f, 0.002f, 0.002f);
void OnDestroy()
{
// Destroy statics
tnhManager = null;
}
}
}