A method to run any WFC operation within a Unity Coroutine with frame time budgeting. This method will process as many elements in the WFC operation as possible in on frame, then yield a render frame, and continue the operation on the next frame.
This is the recommended way to run WFC operations in a realtime game.
This returns a WFCProgressObserver object which you can attach progress callbacks and inspect the running state.
public static BrewedInk.WFC.WFCProgressObserver RunAsCoroutine(this System.Collections.Generic.IEnumerable<BrewedInk.WFC.WFCProgress> operation, UnityEngine.MonoBehaviour context, float timeBudgetPerFrame=0.1f);
operation
System.Collections.Generic.IEnumerable<WFCProgress>
Any WFC operation. This could be the return value from any Collapse related function in the GenerationSpace
context
UnityEngine.MonoBehaviour
Some Monobehaviour to run the Coroutine in.
timeBudgetPerFrame
System.Single
How much is available per frame to operate on the WFC sequence? This should be a low number, so that it doesn't cause hitches in your game.
WFCProgressObserver
a WFCProgressObserver