FadeToBlack, DayComplete

This commit is contained in:
apolloxyx 2025-05-10 02:16:43 -04:00
parent 58a58c70c3
commit 8cf29eed5a
7 changed files with 3570 additions and 9 deletions

View file

@ -3,30 +3,62 @@ using TMPro;
public class Day1CarExitTrigger : MonoBehaviour
{
public GameObject dayCompleteUI; // UI panel that shows "Day 1 Complete!"
public TMP_Text messageText; // Optional text to show messages
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)
{
if (!other.CompareTag("Player")) return;
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!'");
}
Debug.Log("Day complete! Player has keys.");
Time.timeScale = 0f;
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
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...'");
}
}
}
}