playDeathSound() public static method

public static playDeathSound ( ) : void
return void
示例#1
0
    public void TakeDamage(int amount)
    {
        // Reduce the current health by the amount of damage sustained.
        currentHealth -= amount;

        if (amount != 0)
        {
            hasTakenDamage = true;
            dmgTimer       = secDamage;
        }

        // Update health on slider to new value.
        healthSlider.value = currentHealth;

        // It there is no health left.
        if (currentHealth <= 0)
        {
            // Play sound, animate and destroy object.
            PlayerSfxScript.playDeathSound();
            playerControlScript.InitiateAnimation("Die");
            Destroy(gameObject, 0.95f);
        }
        else
        {
            // Play sound and animate.
            PlayerSfxScript.playHitSound();
            playerControlScript.InitiateAnimation("Hit");
        }
    }