Situation - there is an indefinite set of methods, and they have a boolean showing activity, for example bool Active, after a while (different for different methods), this boolean should be changed.
At the moment I solve this problem with a patch of the form
private IEnumerator SwitchFlipper ( float duration ) { var durationTimerS = Stopwatch.StartNew(); while (durationTimerS.Elapsed.TotalSeconds <= duration) { yield return null; } Active = !Active; durationTimerS.Stop(); durationTimerS.Reset(); } But I would like to have some one method that will receive from outside (from other methods) the duration and which variable to change to it through this time.
Is the question at all possible? (it seems to me yes, I'm just not strong in C #) If so how can this be implemented?