/// <summary> /// Displays a change in HP /// </summary> /// <param name="amount"> Positive int amount changed </param> /// <param name="isLoss"> True if health is lost, positive if gained </param> /// <param name="animationClipName"> Name of animation to play overtop of monster </param> /// <param name="setDescription"> True to set description text on healing, false otherwise </param> /// <returns> IEnumerator for animations </returns> public IEnumerator DisplayHPChange(int amount, bool isLoss, bool setDescription, string animationClipName) { isAnimating = true; SetEffectsAnimatorClip(animationClipName); if (isLoss) { yield return(StartCoroutine(PlayAnimation(effectsAnimator, "attacked"))); dt.ShowDamage(amount); HPBar.SetCurrent(displayedMonster.CHP); if (isCrit == true) { yield return(StartCoroutine(PlayTwoAnimations(monsterAnimator, dt.textAnimator, "damagedCrit", "showCritDamage"))); isCrit = false; } else { yield return(StartCoroutine(PlayTwoAnimations(monsterAnimator, dt.textAnimator, "damaged", "showDamage"))); } dt.HideDamage(); } else { if (setDescription == true) { if (isCrit == true) { eventDescription.SetMHealCritText(displayedMonster, amount); isCrit = false; } else { eventDescription.SetMHealText(displayedMonster, amount); } } HPBar.SetCurrent(displayedMonster.CHP); yield return(new WaitForSeconds(1f / GameManager.instance.gsDataCurrent.animationSpeed)); } isAnimating = false; }