mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
41 lines
No EOL
905 B
C#
41 lines
No EOL
905 B
C#
using System.Linq;
|
|
using Cirno.Scripts.Resources;
|
|
using Cirno.Scripts.UI;
|
|
using Cirno.Scripts.Utils;
|
|
using Godot;
|
|
using Godot.Collections;
|
|
|
|
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)
|
|
{
|
|
GameStateManager.SetState(GameState.Shop);
|
|
|
|
var ui = UiScene.Instantiate<VendingMachineUi>();
|
|
|
|
ui.Machine = this;
|
|
|
|
ui.Items = new LootItem[3];
|
|
int i = 0;
|
|
foreach (var item in Items)
|
|
{
|
|
ui.Items[i] = item;
|
|
i++;
|
|
}
|
|
|
|
|
|
this.AddChild(ui);
|
|
|
|
return true;
|
|
}
|
|
} |