1bit-game-jam/scripts/entities/And.cs
2023-08-19 15:53:31 +03:00

28 lines
503 B
C#

using Godot;
using System;
public partial class And : Node
{
[Export] public int CountOfButtons = 2;
[Signal]
public delegate void ConditionMetEventHandler();
[Signal]
public delegate void ConditionNotMetEventHandler();
private int _buttons = 0;
public void Increment()
{
_buttons++;
if (_buttons == CountOfButtons)
EmitSignal(SignalName.ConditionNotMet);
}
public void Decrement()
{
_buttons--;
if (_buttons != CountOfButtons)
EmitSignal(SignalName.ConditionNotMet);
}
}