25 lines
614 B
C#
25 lines
614 B
C#
using Godot;
|
|
using Godot.Collections;
|
|
using Newlon.Components.GUI.Seedpackets;
|
|
using Newlon.Components.Level;
|
|
|
|
public partial class HotbarShortcutSetter : Node
|
|
{
|
|
[Export] private Array<Shortcut> shortcuts;
|
|
[Export] private Control hotbar;
|
|
public override void _Ready()
|
|
{
|
|
RuntimeLevelData.Instance.OnLevelStateChanged += OnLevelStateChanged;
|
|
}
|
|
private void OnLevelStateChanged(RuntimeLevelData.LevelStates state)
|
|
{
|
|
if (state == RuntimeLevelData.LevelStates.Pregame)
|
|
{
|
|
for (int i = 0; i < hotbar.GetChildCount(); i++)
|
|
{
|
|
((Seedpacket)hotbar.GetChild(i)).Shortcut = shortcuts[i];
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|