private void OnBeatEvent(int beatcount, bool playerSuccess, float nextBeat, BeatManager.BeatAction nextBeatAction)
 {
     if (!playerSuccess)
     {
         _health.AccountDamages(Damage, BeatManager.Instance.gameObject);
         HurtFx.Instance.TriggerHurtFx(Color.red, true);
     }
 }
    private void OnBeatEvent(int beatCount, bool playerSuccess, float nextBeat, BeatManager.BeatAction requiredBeatAction)
    {
        if (beatCount > 0)
        {
            ShowResolveVizualization(playerSuccess);
        }

        var delay    = Mathf.Max(0, nextBeat - PreviewTime);
        var duration = Mathf.Min(PreviewTime, nextBeat);

        StartCoroutine(ShowVizualization(duration, delay, requiredBeatAction));
    }
    private IEnumerator ShowVizualization(float duration, float delay, BeatManager.BeatAction beatAction)
    {
        var startTime = Time.time;

        if (delay > 0)
        {
            yield return(new WaitForSeconds(delay));
        }

        _buttonImage.sprite = _beatActionSprites[beatAction];

        var delta = Time.time - (startTime + delay);

        Tween(0f, 1f, 0.2f, EasingFunction.EaseOutQuad, SetBeatActionAlpha);

        Tween(0f, 1f, duration - delta, Mathf.Lerp, SetProgressNormalized);
    }