mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Vending Machines
This commit is contained in:
parent
e25da0fe16
commit
d020b067af
16 changed files with 249 additions and 34 deletions
28
Scripts/Actors/VendingMachine.cs
Normal file
28
Scripts/Actors/VendingMachine.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using System.Linq;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Cirno.Scripts.UI;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace Cirno.Scripts.Actors;
|
||||
|
||||
public partial class VendingMachine : Interactable
|
||||
{
|
||||
[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();
|
||||
|
||||
this.AddChild(ui);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue