mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 09:25:35 +00:00
32 lines
No EOL
718 B
C#
32 lines
No EOL
718 B
C#
using Godot;
|
|
using Godot.Collections;
|
|
|
|
namespace Cirno.Scripts.Activables;
|
|
|
|
public partial class ChainActivable : Activable
|
|
{
|
|
[Export] private Array<Node2D> _targets;
|
|
|
|
protected void ActivateTargets()
|
|
{
|
|
foreach (var activationTarget in _targets)
|
|
{
|
|
ActivateTarget(activationTarget);
|
|
}
|
|
}
|
|
|
|
private bool ActivateTarget(Node2D activationTarget)
|
|
{
|
|
if (activationTarget is not IActivable target)
|
|
{
|
|
GD.PrintErr($"Target {activationTarget.Name} is not activable");
|
|
return false;
|
|
}
|
|
|
|
target?.Activate();
|
|
|
|
GD.Print($"{activationTarget.Name} activated");
|
|
|
|
return true;
|
|
}
|
|
} |