mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 02:55:54 +00:00
Refactored switches and chests and mapping
This commit is contained in:
parent
295d32e66d
commit
cc5376e94e
14 changed files with 158 additions and 91 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue