private void Health_OnHealthModified(Health.HealthData healthData) { if (!gameObject.activeInHierarchy) { return; } // Check if health got decreased or added and play the according animation. // TODO: Add 'IncreaseHealth' animation, it just plays the decrease animation now. if (anim) { anim.SetTrigger(foregroundHealthBar.fillAmount > healthData.percentageHealth ? "DecreaseHealth" : "DecreaseHealth"); } foregroundHealthBar.fillAmount = healthData.percentageHealth; StartCoroutine(LerpBackgroundHealthBar(healthData.percentageHealth)); if (healthText) { healthText.text = healthData.currentHealth + "/" + healthData.maxHealth; } if (healthData.amountHealthChanged != null && showDamageText) { DamageText newDamageText = ObjectPooler.instance.GrabFromPool("DamageText", transform.position, transform.rotation).GetComponent <DamageText>(); if (healthData.isInvinsible && healthData.amountHealthChanged <= 0) { newDamageText.Initialise("Dodge"); } else { newDamageText.Initialise(healthData); } } }