cirnogodot/Scripts/Pickupper.cs

32 lines
784 B
C#
Raw Permalink Normal View History

2025-01-20 16:47:15 +01:00
using Godot;
using System;
2025-01-28 14:05:38 +01:00
using System.Collections.Generic;
using Cirno.Scripts;
using Cirno.Scripts.Resources;
using Godot.Collections;
2025-01-20 16:47:15 +01:00
public partial class Pickupper : Activable
{
2025-01-28 14:05:38 +01:00
private InventoryManager _inventoryManager;
2025-01-20 21:58:59 +01:00
2025-01-28 14:05:38 +01:00
[Export] public Array<LootItem> LootTable = new Array<LootItem>();
2025-01-20 21:58:59 +01:00
2025-01-28 14:05:38 +01:00
public override void _Ready()
{
_inventoryManager = GetNode<InventoryManager>("/root/GameScene/InventoryManager");
}
2025-03-09 21:58:25 +01:00
public override bool Activate(ActivationType activationType = ActivationType.Toggle)
2025-01-28 14:05:38 +01:00
{
foreach (var item in LootTable)
{
2025-02-10 17:29:14 +01:00
_inventoryManager.AddItem(item);
2025-01-28 14:05:38 +01:00
}
//inventoryManager.AddRedKeycard();
//GetParent().QueueFree(); // TODO: send a signal instead
2025-03-09 21:58:25 +01:00
return true;
2025-01-28 14:05:38 +01:00
}
}