1bit-game-jam/scripts/entities/And.cs

30 lines
608 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++;
GD.Print($"Increment {_buttons}/{CountOfButtons}");
if (_buttons == CountOfButtons)
EmitSignal(SignalName.ConditionMet);
}
public void Decrement()
{
_buttons--;
GD.Print($"Decrement {_buttons}/{CountOfButtons}");
if (_buttons != CountOfButtons)
EmitSignal(SignalName.ConditionNotMet);
}
}