diff --git a/Assets/Scripts/Player/HealthComponent.cs b/Assets/Scripts/Player/HealthComponent.cs index 317877d..0dee386 100644 --- a/Assets/Scripts/Player/HealthComponent.cs +++ b/Assets/Scripts/Player/HealthComponent.cs @@ -33,17 +33,17 @@ public class HealthComponent : MonoBehaviour, ISquezeDamageReceiver void Awake() { currentHealth = maxHealth; - OnHealthChange.AddListener((_, _) => showRedTint = 1); + OnHealthChange.AddListener((_, _) => showRedTint = true); StartCoroutine(RedTintLoop()); } - float showRedTint = 0; + bool showRedTint = false; private IEnumerator RedTintLoop() { SpriteRenderer sr = GetComponentInChildren(); while (true) { - if (showRedTint < 0.1f) + if (!showRedTint) { yield return new WaitForSecondsRealtime(0.1f); continue; @@ -53,6 +53,28 @@ public class HealthComponent : MonoBehaviour, ISquezeDamageReceiver yield return new WaitForSecondsRealtime(0.1f); sr.color = Color.white; yield return new WaitForSecondsRealtime(0.1f); + sr.color = Color.red; + yield return new WaitForSecondsRealtime(0.1f); + sr.color = Color.white; + yield return new WaitForSecondsRealtime(0.1f); + sr.color = Color.red; + yield return new WaitForSecondsRealtime(0.1f); + sr.color = Color.white; + yield return new WaitForSecondsRealtime(0.1f); + sr.color = Color.red; + yield return new WaitForSecondsRealtime(0.1f); + sr.color = Color.white; + yield return new WaitForSecondsRealtime(0.1f); + sr.color = Color.red; + yield return new WaitForSecondsRealtime(0.1f); + sr.color = Color.white; + yield return new WaitForSecondsRealtime(0.1f); + sr.color = Color.red; + yield return new WaitForSecondsRealtime(0.1f); + sr.color = Color.white; + yield return new WaitForSecondsRealtime(0.1f); + + showRedTint = false; } }