private void Start() { handler = FindObjectOfType <PlayerUIHandler>(); anim = GetComponent <Animator>(); controller = GetComponent <PlayerController>(); handler.UpdateHealth(totalHealth); }
public void DamageHealth(float dmg) { if (!isInvulnerable && !controller.GetRolling()) { if (!isDead) { GetComponent <PlayerCombat>().DisruptFirePunch(false); StartCoroutine(BecomeInvulnerable()); totalHealth -= dmg; handler.UpdateHealth(totalHealth); if (totalHealth <= 0) { HandleDeath(); } } } }