Skip to content

Latest commit

 

History

History
25 lines (22 loc) · 2.6 KB

WFCProgressExtensions_RunAsCoroutine(IEnumerable_WFCProgress__MonoBehaviour_float).md

File metadata and controls

25 lines (22 loc) · 2.6 KB

WFCProgressExtensions.RunAsCoroutine(IEnumerable<WFCProgress>, MonoBehaviour, float) Method

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);

Parameters

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.

Returns

WFCProgressObserver
a WFCProgressObserver