public void setDead() { if (this.isScriptValid() && !this.isDead()) { if (AgentScript) { setOnceDone(); AgentScript.die(); AgentScript.innerDie(); } else if (UnitScript) { UnitScript.die(); } else { Debug.LogError("Couldn't setDead() because the script was valid"); } } else { Debug.LogError("Couldn't setDead() because the script was valid"); } }