using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.SceneManagement; public class LoseScreenController : MonoBehaviour { [SerializeField]private const string LoseSceneName = "Lose"; private List players; private bool hasLost = false; void Awake() { players = FindObjectsOfType().ToList(); } void Update() { if (hasLost || players.Count == 0) return; if (players.All(p => p.IsPanicking)) { TriggerLose(); } } void TriggerLose() { hasLost = true; SceneManager.LoadScene(LoseSceneName); } }