added fxb store model
This commit is contained in:
commit
4bced375fd
7 changed files with 3987 additions and 9 deletions
3851
Assets/Scenes/Day1.unity
Normal file
3851
Assets/Scenes/Day1.unity
Normal file
File diff suppressed because it is too large
Load diff
7
Assets/Scenes/Day1.unity.meta
Normal file
7
Assets/Scenes/Day1.unity.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9fc0d4010bbf28b4594072e72b8655ab
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9fc0d4010bbf28b4594072e72b8655ab
|
||||
guid: 8178a583c90af5344aa16dbca804dc9d
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class CartReturnZone : MonoBehaviour
|
|||
public int cartsNeeded = 2; // How many to trigger car alarm
|
||||
public int cartsToEndDay = 10; // How many to spawn keys
|
||||
|
||||
private int score = 0;
|
||||
private int score = 9;
|
||||
private int cartsReturned = 0;
|
||||
private bool keysSpawned = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -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...'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
77
Assets/Scripts/FadeToBlack.cs
Normal file
77
Assets/Scripts/FadeToBlack.cs
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FadeToBlack : MonoBehaviour
|
||||
{
|
||||
public float fadeDuration = 2f;
|
||||
private Image fadeImage;
|
||||
private bool startFading = false;
|
||||
private float timer = 0f;
|
||||
private bool fadeComplete = false;
|
||||
public GameObject startMenuUI; // Assign this in Inspector if needed
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
fadeImage = GetComponent<Image>();
|
||||
|
||||
if (fadeImage == null)
|
||||
{
|
||||
Debug.LogError("FadeToBlack: No Image component found!");
|
||||
return;
|
||||
}
|
||||
|
||||
Color startColor = fadeImage.color;
|
||||
startColor.a = 0f;
|
||||
fadeImage.color = startColor;
|
||||
|
||||
Debug.Log("FadeToBlack: Initialized with alpha 0.");
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (startFading && !fadeComplete)
|
||||
{
|
||||
timer += Time.unscaledDeltaTime;
|
||||
float alpha = Mathf.Clamp01(timer / fadeDuration);
|
||||
|
||||
Color newColor = fadeImage.color;
|
||||
newColor.a = alpha;
|
||||
fadeImage.color = newColor;
|
||||
|
||||
if (alpha >= 1f)
|
||||
{
|
||||
fadeComplete = true;
|
||||
Debug.Log("FadeToBlack: Fade complete.");
|
||||
OnFadeComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StartFade()
|
||||
{
|
||||
Debug.Log("FadeToBlack: StartFade() called.");
|
||||
startFading = true;
|
||||
|
||||
if (fadeImage != null)
|
||||
{
|
||||
fadeImage.color = new Color(0f, 0f, 0f, 0f); // Ensure it's black and invisible at the start
|
||||
}
|
||||
|
||||
if (startMenuUI != null && startMenuUI.activeInHierarchy)
|
||||
{
|
||||
Debug.Log("Start menu was still active — disabling it.");
|
||||
startMenuUI.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void OnFadeComplete()
|
||||
{
|
||||
Debug.Log("Fade complete — now locking cursor and pausing game.");
|
||||
Time.timeScale = 0f;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/FadeToBlack.cs.meta
Normal file
11
Assets/Scripts/FadeToBlack.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e635644f8e71ad84e9205c093777cf0c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Add table
Add a link
Reference in a new issue