lose screen

This commit is contained in:
Josiah
2026-02-01 09:55:27 -06:00
parent ba1dd13b54
commit 1b6566ef2b
8 changed files with 339 additions and 1 deletions
+34
View File
@@ -0,0 +1,34 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LoseScreenController : MonoBehaviour
{
[SerializeField]private const string LoseSceneName = "Lose";
private List<PlayerStressController> players;
private bool hasLost = false;
void Awake()
{
players = FindObjectsOfType<PlayerStressController>().ToList();
}
void Update()
{
if (hasLost || players.Count == 0)
return;
if (players.All(p => p.IsPanicking))
{
TriggerLose();
}
}
void TriggerLose()
{
hasLost = true;
SceneManager.LoadScene(LoseSceneName);
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f5cdb566677d77e438cdf195197a5b85
+8
View File
@@ -6,10 +6,17 @@ using UnityEngine;
public class PlayerStressController : MonoBehaviour
{
public PlayerPickupController pickupController;
[Header("Stress Settings")]
public float currentStress = 0f;
public float maxStress = 100f;
[Header("Panic Settings")]
[SerializeField] private float panicDuration = 1.2f;
private float panicEndTime;
public bool IsPanicking => Time.time < panicEndTime;
void Start()
{
// Start the repeating loop
@@ -46,6 +53,7 @@ public class PlayerStressController : MonoBehaviour
void HandlePanic()
{
panicEndTime = Time.time + panicDuration;
Debug.Log("Player is freaking out man!");
// Add effects like screen shake or slowing down the player here
}
+1 -1
View File
@@ -7,7 +7,7 @@ public class WinScreenController : MonoBehaviour
{
[SerializeField] private int winScore = 100;
private string winScreenScene = "Win"; // ✅ DECLARED HERE
private string winScreenScene = "Win";
private void OnEnable()
{