public static void ShowBossHealthBar(On.RoR2.UI.HUDBossHealthBarController.orig_FixedUpdate orig, RoR2.UI.HUDBossHealthBarController self) { orig(self); self.gameObject.SetActive(MonsterConfiguration.ShowBossHealthBar.Value); }
//void InitializeFrameGluePermanent() //{ //} //void InitializeFrameGlueMutable() //{ // float lastTankEnergy = playerHealth; // uint tanksFilled = 0; //} // void UninitializeFrameGlueMutable() { } void UpdateEnergy(float dt, bool init) { float energy = Mathf.Max(0f, Mathf.Ceil(character.healthComponent.combinedHealth)); float fullHealth = Mathf.Ceil(character.healthComponent.fullCombinedHealth); uint numEnergyTanks = 6; uint filledTanks = 0; filledTanks = (uint)character.inventory.GetItemCount(RoR2Content.Items.ExtraLife); if (!init) { energyLow = isEnergyLow(); } if (init || energy != playerHealth || numEnergyTanks != totalEnergyTanks || fullHealth != maxPlayerHealth || filledTanks != filledEnergyTanks) { float lastTankEnergy = energy; if (energyIntf.checkEnergyBarIsActive(init)) { if (init) { energyIntf.initValues(hudTypes.combat, energy, fullHealth, (int)numEnergyTanks, (int)filledTanks, character.healthComponent, false); } energyIntf.SetCurrEnergy(energy, fullHealth, false); energyIntf.SetEnergyLow(energyLow); } playerHealth = energy; maxPlayerHealth = fullHealth; filledEnergyTanks = filledTanks; } if (bossEnergyIntf) { bossHealthBarRoot = gameObject.transform.parent.Find("HUDSimple(Clone)").GetComponent <RoR2.UI.HUD>().mainUIPanel.transform.Find("SpringCanvas/TopCenterCluster/BossHealthBarRoot").gameObject; bossInfo = bossHealthBarRoot.GetComponent <RoR2.UI.HUDBossHealthBarController>().currentBossGroup; //GameObject temp = Camera.current.GetComponent<CameraRigController>().hud.mainUIPanel.transform.Find("SpringCanvas/TopCenterCluster/BossHealthBarRoot").gameObject; if (bossInfo != null) { bossAlpha = bossEnergyIntf.GetCurrentHealth() > 0f ? 1 : 0; RoR2.UI.HUDBossHealthBarController tempBossHealth = bossHealthBarRoot.GetComponent <RoR2.UI.HUDBossHealthBarController>(); string bossName = tempBossHealth.bossNameLabel.GetParsedText(); string sub = tempBossHealth.bossSubtitleLabel.GetParsedText(); bossHealthBarRoot.GetComponent <Canvas>().enabled = false; //if (cachedBossHealth != bossInfo.totalObservedHealth) //{ // SamusPlugin.logger.Log(BepInEx.Logging.LogLevel.Info, "bossEnergyIntf's currentHealth: " + bossEnergyIntf.GetCurrentHealth()); // SamusPlugin.logger.Log(BepInEx.Logging.LogLevel.Info, "BossGroup's Health: " + bossInfo.totalObservedHealth); // SamusPlugin.logger.Log(BepInEx.Logging.LogLevel.Info, "BossAlpha: " + bossAlpha); // cachedBossHealth = bossInfo.totalObservedHealth; //} bossEnergyIntf.SetBossParams(true, bossName, sub, bossInfo.totalObservedHealth, bossInfo.totalMaxObservedMaxHealth, hudcolors, energyBar); } else { bossEnergyIntf.SetBossParams(false, "", "", 0f, 0f, hudcolors, energyBar); } } }