rj-action-library/Runtime/Selectors/Selectors.cs

37 lines
589 B
C#
Raw Normal View History

2025-01-03 12:09:23 +00:00
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System;
using Godot;
namespace Rokojori
{
public class Selectors
{
public static T GetFromDirectChildren<T>( Node parent, RJSelector s ) where T:Node
{
T selected = null;
Nodes.ForEachDirectChild<T>( parent,
( T t )=>
{
if ( selected != null )
{
return;
}
if ( s != null && s.Selects( t ) )
{
selected = t;
}
}
);
return selected;
}
}
}