private void Update() { for (var index = 0; index < boosters.Length; index++) { if (!boostersImage[index]) { continue; } if (boostersImage[index].fillAmount > 0) { boostersImage[index].fillAmount -= Time.deltaTime / boosterDuration; } else { boostersImage[index] = null; openAndCloseCore.Close(boosters[index].transform); if (index == (int)BoosterTypes.speed) { animatorController.DecreaseAnimationSpeed(); } } } }
private void Update() { if (_isAdBonusActive) { _currentTime += Time.deltaTime; _adFillerImage.fillAmount = 1 - _currentTime / duration; if (_currentTime >= duration) { _isAdBonusActive = false; _currentTime = 0; _openAndCloseCore.Close(adBonus.transform); } } else { if (Random.value < everySecondProbability * Time.deltaTime) { _isAdBonusActive = true; _openAndCloseCore.Open(adBonus.transform); } } }