void Attack() { // Reset the timer. timer = 0f; // If the player has health to lose... if (playerHealth.currentHealth > 0) { anim.SetBool("Attack", playerInRange); // ... damage the player. playerHealth.TakeDamage(attackDamage); } }
public void OnTriggerEnter(Collider other) { /*if (other.CompareTag("Bad_guy")) * { * if (currentHealth > 0) * { * // ... damage the player. * titanPlayerHealth.TakeDamage(10); * print("Hit"); * } * }*/ if (other.CompareTag("Hazard")) { if (currentHealth > 0) { // ... damage the player. titanPlayerHealth.TakeDamage(50); print("Hit yo"); } } }