Fix Bug double Winscreen
This commit is contained in:
parent
c7b19923a9
commit
9efdf46c15
|
@ -41,14 +41,16 @@ public class Enemy : MonoBehaviour
|
|||
transform.position = Vector3.MoveTowards(transform.position, target.position, moveSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
private bool isDead = false;
|
||||
|
||||
private async void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (other.CompareTag("Bullet"))
|
||||
if (other.CompareTag("Bullet") && !isDead)
|
||||
{
|
||||
GameObject bullet = other.gameObject;
|
||||
bullet.SetActive(false);
|
||||
|
||||
if (health >= 1)
|
||||
if (health > 0)
|
||||
{
|
||||
health -= damage;
|
||||
|
||||
|
@ -60,13 +62,10 @@ public class Enemy : MonoBehaviour
|
|||
if (health <= 0)
|
||||
{
|
||||
health = 0;
|
||||
isDead = true;
|
||||
await ExecuteBosDeath();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await ExecuteBosDeath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue