29 lines
No EOL
757 B
C#
29 lines
No EOL
757 B
C#
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;
|
|
}
|
|
}
|
|
} |