public static void Update(uGUI_RadiationWarning __instance) { if (Player.main == null) { return; } // Get the background gameObject for the radiation warning var background = GameObject.Find("RadiationWarning").FindChild("Background"); // Get its animation component Animation a = background?.GetComponent <Animation>(); // Check if we're currently immune to the radiation if (Player.main.radiationAmount <= 0) { if (!immuneMessage.Equals(__instance.text.text)) { __instance.text.text = immuneMessage; // Use alternate text __instance.transform.localPosition = new Vector3(720f, 550f, 0f); // Put in upper right if (a != null) { //a.Rewind(); AnimationState s = a.GetState(0); s.normalizedTime = 0.25f; // Pick out a not-too-bright, not-too-dull frame of the animation a.Play(); a.Sample(); // Forces the pose to be calculated a.Stop(); // Actually commits the pose without waiting until end of frame a.enabled = false; // Now cease looping the animation } } } else { if (immuneMessage.Equals(__instance.text.text)) { __instance.OnLanguageChanged(); // Reset to regular all-caps message __instance.transform.localPosition = new Vector3(0f, 420f, 0f); // Reset to its default position if (a != null) { a.enabled = true; // Resume looping the animation a.Play(); } } } }
public static bool IsRadiated(uGUI_RadiationWarning __instance, ref bool __result) { Player main = Player.main; if (main == null || !radiated) { __result = false; } else { PDA pda = main.GetPDA(); // Display if pda is null or isn't in use __result = pda == null || !pda.isInUse; } return(false); // We're doing the same thing as the base method, just more. }