mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-04 01:35:54 +00:00
Prisms and hit buttons
This commit is contained in:
parent
1a898cb7b8
commit
dbca78c0b7
8 changed files with 141 additions and 6 deletions
21
Scripts/Interactables/HitButton.cs
Normal file
21
Scripts/Interactables/HitButton.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
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;
|
||||
|
||||
this.Activate(this.ActivationType);
|
||||
|
||||
bullet.RequestCollisionDestruction();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue