private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Bullet")
     {
         player.GotHit();
         if (player.GetHealth() == 0)
         {
             Destroy(gameObject);
             SceneManager.LoadScene("P1Win");
         }
     }
 }
Exemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     healthText.text = player.GetHealth().ToString();
 }
Exemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     healthBar.value = playerCharacter.GetHealth();
     HPText.text     = "HP: " + playerCharacter.GetHealth() + "/" + playerCharacter.healthMax;
 }
 // Update is called once per frame
 void Update()
 {
     healthText.text = player.GetHealth().ToString(); //calls GetHealth function from player.cs
 }