public static void GetBooster(BoosterTypes boosterType) { var index = (int)boosterType; openAndCloseCore.Open(boosters[index].transform); boostersImage[index] = (boosters[index].GetComponent <Image>()); boostersImage[index].fillAmount = 1f; if (boosterType == BoosterTypes.speed) { animatorController.IncreaseAnimationSpeed(1.5f); } }
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); } } }