Пример #1
0
    public void Damage(float value, bool ambient = false)
    {
        if (!gameObject.activeSelf)
        {
            return;
        }

        Health = Math.maxf(Health - value, 0);

        if (gameObject.CompareTag("Player") && !ambient)
        {
            _randomSound.play();
        }

        if (Health <= 0.0f)
        {
            Kill();
        }
    }