void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "character")
     {
         levelMenager.RespawnPlayer();
     }
 }
Exemple #2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "player")
     {
         lifeSystem.TakeLife();
         levelMenager.RespawnPlayer();
     }
 }
Exemple #3
0
    // 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;
    }