From 5260f9136b307463b85a967deca3bf6460725f61 Mon Sep 17 00:00:00 2001 From: fu-majime Date: Wed, 3 Apr 2024 19:12:55 +0900 Subject: [PATCH] Restart the stopped conveyor --- Assets/Scripts/Games/Fillbots/Fillbots.cs | 14 +++++++++++++- Assets/Scripts/Games/Fillbots/NtrFillbot.cs | 6 +++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Games/Fillbots/Fillbots.cs b/Assets/Scripts/Games/Fillbots/Fillbots.cs index 3139c51ea..b84575fa6 100644 --- a/Assets/Scripts/Games/Fillbots/Fillbots.cs +++ b/Assets/Scripts/Games/Fillbots/Fillbots.cs @@ -362,7 +362,6 @@ namespace HeavenStudio.Games NtrFillbot spawnedBot = Instantiate(Bot, transform); if (holdLength > 0) spawnedBot.holdLength = holdLength; - if (stop) spawnedBot.conveyerRestartLength = -1; spawnedBot.startBeat = beat; spawnedBot.endAnim = endAnim; @@ -404,12 +403,25 @@ namespace HeavenStudio.Games } spawnedBot.InitColor(fuelColor, lampColorOff, lampColorOn); })); + actions.Add(new BeatAction.Action(beat + 3, delegate { if (!PlayerInput.GetIsAction(InputAction_BasicPressing) && !fillerHolding) filler.DoScaledAnimationAsync("FillerPrepare", 0.5f); conveyerStartBeat = beat + 3; fillerPosition = size; })); + + var remainingBots = currentBots.FindAll(x => x.conveyerRestartLength < 0); + if (stop) spawnedBot.conveyerRestartLength = -1; + actions.Add(new BeatAction.Action(beat + 3, delegate + { + foreach (var bot in remainingBots) + { + if (bot.botState is BotState.Idle) bot.conveyerRestartLength = 0.5; + if (bot.conveyerStartBeat is -2) bot.conveyerStartBeat = beat + 3; + } + })); + BeatAction.New(instance, actions); } public static void FillErUp(double beat) diff --git a/Assets/Scripts/Games/Fillbots/NtrFillbot.cs b/Assets/Scripts/Games/Fillbots/NtrFillbot.cs index 883362b96..565942f2d 100644 --- a/Assets/Scripts/Games/Fillbots/NtrFillbot.cs +++ b/Assets/Scripts/Games/Fillbots/NtrFillbot.cs @@ -38,7 +38,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots [System.NonSerialized] public double conveyerRestartLength = 0.5; [System.NonSerialized] public double startBeat = -1; - private double conveyerStartBeat = -1; + [System.NonSerialized] public double conveyerStartBeat = -1; private double conveyerLength = 1; private Vector2 startPos; @@ -344,7 +344,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots } else { - this.conveyerStartBeat = -1; + this.conveyerStartBeat = -2; game.conveyerStartBeat = -1; } releaseEvent.Disable(); @@ -403,7 +403,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots } else { - this.conveyerStartBeat = -1; + this.conveyerStartBeat = -2; game.conveyerStartBeat = -1; }