private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Bullet")
     {
         player.GotHit();
         if (player.GetHealth() == 0)
         {
             Destroy(gameObject);
             SceneManager.LoadScene("P1Win");
         }
     }
 }
예제 #2
0
 // Update is called once per frame
 void Update()
 {
     healthText.text = player.GetHealth().ToString();
 }
예제 #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
 }