public static IEnumerator PatrolUntilSight(DefaultMovement movement, PatrolParameters parameters, Sight sight) { return(AsyncUtil.Race(new IEnumerator[] { PatrolForever(movement, parameters), AsyncUtil.WaitUntil(() => sight.GetVisibleObject() != null), })); }