KitchenChaos/Assets/Scripts/UI/StoveBurnFlashingBarUI.cs

21 lines
715 B
C#

using UnityEngine;
public class StoveBurnFlashingBarUI : MonoBehaviour {
private const string IsFlashing = "IsFlashing";
[SerializeField] private StoveCounter stoveCounter;
private Animator animator;
private void Awake() {
animator = GetComponent<Animator>();
}
private void Start() {
stoveCounter.OnProgressChanged += StoveCounter_OnProgressChanged;
animator.SetBool(IsFlashing, false);
}
private void StoveCounter_OnProgressChanged(object sender, IHasProgress.ProgressChangedEventArgs e) {
float burnShowProgressAmount = .5f;
animator.SetBool(IsFlashing, stoveCounter.IsFried() && e.ProgressNormalized >= burnShowProgressAmount);
}
}