using UnityEngine; public class Enemy : MonoBehaviour { public string enemyType = "Goblin"; public int health = 100; public bool IsDead { get; private set; } public void TakeDamage(int amount) { if (IsDead || amount <= 0) { return; } health -= amount; if (health <= 0) { Die(); } else if (NotificationUI.Instance != null) { NotificationUI.Instance.Show($"{enemyType}: {health} HP"); } } public void Die() { if (IsDead) { return; } IsDead = true; if (QuestManager.Instance != null) { QuestManager.Instance.OnEnemyKilled(enemyType); } if (NotificationUI.Instance != null) { NotificationUI.Instance.Show($"{enemyType} уничтожен"); } Destroy(gameObject); } }