cirnogodot/Scripts/Interactables/Switch.cs

20 lines
473 B
C#
Raw Normal View History

using Godot;
namespace Cirno.Scripts.Interactables;
public partial class Switch : Interactable
{
2025-02-15 14:33:44 +01:00
[Export] public Node2D Target { get; set; }
[Export] public ActivationType ActivationType { get; set; } = ActivationType.Toggle;
2025-01-30 17:43:39 +01:00
public override bool Activate()
{
2025-02-15 14:33:44 +01:00
if (MeetsRequirements() && Target is IActivable activable)
{
2025-02-15 14:33:44 +01:00
activable?.Activate(ActivationType);
2025-01-30 17:43:39 +01:00
return true;
}
2025-01-30 17:43:39 +01:00
return false;
}
}