mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Remove items from vending machine once bought
This commit is contained in:
parent
d020b067af
commit
674f79f079
5 changed files with 58 additions and 17 deletions
|
|
@ -8,18 +8,30 @@ namespace Cirno.Scripts.Actors;
|
|||
|
||||
public partial class VendingMachine : Interactable
|
||||
{
|
||||
|
||||
[Export] public bool Infinite { get; private set; } = false;
|
||||
|
||||
[Export] public PackedScene UiScene { get; private set; }
|
||||
|
||||
[Export] public Array<LootItem> Items { get; set; }
|
||||
|
||||
|
||||
|
||||
public override bool Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
{
|
||||
GameManager.Instance.ChangeState(GameState.Shop);
|
||||
|
||||
var ui = UiScene.Instantiate<VendingMachineUi>();
|
||||
|
||||
ui.Items = Items.ToArray();
|
||||
ui.Machine = this;
|
||||
|
||||
ui.Items = new LootItem[3];
|
||||
int i = 0;
|
||||
foreach (var item in Items)
|
||||
{
|
||||
ui.Items[i] = item;
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
this.AddChild(ui);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue