Example #1
0
    public void ApplyDamage(float damage)
    {
        if (_is_Dead || _isBlocking)
        {
            return;
        }

        health -= damage;


        if (healthUI != null)
        {
            healthUI.fillAmount = health / 100f;
        }


        if (health <= 0)
        {
            _is_Dead = true;
            CharacterDied();
        }
        else
        {
            if (isPlayer)
            {
                ShakeCameraAfterHit.enableShakeFX.TurnOnShakeScript();
                _animations.RegularHit();
                StartCoroutine(PlayerHit());
            }
            else
            {
                _animations.RegularHit();
                _isHit       = true;
                isKnockedOut = true;
            }
        }
    } // apply damage