/* * ------------------------------------------------------------------------ * Description: This class handles colliosion detection for the player to end the game * Author: Eli Simpkins-Simmonds * ------------------------------------------------------------------------ */ using UnityEngine; public class CollisionDetector : MonoBehaviour { public GameObject endScreenPanel; // This method is called when another collider enters the trigger collider attached to the object where this script is attached void OnTriggerEnter2D(Collider2D other) { // Check if the collider that entered the trigger has the tag "Player" if (other.CompareTag("Player")) { ShowQuitScreen(); // Calls the ShowQuitScreen method to display the end screen panel } } // Method to display the end screen panel void ShowQuitScreen() { endScreenPanel.SetActive(true); // Activate the end screen panel GameObject } }