sound is buzzing when enemy dies but when pause is shortened sound is played too quick
var EnemyHealth : int = 10;
var soundFile : AudioClip;
function DeductPoints (DamageAmount : int) {
EnemyHealth -= DamageAmount;
}
function Update () {
if (EnemyHealth <= 0) {
GetComponent.().clip = soundFile;
GetComponent.().Play();
Destroy(gameObject, 1);
}
}
↧