GameVsJam/3d Prototyp/Assets/Toilette.cs

29 lines
507 B
C#
Raw Normal View History

2024-04-09 01:17:44 +02:00
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;
}
}