using UnityEngine;
public class Enemy : MonoBehaviour
{
public int points = 10;
private void OnTriggerEnter2D(Collider2D collision)
{
Debug.Log("Enemy collided with: " + collision.gameObject.name);
if (collision.CompareTag("PlayerBullet"))
{
Debug.Log("Player bullet confirmed!");
Destroy(collision.gameObject);
if (ScoreManager.instance == null)
{
Debug.Log("ScoreManager instance is NULL!");
}
else
{
Debug.Log("ScoreManager found! Adding score...");
ScoreManager.instance.AddScore(points);
}
Destroy(gameObject);
}
}
}