newlon/scripts/components/gui/seedpackets/HotbarHandler.cs

24 lines
No EOL
589 B
C#

using Newlon.Components.Level;
namespace Newlon.Components.GUI.Seedpackets;
public class HotbarHandler : SeedpacketHandler, ISeedpacketPress, ISeedpacketProcess, ISeedpacketUnfocus
{
public HotbarHandler(Seedpacket owner) : base(owner)
{
}
public void Pressed()
{
PlantField.Instance.SetPlant(_owner,_owner.GetPlantResource());
}
public void Process()
{
_owner.disablePacket = RuntimeLevelData.Instance.SunCount < _owner.GetPlantResource().Cost;
}
public void OnUnfocused()
{
PlantField.Instance.ResetPlant();
}
}