initial reload

This commit is contained in:
Rendo 2025-07-30 05:45:12 +05:00
commit fda3ca433b
5 changed files with 9 additions and 2 deletions

View file

@ -13,6 +13,6 @@ DescriptionKey = "garlic_desc"
Cost = 50.0
Scene = ExtResource("2_81n0p")
ReloadTime = 7.5
ReloadProgress = 0.67
ReloadProgress = 0.0
Preview = ExtResource("1_datic")
Order = 7

View file

@ -13,6 +13,6 @@ DescriptionKey = "potatomine_desc"
Cost = 25.0
Scene = ExtResource("2_ig2ti")
ReloadTime = 25.0
ReloadProgress = 0.9
ReloadProgress = 0.0
Preview = ExtResource("1_xk2pg")
Order = 3

View file

@ -25,6 +25,7 @@ public class HotbarPregameHandler : SeedpacketHandler, ISeedpacketPress
if (state == RuntimeLevelData.LevelStates.Game)
{
_owner.SetHandler(new HotbarHandler(_owner));
_owner.StartWithResourceOffset();
}
else if (state != RuntimeLevelData.LevelStates.ChooseYourSeeds)
{

View file

@ -14,6 +14,7 @@ public class PrepickedHandler : SeedpacketHandler
if (state == RuntimeLevelData.LevelStates.Game)
{
_owner.SetHandler(new HotbarHandler(_owner));
_owner.StartWithResourceOffset();
}
else if (state != RuntimeLevelData.LevelStates.ChooseYourSeeds)
{

View file

@ -81,6 +81,11 @@ public partial class Seedpacket : TextureButton
{
_timer.Start();
}
public void StartWithResourceOffset()
{
_timer.Start(_resource.ReloadTime * (1.0 - _resource.ReloadProgress)+0.05);
Callable.From(()=>{ _timer.WaitTime = _resource.ReloadTime; }).CallDeferred();
}
public void OnUnfocused()
{