26 lines
686 B
C#
26 lines
686 B
C#
using UnityEngine;
|
|
|
|
public class StoveBurnWarningUI : MonoBehaviour {
|
|
[SerializeField] private StoveCounter stoveCounter;
|
|
|
|
private void Start() {
|
|
stoveCounter.OnProgressChanged += StoveCounter_OnProgressChanged;
|
|
Hide();
|
|
}
|
|
|
|
private void StoveCounter_OnProgressChanged(object sender, IHasProgress.ProgressChangedEventArgs e) {
|
|
float burnShowProgressAmount = .5f;
|
|
if (stoveCounter.IsFried() && e.ProgressNormalized >= burnShowProgressAmount)
|
|
Show();
|
|
else
|
|
Hide();
|
|
}
|
|
|
|
private void Show() {
|
|
gameObject.SetActive(true);
|
|
}
|
|
|
|
private void Hide() {
|
|
gameObject.SetActive(false);
|
|
}
|
|
} |