using asap.core; using UnityEngine; using PinballUncountable; using System.Threading.Tasks; using System; public class PinballUncountableExitFxCtrl : MonoBehaviour { [SerializeField] private GameObject _fx; private float _fxDuration = 1f; private bool _isPlaying = false; private void Awake() { if (_fx != null) _fx.SetActive(false); _isPlaying = false; } private void Reset() { _fx = transform.GetChild(0).gameObject; } public async void TryPlayFx() { try { if (_isPlaying) return; _isPlaying = true; if (_fx != null) { _fx.SetActive(false); _fx.SetActive(true); } await Task.Delay(TimeSpan.FromSeconds(_fxDuration)); _isPlaying = false; } catch (System.Exception e) { Debug.LogError(e); } } }