private void OnEnable()
{
EventBus.BombWasDied += DisableTimer;
EventBus.onBombFallInGlass += DisableTimer;
}
private void OnDisable()
{
EventBus.BombWasDied -= DisableTimer;
EventBus.onBombFallInGlass -= DisableTimer;
}
private void DisableTimer()
{
StopCoroutine(TimerExplosionCoroutine); // попытка выключить таймер даёт null
}
private void ChangeValueTimerForExplosion()
{
Coroutine TimerExplosionCoroutine = StartCoroutine(TimerSliderCoroutine()); // пытался по урокам объявить, чтоб потом остановить
}
IEnumerator TimerSliderCoroutine()
{
if (TimeForeExplosion > CurrentTimeForeExplosion)
{
CurrentTimeForeExplosion++;
_sliderTimeExplosion.value--;
yield return new WaitForSeconds(.1f);
StartCoroutine(TimerSliderCoroutine());
}
else
{
EventBus.BombTimeNull?.Invoke();
yield break;
}
}
}