diff options
| author | Sophia Pearson <codergal89@gmail.com> | 2022-09-07 11:22:35 +0200 |
|---|---|---|
| committer | Sophia Pearson <codergal89@gmail.com> | 2022-09-07 11:22:35 +0200 |
| commit | ccd374cbedd87528c85d497fa7bef9b0c90815e9 (patch) | |
| tree | d146de06e0d91a30d37b6d8ccb4d6e5b7dceda03 /Scripts/GodotExtensions | |
| parent | 23a3b14f4d3662f20d7202aeb569b789b520ba57 (diff) | |
| download | texty-ccd374cbedd87528c85d497fa7bef9b0c90815e9.tar.xz texty-ccd374cbedd87528c85d497fa7bef9b0c90815e9.zip | |
menus: implement main menu and building blocks
Diffstat (limited to 'Scripts/GodotExtensions')
| -rw-r--r-- | Scripts/GodotExtensions/ArrayExtensions.cs | 13 | ||||
| -rw-r--r-- | Scripts/GodotExtensions/NodeExtensions.cs | 14 |
2 files changed, 27 insertions, 0 deletions
diff --git a/Scripts/GodotExtensions/ArrayExtensions.cs b/Scripts/GodotExtensions/ArrayExtensions.cs new file mode 100644 index 0000000..aa3a9c4 --- /dev/null +++ b/Scripts/GodotExtensions/ArrayExtensions.cs @@ -0,0 +1,13 @@ +using System; +using Godot.Collections; + +namespace Texty.Scripts.GodotExtensions +{ + public static class ArrayExtensions + { + public static void ForEach<T>(this Array<T> array, Action<T> action) + { + foreach (var element in array) action.Invoke(element); + } + } +}
\ No newline at end of file diff --git a/Scripts/GodotExtensions/NodeExtensions.cs b/Scripts/GodotExtensions/NodeExtensions.cs new file mode 100644 index 0000000..b398985 --- /dev/null +++ b/Scripts/GodotExtensions/NodeExtensions.cs @@ -0,0 +1,14 @@ +using System.Linq; +using Godot; +using Godot.Collections; + +namespace Texty.Scripts.GodotExtensions +{ + public static class NodeExtensions + { + public static Array<T> GetChildren<T>(this Node node) + { + return new Array<T>(node.GetChildren().OfType<T>()); + } + } +}
\ No newline at end of file |
