From ccd374cbedd87528c85d497fa7bef9b0c90815e9 Mon Sep 17 00:00:00 2001 From: Sophia Pearson Date: Wed, 7 Sep 2022 11:22:35 +0200 Subject: menus: implement main menu and building blocks --- Scripts/GodotExtensions/ArrayExtensions.cs | 13 +++++++++++++ Scripts/GodotExtensions/NodeExtensions.cs | 14 ++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 Scripts/GodotExtensions/ArrayExtensions.cs create mode 100644 Scripts/GodotExtensions/NodeExtensions.cs (limited to 'Scripts/GodotExtensions') 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(this Array array, Action 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 GetChildren(this Node node) + { + return new Array(node.GetChildren().OfType()); + } + } +} \ No newline at end of file -- cgit v1.2.3