using System.Collections; using System.Collections.Generic; using UnityEngine; public class Target : MonoBehaviour { public float health = 2f; public void DamageReceived (float damageAmount) { health -= damageAmount; if (health <= 0f) { Die(); } } void Die() { Destroy(gameObject); } }