using UnityEngine; using TMPro; public class Day1CarExitTrigger : MonoBehaviour { public GameObject dayCompleteUI; // Panel that shows "Day 1 Complete!" public TMP_Text messageText; // Text field for displaying messages public FadeToBlack fadeScreen; // Reference to FadeToBlack script private void OnTriggerEnter(Collider other) { Debug.Log("Something entered car trigger: " + other.name); if (!other.CompareTag("Player")) { Debug.Log("Not the player, ignoring."); return; } Debug.Log("Player entered car trigger"); if (KeyPickup.hasKeys) { Debug.Log("Player has keys — showing UI and fading."); if (dayCompleteUI != null) { dayCompleteUI.SetActive(true); Debug.Log("Day complete UI enabled."); } if (messageText != null) { messageText.text = "Day 1 Complete!"; Debug.Log("Message text set to 'Day 1 Complete!'"); } if (fadeScreen != null) { fadeScreen.StartFade(); Debug.Log("Called StartFade() on FadeToBlack."); } else { Debug.LogWarning("Fade screen is not assigned!"); } // Optional: Move these into FadeToBlack if you want them after the fade completes // Time.timeScale = 0f; // Cursor.lockState = CursorLockMode.None; // Cursor.visible = true; } else { Debug.Log("Player does NOT have keys"); if (messageText != null) { messageText.text = "You need to find your keys near the car!"; Debug.Log("Message text set to 'You need to find your keys...'"); } } } }