Exemple #1
0
    public void InflictDamage(GameObject source, float amount)
    {
        if (_invincible)
        {
            return;
        }

        currentHealth -= amount;

        for (int i = 0; i < amount; i++)
        {
            heartMeter.RemoveHalfHeart();
        }

        Vector3 bloodPos = transform.position;

        TheBloodenerScript.MakeBlood(bloodPos);

        if (currentHealth <= 0)
        {
            Kill();
        }
        else
        {
            _playerMover.DamageKnockBack(source);
            Invincible(invincibleTime);
        }
    }