private void killMissile() { // The missile was already "killed" either by way of despawning or by Destroy -- don't kill it again if (!gameObject.activeInHierarchy) { return; } bool dodestroy = true; if (firedBy != null) { // If the firedBy game object is not an enemy (it is a player), then notify // the gameobject that this particular missile is no loner "alive". Basically, allowing a // "reset" for the player missile, as only 1 player missile can exist at a time. if (firedBy.tag != "Enemy") { firedBy.SendMessage("firedMissileDead", SendMessageOptions.DontRequireReceiver); } // Missile was fired by an "enemy" --- so, instead of destroying the missile, despawn it else { RFObjectPool.Despawn(this.gameObject); dodestroy = false; } firedBy = null; } if (dodestroy) { gameObject.SetActive(false); Destroy(this.gameObject); } }