SupaLidlGame/BoundingBoxes/InteractionTrigger.cs

45 lines
824 B
C#
Raw Normal View History

2023-06-06 18:39:23 -07:00
using Godot;
2023-06-10 22:15:28 -07:00
using SupaLidlGame.Characters;
2023-06-06 18:39:23 -07:00
namespace SupaLidlGame.BoundingBoxes;
public partial class InteractionTrigger : Area2D
{
2023-06-10 22:15:28 -07:00
[Signal]
public delegate void InteractionEventHandler();
[Signal]
public delegate void TargetEventHandler();
[Signal]
public delegate void UntargetEventHandler();
2023-08-05 23:50:08 -07:00
private Control _popup;
public override void _Ready()
{
base._Ready();
_popup = GetNode<Control>("Popup");
_popup.Visible = false;
}
2023-06-10 22:15:28 -07:00
/// <summary>
/// Invokes or triggers an interaction to occur.
/// </summary>
public void InvokeInteraction()
{
EmitSignal(SignalName.Interaction);
}
2023-08-05 23:50:08 -07:00
public void Focus()
{
_popup.Visible = true;
}
public void Unfocus()
{
_popup.Visible = false;
}
2023-06-06 18:39:23 -07:00
}