private void OnTriggerEnter2D(Collider2D collision) { Projectail missle = collision.gameObject.GetComponent <Projectail>(); if (missle && missle.Parent != "Enemy") { missle.Hit(); EnemyHealth -= missle.GetDamage(); if (EnemyHealth <= 0) { Destroy(this.gameObject); } } }
private void OnTriggerEnter2D(Collider2D collision) { Projectail missle = collision.gameObject.GetComponent <Projectail>(); if (missle && missle.Parent != "Player") { missle.Hit(); PlayerHealth -= missle.GetDamage(); if (PlayerHealth <= 0) { Destroy(this.gameObject); LevelManager.LoadLv("Lose"); } } }