WIP 2D rework
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using Godot;
|
||||
|
||||
namespace Babushka.scripts.CSharp.Common.CharacterControls;
|
||||
|
||||
public partial class InteractionArea2D : Node2D
|
||||
{
|
||||
[Export] private Area2D _area;
|
||||
[Export] private Label _label;
|
||||
[Export] private bool _showLabel = true;
|
||||
|
||||
[Signal]
|
||||
public delegate void InteractedEventHandler();
|
||||
|
||||
public void OnPlayerEntered(Node2D player)
|
||||
{
|
||||
if(_showLabel)
|
||||
_label.Show();
|
||||
}
|
||||
|
||||
public void OnPlayerExited(Node2D player)
|
||||
{
|
||||
_label.Hide();
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if (@event.IsAction("interact") && @event.IsPressed() && _area.HasOverlappingBodies())
|
||||
{
|
||||
_label.Hide();
|
||||
EmitSignal(SignalName.Interacted);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://ckp413wrub5fm
|
||||
@@ -6,8 +6,8 @@ namespace Babushka.scripts.CSharp.Common.CharacterControls;
|
||||
public partial class VesnaBehaviour : Node
|
||||
{
|
||||
[ExportGroup("Farming")]
|
||||
[Export] private FieldService _fieldParent;
|
||||
[Export] private FarmingControls _farmingControls;
|
||||
[Export] private FieldService2D _fieldParent;
|
||||
[Export] private FarmingControls2D _farmingControls;
|
||||
|
||||
[Signal] public delegate void ToolPickupEventHandler(bool success);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user