ChooseYourSeeds menu

This commit is contained in:
Фёдор Веселов 2024-09-22 20:37:00 +05:00
commit c9dd4cf175
23 changed files with 471 additions and 95 deletions

View file

@ -0,0 +1,29 @@
using System;
using Godot;
public class HotbarPregameHandler : SeedpacketHandler, ISeedpacketPress
{
public HotbarPregameHandler(Seedpacket owner) : base(owner)
{
RuntimeLevelData.Instance.OnLevelStateChanged += OnLevelStateChanged;
}
public event Action Clicked;
public void Pressed()
{
if (Clicked != null) Clicked();
_owner.QueueFree();
}
public void OnLevelStateChanged(RuntimeLevelData.LevelStates state)
{
if (state == RuntimeLevelData.LevelStates.Game)
{
_owner.SetHandler(new HotbarHandler(_owner));
}
else if (state != RuntimeLevelData.LevelStates.ChooseYourSeeds)
{
_owner.disablePacket = true;
}
}
}