/// <summary> /// Updates the current fill amount on all HPBars to show HP being added or lost /// </summary> /// <param name="isLoss"> Flag for if damaged animation should play </param> /// <param name="isHealAnim"> Flag for if there is a healing animation that needs to be yielded to </param> /// <param name="isEventDes"> Flag for if there should be yielding at all (otherwise no animations or event description) </param> /// <returns> IEnumerator for animations </returns> public IEnumerator DisplayHPChange(bool isLoss, bool isHealAnim = false, bool isYield = true) { isAnimating = true; if (statusPanelHPBar != null) { statusPanelHPBar.SetCurrent(pm.CHP); } if (statsPanelHPBar != null) { statsPanelHPBar.SetCurrentDisplayCurrentOverMax(pm.CHP); } if (isYield == false) // no event description means no yielding or animations (only if an attack uses hp as a cost) { if (partyPanel.isOpen == true) { partyPanelHPBar.SetCurrent(pm.CHP); } } else if (partyPanel.isOpen == true) { partyPanelHPBar.SetCurrent(pm.CHP); if (isLoss == true && CombatManager.instance.inCombat == true) { if (isCrit == true) { eventDescription.SetPMDamageCritText(pm, attackAmount); yield return(StartCoroutine(pmdPartyPanel.PlayCritDamagedAnimation())); isCrit = false; } else { eventDescription.SetPMDamageText(pm, attackAmount); yield return(StartCoroutine(pmdPartyPanel.PlayDamagedAnimation())); } if (pm.CHP == 0) { yield return(new WaitForSeconds(0.5f / GameManager.instance.gsDataCurrent.animationSpeed)); } } else if (isLoss == false && CombatManager.instance.inCombat == true && isHealAnim == true) { if (attackAmount < 0) // heals coming from statusEffects are negative values { attackAmount *= -1; } if (isCrit == true) { eventDescription.SetPMHealCritText(pm, attackAmount); isCrit = false; } else { eventDescription.SetPMHealText(pm, attackAmount); } yield return(new WaitForSeconds(1f / GameManager.instance.gsDataCurrent.animationSpeed)); } } else { if (isLoss == true && CombatManager.instance.inCombat == true) { if (isCrit == true) { eventDescription.SetPMDamageCritText(pm, attackAmount); isCrit = false; } else { eventDescription.SetPMDamageText(pm, attackAmount); } } else if (isLoss == false && CombatManager.instance.inCombat == true && isHealAnim == true) { if (attackAmount < 0) // heals coming from statusEffects are negative values { attackAmount *= -1; } if (isCrit == true) { eventDescription.SetPMHealCritText(pm, attackAmount); isCrit = false; } else { eventDescription.SetPMHealText(pm, attackAmount); } } yield return(new WaitForSeconds(1f / GameManager.instance.gsDataCurrent.animationSpeed)); } isAnimating = false; }