using System.Collections; using System.Collections.Generic; using UnityEngine; public class Toilette : MonoBehaviour { public AudioSource AudioSource; private bool _canFlush = true; public void Flush() { if (_canFlush) StartCoroutine(FlushRoutine()); } private IEnumerator FlushRoutine() { _canFlush = false; AudioSource.Play(); yield return new WaitForSeconds(5); _canFlush = true; } }