Pickups + Save-diff
This commit is contained in:
parent
b49c0ee55f
commit
bf874ba633
11 changed files with 133 additions and 16 deletions
23
scripts/world/PickupMarker.cs
Normal file
23
scripts/world/PickupMarker.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using Godot;
|
||||
|
||||
public partial class PickupMarker : Area2D
|
||||
{
|
||||
public string PickupId { get; set; } = "";
|
||||
public string ItemId { get; set; } = "";
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
BodyEntered += OnBodyEntered;
|
||||
}
|
||||
|
||||
private void OnBodyEntered(Node2D body)
|
||||
{
|
||||
if (body is not CharacterBody2D) return;
|
||||
|
||||
// Defer to avoid freeing during signal processing edge cases
|
||||
EmitSignal(SignalName.PickedUp, PickupId, ItemId);
|
||||
}
|
||||
|
||||
[Signal]
|
||||
public delegate void PickedUpEventHandler(string pickupId, string itemId);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue