Улучшение логики живого доспеха и нажимной плиты. Реализация шипов.
This commit is contained in:
parent
2e5d268f35
commit
602df1ed1d
6 changed files with 201 additions and 4 deletions
|
@ -3,6 +3,12 @@ using System;
|
|||
|
||||
public partial class PressurePlate : Area2D
|
||||
{
|
||||
[Signal]
|
||||
public delegate void ButtonPressedEventHandler();
|
||||
|
||||
[Signal]
|
||||
public delegate void ButtonUnpressedEventHandler();
|
||||
|
||||
private bool _pressed = false;
|
||||
private int _onButton = 0;
|
||||
|
||||
|
@ -33,6 +39,10 @@ public partial class PressurePlate : Area2D
|
|||
|
||||
private void _onPressed(Node2D body)
|
||||
{
|
||||
if (_onButton <= 0)
|
||||
{
|
||||
EmitSignal(SignalName.ButtonPressed);
|
||||
}
|
||||
_onButton += 1;
|
||||
_pressed = true;
|
||||
}
|
||||
|
@ -44,6 +54,7 @@ public partial class PressurePlate : Area2D
|
|||
if (_onButton > 0)
|
||||
return;
|
||||
_pressed = false;
|
||||
EmitSignal(SignalName.ButtonUnpressed);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue