/// <summary> /// When an entity is destroyed because it's health is zero, execute relevant commands /// </summary> private void DestroyEntity() { //Create death clip object if (DeathClip) { GameObject clip = Instantiate(DeathClip, this.transform.position, Quaternion.identity) as GameObject; //Show points if available if (Points != 0) { clip.GetComponentInChildren <TextMesh> ().text = Points.ToString(); } } //Remove Game Object Destroy(this.gameObject); //Add Points for destroying it ScoreTracker.GetInstance().ScorePoints(Points); }