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; void Awake() { players = Object.FindObjectsByType(FindObjectsSortMode.None).ToList(); } void Update() { if (players.Count == 0) return; if (players.All(p => p.isPanicking)) { TriggerLose(); } } void TriggerLose() { SceneManager.LoadScene(LoseSceneName); } }