using UnityEngine; using UnityEngine.UI; public class NearbyVignette : MonoBehaviour { public static NearbyVignette Instance; public AudioSource Sound; public GameObject Vignette; float showTime; float soundCooldown; private void Awake() { Instance = this; } private void Update() { if (Time.time < showTime) { Vignette.SetActive(true); } else { Vignette.SetActive(false); } } public static void Show() { if (!Instance) return; if (Time.time > Instance.soundCooldown) { Instance.soundCooldown = Time.time + 5; Instance.Sound.Play(); } Instance.showTime = Time.time + 0.5f; } }