cirnogodot/Scripts/Interactables/HitButton.cs

22 lines
461 B
C#
Raw Permalink Normal View History

2025-05-27 15:11:02 +02:00
using Godot;
namespace Cirno.Scripts.Interactables;
public partial class HitButton : Switch
{
public override void _Ready()
{
base._Ready();
this.AreaEntered += OnAreaEntered;
}
private void OnAreaEntered(Area2D area)
{
if (area is not Bullet bullet) return;
2025-06-08 16:33:38 +02:00
if (!bullet.Enabled) return;
2025-05-27 15:11:02 +02:00
this.Activate(this.ActivationType);
bullet.RequestCollisionDestruction();
}
}