Example #1
0
    void Update()
    {
        if (playerHealth <= 0 && !isDead)
        {
            playerHealth = 0;
            Debug.Log("player is dead");
            levelManager.RespawnPlayer();
            lifeSystem.TakeLife();
            isDead = true;
        }

        if (playerHealth > maxHealth)
        {
            playerHealth = maxHealth;
        }
        //text.text = "" + playerHealth;

        healthBar.value = playerHealth;
    }