public static void OnZombieHurt(Controller controller, ZombieController zombieController, DamageEvent damage) { if (!zombieController.HasTarget()) { Character newTarg = damage.attacker.character; if (newTarg != null) { if (newTarg != zombieController.attackTarget) { zombieController.SetTarget(newTarg); zombieController.lastAttackedMePosition = newTarg.origin; } zombieController.targetAttackedMe = true; if (zombieController.wasRoaming) { zombieController.RoamFrameEnd(); NavMeshAgent agent = controller.agent; if (agent != null) { if (!beingDestroyed.Contains(damage.victim.idMain.gameObject)) agent.ResetPath(); else beingDestroyed.Remove(damage.victim.idMain.gameObject); } zombieController.wasRoaming = false; zombieController.currentlyRoaming = false; } } } }