Пример #1
0
    public void LoseHealth(float amount)
    {
        // Show damage overlay for 1 second
        StartCoroutine(overlay.ShowOverlay());

        //playerAudio.PlayOneShot(playerHurt);
        playerAudio.volume = 0.0f;
        playerAudio.clip   = playerHurt;
        playerAudio.Play();
        StartCoroutine(SoundManager.Fade(playerAudio, 0.75f, 0.8f));

        print(amount);
        print(defense);
        currentValue -= amount - defense;
        print(currentValue);
        if (currentValue < 0)
        {
            currentValue = 0;
        }
        if (currentValue == 0)
        {
            //This line prevents the Death Screen from loading for some reason
            //anim.Play("Death");
            SceneManager.LoadScene("Death Screen");
        }
        currentFill = currentValue / maximumHealth;
    }