Restart the stopped conveyor

This commit is contained in:
fu-majime 2024-04-03 19:12:55 +09:00
parent 86b483d9bd
commit 5260f9136b
2 changed files with 16 additions and 4 deletions

View file

@ -362,7 +362,6 @@ namespace HeavenStudio.Games
NtrFillbot spawnedBot = Instantiate(Bot, transform); NtrFillbot spawnedBot = Instantiate(Bot, transform);
if (holdLength > 0) spawnedBot.holdLength = holdLength; if (holdLength > 0) spawnedBot.holdLength = holdLength;
if (stop) spawnedBot.conveyerRestartLength = -1;
spawnedBot.startBeat = beat; spawnedBot.startBeat = beat;
spawnedBot.endAnim = endAnim; spawnedBot.endAnim = endAnim;
@ -404,12 +403,25 @@ namespace HeavenStudio.Games
} }
spawnedBot.InitColor(fuelColor, lampColorOff, lampColorOn); spawnedBot.InitColor(fuelColor, lampColorOff, lampColorOn);
})); }));
actions.Add(new BeatAction.Action(beat + 3, delegate actions.Add(new BeatAction.Action(beat + 3, delegate
{ {
if (!PlayerInput.GetIsAction(InputAction_BasicPressing) && !fillerHolding) filler.DoScaledAnimationAsync("FillerPrepare", 0.5f); if (!PlayerInput.GetIsAction(InputAction_BasicPressing) && !fillerHolding) filler.DoScaledAnimationAsync("FillerPrepare", 0.5f);
conveyerStartBeat = beat + 3; conveyerStartBeat = beat + 3;
fillerPosition = size; 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); BeatAction.New(instance, actions);
} }
public static void FillErUp(double beat) public static void FillErUp(double beat)

View file

@ -38,7 +38,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots
[System.NonSerialized] public double conveyerRestartLength = 0.5; [System.NonSerialized] public double conveyerRestartLength = 0.5;
[System.NonSerialized] public double startBeat = -1; [System.NonSerialized] public double startBeat = -1;
private double conveyerStartBeat = -1; [System.NonSerialized] public double conveyerStartBeat = -1;
private double conveyerLength = 1; private double conveyerLength = 1;
private Vector2 startPos; private Vector2 startPos;
@ -344,7 +344,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots
} }
else else
{ {
this.conveyerStartBeat = -1; this.conveyerStartBeat = -2;
game.conveyerStartBeat = -1; game.conveyerStartBeat = -1;
} }
releaseEvent.Disable(); releaseEvent.Disable();
@ -403,7 +403,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots
} }
else else
{ {
this.conveyerStartBeat = -1; this.conveyerStartBeat = -2;
game.conveyerStartBeat = -1; game.conveyerStartBeat = -1;
} }