public static void Repeat(this int value, Action callback) { for (int i = 0; i < value; i++) { callback(); } } ... 10.Repeat(DoStuff); ... Random.Range(10, 20).Repeat(CreateDoodad); |
Not magic, just a different kind of science.
Not magic, just a different kind of science.
public static void Repeat(this int value, Action callback) { for (int i = 0; i < value; i++) { callback(); } } ... 10.Repeat(DoStuff); ... Random.Range(10, 20).Repeat(CreateDoodad); |