Refactored switches and chests and mapping

This commit is contained in:
Marco 2025-01-30 17:24:40 +01:00
commit cc5376e94e
14 changed files with 158 additions and 91 deletions

View file

@ -1,18 +1,26 @@
namespace Cirno.Scripts;
using Cirno.Scripts.Resources;
using Godot;
using Godot.Collections;
public partial class Chest : Activable
namespace Cirno.Scripts;
public partial class Chest : Interactable
{
private InventoryManager inventoryManager;
[Export] public Array<LootItem> LootTable = new Array<LootItem>();
public override void _Ready()
{
inventoryManager = GetNode<InventoryManager>("/root/GameScene/InventoryManager");
}
public override void Activate()
{
inventoryManager.AddRedKeycard();
GetParent().QueueFree();
if (!MeetsRequirements()) return;
foreach (var item in LootTable)
{
_inventoryManager.AddItem(item.Item, item.Amount);
}
}
public override void _Ready()
{
base._Ready();
}
}