using System.Collections; using System.Collections.Generic; using UnityEngine; public class HealthPickUp : MonoBehaviour { public int healthRestored = 10; // Start is called before the first frame update void Start() { } private void OnTriggerEnter2D(Collider2D collision) { Damageable damageable = collision.GetComponent(); if (damageable) { damageable.Heal(healthRestored); Destroy(gameObject); } } }