예제 #1
0
    public bool TakeDamage(int pAmount, bool pReact)
    {
        _health -= pAmount;

        if (healthSlider)
        {
            healthSlider.value = (float)_health / startHealth;
        }

        if (_health <= 0 && !isDead)
        {
            Death();
        }

        StopCoroutine("ShowHealthbar");
        StartCoroutine("ShowHealthbar");

        //Return If Dead or Not
        if (_health <= 0)
        {
            return(true);
        }

        if (pReact && _decision != null)
        {
            _decision.ForceStateSwitch(_stunnedState);
        }

        return(false);
    }