public void ReactToHit() { WanderingAI behavior = GetComponent <WanderingAI>(); if (behavior != null) { behavior.setDead(true); } if (!dead) { dead = true; StartCoroutine(Die()); } }