public void Damage(int damageValue) { _currentHealth -= damageValue; if (_currentHealth < 0) { _currentHealth = 0; } else { if (_hitSound != null && _hitSound.Length > 0) { AudioSource audio = GetComponent <AudioSource>(); AudioClip soundToUse = _hitSound [Random.Range(0, _hitSound.Length)]; audio.clip = soundToUse; audio.Play(); } } if (_currentHealth == 0) { if (_hitSound != null) { AudioSource audio = GetComponent <AudioSource>(); audio.clip = _deathSound; audio.Play(); } // musuhAudio.Play(); // Destroy (gameObject); Animation anim = GetComponentInChildren <Animation> (); anim.Stop(); _playerStats.ZombieKilled++; EnemyDrops ed = GetComponent <EnemyDrops>(); ed.onDeath(); EnemySpawnManager.onEnemyDeath(); Destroy(GetComponent <EnemyMovement>()); Destroy(GetComponent <EnemyAttack>()); Destroy(GetComponent <CharacterController> ()); Destroy(gameObject, 8.0f); // Destroy (GetComponent<PlayerMovement> ()); // Destroy (GetComponent<PlayerAnimation> ()); Ragdoll r = GetComponent <Ragdoll> (); if (r != null) { r.onDeath(); } } }