You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-4Lines changed: 16 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -162,7 +162,7 @@ The core of this library consists of two components:
162
162
163
163
However, most features that you'll be interacting with directly are implemented in other classes:
164
164
165
-
- There are many **built-in coroutine types** (subclasses of the `CoroutineBase` class) that implement various different features, such as delays, running coroutines in parallel, awaiting an async task, ...
165
+
- There are many **built-in coroutine types** (subclasses of the `CoroutineBase` class) that implement various different features, such as delays, running coroutines in parallel, awaiting async tasks, ...
166
166
167
167
- The **most important coroutine** type is the `Coroutine` class. It allows you to define a coroutine in the intuitive / standard way with `IEnumerator`s (like in Unity).
168
168
@@ -233,6 +233,12 @@ or:
233
233
Co.Run(MyCoroutine());
234
234
```
235
235
236
+
Both are equivalent to writing:
237
+
238
+
```csharp
239
+
Co.Run(newCoroutine(MyCoroutine()));
240
+
```
241
+
236
242
### Process Mode
237
243
238
244
When interacting with Godot's physics system, it's often necessary to run code in `_PhysicsProcess()` instead of the regular `_Process()` method.
@@ -249,7 +255,7 @@ new Coroutine(MyCoroutine(), processMode: CoProcessMode.Inherit);
249
255
-`CoProcessMode.Physics` = run in physics frames.
250
256
-`CoProcessMode.Inherit` = inherit the process mode from the parent coroutine.
251
257
252
-
This option is also available for other coroutine types, e.g. `ParallelCoroutine`. By default, coroutines **inherit** the process mode from their parents. If a coroutine has no parent, it defaults to `CoProcessMode.Normal`. This means that if you have a `ParallelCoroutine` that sets its process mode to `Physics`, all its child coroutines that are run in parallel will also run in physics frames (provided that they have their mode set to `Inherit`).
258
+
This option is also available for other coroutine types, e.g. `ParallelCoroutine`. By default, coroutines **inherit** the process mode from their parents. If a coroutine has no parent, it defaults to `CoProcessMode.Normal`. This means that if you have a `ParallelCoroutine` that sets its process mode to `Physics`, all its child coroutines will also run in physics frames (provided that they have their mode set to `Inherit`).
253
259
254
260
The useful `Co` class also exposes the `processMode` parameter when creating coroutines:
@@ -384,7 +390,7 @@ In order to set up a scene-local coroutine manager, simply add the `CoroutineMan
384
390
385
391
## Creating Custom Coroutines
386
392
387
-
You can easily create a custom coroutine type by creating a new class that inherits from `CoroutineBase`. For concrete examples, it's best to see how the built-in coroutines types are implemented by looking at the source code.
393
+
You can easily create a custom coroutine type by creating a new class that inherits from `CoroutineBase`. For concrete examples, it's best to see how the built-in coroutines types are implemented by looking at the [source code](https://github.com/Inspiaaa/HCoroutines/tree/master/addons/HCoroutines/src/Coroutines).
388
394
389
395
#### Update Method
390
396
@@ -466,6 +472,12 @@ public class AwaitFirstCoroutine : CoroutineBase
466
472
foreach (varcoroutineincoroutines)
467
473
{
468
474
StartCoroutine(coroutine);
475
+
476
+
// Check that the coroutine that was just started
477
+
// has not finished already, causing this coroutine
0 commit comments