예제 #1
0
    IEnumerator EnableWoundedAnimation(bool isLast)
    {
        if (!isLast)
        {
            DisableAttackLogic();

            _bossHealthComponent.BecomeInvulnerable(); // дабы игрок не мог убить босса пока тот отдыхает, ему передаётся неуязвимость

            isInWoundedAnimation = true;

            GetComponent <Collider2D>().enabled = false;

            _woundedCollider.SetActive(true);

            _bossAnimator.SetInteger("AnimState", 4);

            yield return(new WaitForSeconds(2.6f));

            _bossHealthComponent.isLightlyWounded = false;

            _woundedCollider.SetActive(false);

            GetComponent <Collider2D>().enabled = true;

            isInWoundedAnimation = false;

            isWoundedAnimationPlayedOnce = true; // тот самый счётчик

            _bossHealthComponent.BecomeVulnerable();

            EnableAttackLogic();
        }

        else if (isLast)
        {
            _bossHealthComponent.BecomeInvulnerable();

            DisableAttackLogic();

            isInWoundedAnimation = true;

            GetComponent <Collider2D>().enabled = false;

            _woundedCollider.SetActive(true);

            _bossAnimator.SetInteger("AnimState", 4);
        }
    }