using System.Collections.Generic; using System.Linq; using Godot; namespace BITKit; /// /// 为Godot.Node提供数学工具 /// public static partial class MathNode { /// /// 获取Node下所有的子Node节点 /// /// Root Node /// public static IEnumerable GetAllNode(Node self) { List nodes = new() { self }; For(self); void For(Node node) { foreach (var x in node.GetChildren()) { For(x); nodes.Add(x); } } return nodes.Distinct(); } }