Revert "add small setup delays to address errors in Atlas maps"

This reverts commit 64d8df148b.
This commit is contained in:
msk
2023-07-30 22:46:37 -07:00
parent 64d8df148b
commit cf4b2847be
12 changed files with 31 additions and 55 deletions
+24 -23
View File
@@ -85,24 +85,8 @@ public static AssetBundle bundle;
private void SceneChanged(Scene from, Scene to)
{
StartCoroutine("SceneChangedCoRoutine");
}
private IEnumerator SceneChangedCoRoutine()
{
// grab H3VR objects
playerCamera = null;
hpDisplay = null;
while (playerCamera == null)
{
playerCamera = GameObject.FindGameObjectWithTag("MainCamera");
hpDisplay = FindObjectOfType<FVRHealthBar>();
yield return null;
}
// ---- MAINCAMERA FOUND SIGNIFIES THAT ESSENTIAL GAME OBJECTS HAVE LOADED IN ---- //
// find Agency font
playerCamera = GameObject.FindGameObjectWithTag("MainCamera");
hpDisplay = FindObjectOfType<FVRHealthBar>();
GetFonts();
// apply health counter tweaks globally
@@ -120,17 +104,34 @@ public static AssetBundle bundle;
WristMenuAPI.Buttons.Remove(wmbHPToggle);
}
if (GameObject.Find("_GameManager") != null || FindObjectOfType<TNH_Manager>() != null)
StartCoroutine("TryTNH");
}
private IEnumerator TryTNH()
{
for (int i = 0; i < 11; ++i)
{
Logger.LogInfo("We are in a TNH game!");
instance = new GameObject().AddComponent<InPlay>();
// TNH patches
if (GameObject.Find("_GameManager") != null || FindObjectOfType<TNH_Manager>() != null)
{
Logger.LogInfo("We are in a TNH game!");
instance = new GameObject().AddComponent<InPlay>();
break;
}
else
{
Logger.LogInfo(String.Format("Couldn't find a TNH game. Trying again...({0}/10)", i));
yield return new WaitForEndOfFrame();
}
}
else
// destroy self only if we are FOR SURE not in a TNH game
if (GameObject.Find("_GameManager") == null || FindObjectOfType<TNH_Manager>() == null)
{
Logger.LogInfo("We are NOT in a TNH game!");
Destroy(instance);
}
}
}
// called on scene change, find fonts from game if they're not set
private void GetFonts()