Working on item rescue

This commit is contained in:
2024-12-19 15:42:40 -08:00
parent d135be4318
commit e525ede13d
43 changed files with 794 additions and 25 deletions

View File

@@ -0,0 +1,32 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using GameJamDungeon;
using Godot;
[Meta(typeof(IAutoNode))]
public partial class RescuedItems : Marker3D
{
public override void _Notification(int what) => this.Notify(what);
[Dependency] public IGame Game => this.DependOn<IGame>();
public void SpawnRescuedItems()
{
foreach (var item in Game.RescuedItems.Items)
{
var droppedScene = GD.Load<PackedScene>("res://src/items/dropped/DroppedItem.tscn");
var dropped = droppedScene.Instantiate<DroppedItem>();
dropped.Item = item;
dropped.GlobalPosition = GlobalPosition;
AddChild(dropped);
}
Game.RescuedItems.Items.Clear();
}
public void OnSpawnItemsEntered(Node3D body)
{
GD.Print("Spawn items");
SpawnRescuedItems();
}
}