using UnityEngine; using Game; using Music; using Player; namespace Game { /// /// This class handles the logic for detecting when a player completes the obstacle course. /// public class ObstacleCourse : MonoBehaviour { /// /// The player who successfully completes the obstacle course. /// public static GameObject playerWon; /// /// Detects when a player enters the trigger area and ends the game. /// /// The collider of the object that entered the trigger. private void OnTriggerEnter2D(Collider2D collision) { // Check if the object entering the trigger is a player if (collision.gameObject.CompareTag("Player")) { // Set the player who won and trigger the game over logic playerWon = collision.gameObject; GameManager.Instance.GameOver(); } } } }