Keycards fix

This commit is contained in:
Marco 2025-03-02 16:48:18 +01:00
commit 91fcd73688
7 changed files with 46 additions and 16 deletions

View file

@ -20,7 +20,7 @@ public partial class Chest : Interactable
if (!MeetsRequirements()) return false;
foreach (var item in LootTable)
{
_inventoryManager.AddItem(item);
InventoryManager.Instance.AddItem(item);
}
_sprite.Play("Opening");

View file

@ -16,7 +16,7 @@ public partial class AreaTrigger : Area2D
[Signal]
public delegate void ActivatedEventHandler();
public bool Activate(InteractionController player)
private bool Activate()
{
if (_activations == 0 && DoNotActivateOnFirst)
{
@ -47,6 +47,6 @@ public partial class AreaTrigger : Area2D
private void _on_area_entered(Area2D area)
{
if (area is not InteractionController player) return;
Activate(player);
Activate();
}
}

View file

@ -15,7 +15,7 @@ public partial class ItemPickup : Interactable
if (!MeetsRequirements()) return false;
foreach (var item in LootTable)
{
_inventoryManager.AddItem(item);
InventoryManager.Instance.AddItem(item);
}
// Delet This

View file

@ -7,6 +7,7 @@ using Cirno.Scripts.Resources;
public partial class InventoryManager : Node2D
{
public static InventoryManager Instance { get; private set; }
public bool RedKeycard { get; set; }
private Dictionary<string, ItemContainer> _itemsDict = new Dictionary<string, ItemContainer>();
@ -24,10 +25,10 @@ public partial class InventoryManager : Node2D
[Signal]
public delegate void ItemUsedEventHandler(LootItem itemKey, int totalCount);
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
Instance = this;
}
// Called every frame. 'delta' is the elapsed time since the previous frame.