void OnTriggerEnter2D(Collider2D trigger) { //Debug.Log ("Enemy Hit"); ProjectileScript missile = trigger.gameObject.GetComponent <ProjectileScript>(); if (missile) { health -= missile.GetDamage(); missile.Hit(); if (health <= 0) { AudioSource.PlayClipAtPoint(enemyDies, transform.position, 0.5f); Destroy(gameObject); scoreKeeper.Score(scoreValue); } } }
void Die() { AudioSource.PlayClipAtPoint(DeathSound, transform.position); _scoreKeeper.Score(ScoreValue); Destroy(gameObject); }