Ive got a following coroutine in unity:
IEnumerator DoActionUponReachingRangeCoroutine(Range range, Delegate action, params object[] args)
{
yield return new WaitUntil(() => range.isPlayerInRange);
action.DynamicInvoke(args);
yield return null;
}
As you can see it can execute some action when range.IsPlayerInRange condition is met. I would like to do exatly the same thing but with providing my own condition every time I call this method, not with isPlayerInRange hard-coded.
Do I just provide a delegate instead of range?