altering enemies into peg to open up for the future with hostile and friendly pegs. made some changes to the pathfinding. starting to add a mouse handler that will more easily handle single and double clicks, and holds. Enemy controller becomes peg controller and will handle all peg interactions

This commit is contained in:
2026-06-25 16:31:13 -04:00
parent e3cb4ef7ac
commit 37da9a4e84
23 changed files with 428 additions and 284 deletions
+48
View File
@@ -0,0 +1,48 @@
using Godot;
using System;
public partial class HoverableNode : Node2D
{
[Signal]
public delegate void HoverEventHandler(HoverableNode THIS, bool IS_HOVERED);
[Signal]
public delegate void ClickEventHandler(HoverableNode THIS, int CLICK_TYPE);
public bool _hovered;
public Area2D _bounds;
public override void _Ready()
{
base._Ready();
_bounds = GetNode<Area2D>("HoverBounds");
_bounds.MouseEntered += OnMouseEntered;
_bounds.MouseExited += OnMouseExited;
}
public override void _Input(InputEvent @event)
{
if (_hovered)
{
if (Input.IsActionJustReleased("lmb"))
{
EmitSignal(SignalName.Click, this, 0);
}
if (Input.IsActionJustReleased("rmb"))
{
EmitSignal(SignalName.Click, this, 1);
}
}
}
public virtual void OnMouseEntered()
{
_hovered = true;
EmitSignal(SignalName.Hover, this,_hovered);
}
public virtual void OnMouseExited()
{
_hovered = false;
EmitSignal(SignalName.Hover, this, _hovered);
}
}