Пример #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.K))
     {
         lvlManager.RespawnPlayer();
     }
 }
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "Player")
     {
         lifeSystem.TakeLife();
         lvlManager.RespawnPlayer();
     }
 }
    void Update()
    {
        if (playerHealth <= 0 && !isDead)
        {
            lifeSystem.TakeLife();
            playerHealth = 0;
            lvlmangr.RespawnPlayer();
            // lifeSystem.TakeLife();
            isDead = true;
            theTime.ResetTime();
        }

        if (playerHealth > maxPlayerHealth)
        {
            playerHealth = maxPlayerHealth;
        }

        healthBar.value = playerHealth;
        // text.text = "" + playerHealth;
    }