void Death() { isDead = true; capsuleCollider.isTrigger = true; anim.SetTrigger("Dead"); enemyAudio.clip = deathClip; enemyAudio.Play(); Debug.Log("Hello"); if (Random.Range(0, 4) < 2) { playerHealth.RegenHealth(5); } }
void Death() { // The enemy is dead. isDead = true; // Turn the collider into a trigger so shots can pass through it. capsuleCollider.isTrigger = true; // Tell the animator that the enemy is dead. anim.SetTrigger("Dead"); // Change the audio clip of the audio source to the death clip and play it (this will stop the hurt clip playing). enemyAudio.clip = deathClip; enemyAudio.Play(); if (Random.Range(0, 2) == 1) { playerHealth.RegenHealth(10); } else if (Random.Range(0, 10) == 1) { playerShooting.IncreaseDamage(10); } }