using System; using UnityEngine; public class Goal : MonoBehaviour { public Action OnGoalReached; private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Player")) { OnGoalReached?.Invoke(); } } }