cirnogodot/Scripts/Utils/ActivationHelper.cs

25 lines
709 B
C#
Raw Normal View History

2025-06-30 10:02:37 +02:00
using Godot;
namespace Cirno.Scripts.Utils;
public static class ActivationHelper
{
2025-07-09 12:00:23 +02:00
public static bool UseTargets(Node activator, string target, ActivationType activationType = ActivationType.Toggle)
2025-06-30 10:02:37 +02:00
{
2025-07-09 12:00:23 +02:00
var res = false;
2025-06-30 10:02:37 +02:00
GD.Print($"Trying to use targets called: {target}");
var targetList = activator.GetTree().GetNodesInGroup(target);
foreach (var t in targetList)
{
//string f;
GD.Print($"Trying to use {t.Name}");
if (t is IActivable activable)
{
GD.Print($"Activating {t.Name}");
2025-07-09 12:00:23 +02:00
res |= activable.Activate(activationType);
2025-06-30 10:02:37 +02:00
}
}
2025-07-09 12:00:23 +02:00
return res;
2025-06-30 10:02:37 +02:00
}
}