private void Update() { if (!playSounds.IsPlayedInCollection()) { playSounds.PlayRandomSound(); } LivesText.text = $"x {playerHeath.lives}"; _donutCountText.text = $"x {donutCount.donutCount}"; if (playerHeath.health > 0) { healthText.text = $"x {playerHeath.health}"; } else { healthText.text = "0"; } CheckDescription(); // вызов метода изменения изображения здоровья игрока ChangeHealthSprite(); // условие получил ли игрок урон if (playerHeath.isHit) { // сброс таймера неуязвимости if (playerHeath.postHitTime <= 0) { playerHeath.isHit = false; } } }
private void Start() { playerHeath = GetComponent <PlayerHeathScript>(); playSounds = GetComponent <PlaySounds>(); donutCount = GetComponent <DonutCountScript>(); playSounds.PlayRandomSound(); }