mirror of
https://github.com/Kizuren/ShantiManti.git
synced 2026-01-07 15:09:42 +01:00
Refactored HealthBar and the LevelCounter scripts
This commit is contained in:
parent
293850d27e
commit
d43c55bcb9
2 changed files with 10 additions and 10 deletions
|
|
@ -8,13 +8,12 @@ public class HealthBar : MonoBehaviour
|
|||
public PlayerHealth playerHealth;
|
||||
public Slider slider;
|
||||
|
||||
void Start()
|
||||
private void Start()
|
||||
{
|
||||
slider.maxValue = playerHealth.health;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
private void Update()
|
||||
{
|
||||
slider.value = playerHealth.health;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,21 +4,22 @@ using UnityEngine;
|
|||
|
||||
public class LevelCounter : MonoBehaviour
|
||||
{
|
||||
Animator animator;
|
||||
private static readonly int FadeAnimationID = Animator.StringToHash("Fade");
|
||||
private Animator _animator;
|
||||
|
||||
void Start()
|
||||
private void Start()
|
||||
{
|
||||
animator = GetComponent<Animator>();
|
||||
StartCoroutine(Disabeling());
|
||||
_animator = GetComponent<Animator>();
|
||||
StartCoroutine(Disabling());
|
||||
}
|
||||
|
||||
IEnumerator Disabeling()
|
||||
private IEnumerator Disabling()
|
||||
{
|
||||
yield return new WaitForSeconds(2.0f);
|
||||
animator.SetBool("Fade", true);
|
||||
_animator.SetBool(FadeAnimationID, true);
|
||||
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
animator.SetBool("Fade", false);
|
||||
_animator.SetBool(FadeAnimationID, false);
|
||||
|
||||
yield return new WaitForSeconds(1.8f);
|
||||
Destroy(gameObject);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue