void OnTriggerEnter2D(Collider2D other) { if (other.name == "character") { levelMenager.RespawnPlayer(); } }
void OnTriggerEnter2D(Collider2D other) { if (other.name == "player") { lifeSystem.TakeLife(); levelMenager.RespawnPlayer(); } }
// Update is called once per frame void Update() { if (playerHealth <= 0 && !isDead) { playerHealth = 0; levelManager.RespawnPlayer(); lifeSystem.TakeLife(); isDead = true; } if (playerHealth > maxPlayerHealth) { playerHealth = maxPlayerHealth; } //text.text = "" + playerHealth; healthBar.value = playerHealth; }