diff --git a/Assets/Scripts/Games/Fillbots/Fillbots.cs b/Assets/Scripts/Games/Fillbots/Fillbots.cs index 2161514ee..3139c51ea 100644 --- a/Assets/Scripts/Games/Fillbots/Fillbots.cs +++ b/Assets/Scripts/Games/Fillbots/Fillbots.cs @@ -13,6 +13,7 @@ namespace HeavenStudio.Games.Loaders { var botParams = new List() { + new Param("practice", false, "Count-In"), new Param("alt", false, "Alternate OK"), new Param("type", Scripts_Fillbots.EndAnim.Both, "Success Reaction", "Set the reaction of the Robot."), new Param("stop", false, "Stop Conveyer", "Toggle if the conveyer should be stopped when finished."), @@ -51,6 +52,7 @@ namespace HeavenStudio.Games.Loaders preFunction = delegate { var e = eventCaller.currentEntity; Fillbots.PreSpawnFillbot(e.beat, 3, (int)Scripts_Fillbots.BotSize.Medium, e["colorFuel"], e["colorLampOff"], e["colorLampOn"], e["type"], e["alt"], e["stop"], e["color"]); + if (e["practice"]) Fillbots.FillErUp(e.beat + 3); }, defaultLength = 8f, parameters = botParams, @@ -60,6 +62,7 @@ namespace HeavenStudio.Games.Loaders preFunction = delegate { var e = eventCaller.currentEntity; Fillbots.PreSpawnFillbot(e.beat, 7, (int)Scripts_Fillbots.BotSize.Large, e["colorFuel"], e["colorLampOff"], e["colorLampOn"], e["type"], e["alt"], e["stop"], e["color"]); + if (e["practice"]) Fillbots.FillErUp(e.beat + 3); }, defaultLength = 12f, parameters = botParams, @@ -69,6 +72,7 @@ namespace HeavenStudio.Games.Loaders preFunction = delegate { var e = eventCaller.currentEntity; Fillbots.PreSpawnFillbot(e.beat, 1, (int)Scripts_Fillbots.BotSize.Small, e["colorFuel"], e["colorLampOff"], e["colorLampOn"], e["type"], e["alt"], e["stop"], e["color"]); + if (e["practice"]) Fillbots.FillErUp(e.beat + 3); }, defaultLength = 6f, parameters = botParams, @@ -78,6 +82,7 @@ namespace HeavenStudio.Games.Loaders preFunction = delegate { var e = eventCaller.currentEntity; Fillbots.PreSpawnFillbot(e.beat, e.length-5, e["size"], e["colorFuel"], e["colorLampOff"], e["colorLampOn"], e["type"], e["alt"], e["stop"], e["color"]); + if (e["practice"]) Fillbots.FillErUp(e.beat + 3); }, defaultLength = 6f, resizable = true, @@ -374,17 +379,17 @@ namespace HeavenStudio.Games { bot.StackToLeft(beat, 0.25); } - conveyerStartBeat = beat - 0.25; + if (conveyerStartBeat is -2) conveyerStartBeat = beat - 0.25; })); actions.Add(new BeatAction.Action(beat, delegate { - if (conveyerStartBeat != -1) conveyerNormalizedOffset = (conveyerNormalizedOffset + Conductor.instance.GetPositionFromBeat(conveyerStartBeat, 1)) % 1; + RenewConveyerNormalizedOffset(); conveyerStartBeat = -2; })); } else { actions.Add(new BeatAction.Action(beat - 0.5, delegate { - if (conveyerStartBeat != -1) conveyerNormalizedOffset = (conveyerNormalizedOffset + Conductor.instance.GetPositionFromBeat(conveyerStartBeat, 1)) % 1; + RenewConveyerNormalizedOffset(); conveyerStartBeat = -2; })); } @@ -407,6 +412,15 @@ namespace HeavenStudio.Games })); BeatAction.New(instance, actions); } + public static void FillErUp(double beat) + { + MultiSound.Play(new MultiSound.Sound[] + { + new MultiSound.Sound("fillbots/fillErUp1", beat - 0.5), + new MultiSound.Sound("fillbots/fillErUp2", beat - 0.25), + new MultiSound.Sound("fillbots/fillErUp3", beat), + }, forcePlay: true); + } public void ToggleBop(double beat, float length, bool bopOrNah, bool autoBop) { @@ -459,6 +473,14 @@ namespace HeavenStudio.Games gear.localEulerAngles = new Vector3(0, 0, Mathf.LerpUnclamped(0, -90, beat)); } } + public void RenewConveyerNormalizedOffset() + { + if (conveyerStartBeat is not -1 or -2) + { + float normalizedBeat = Conductor.instance.GetPositionFromBeat(conveyerStartBeat, 1); + if (normalizedBeat >= 0) conveyerNormalizedOffset = (conveyerNormalizedOffset + normalizedBeat) % 4; + } + } public void Blackout() { diff --git a/Assets/Scripts/Games/Fillbots/NtrFillbot.cs b/Assets/Scripts/Games/Fillbots/NtrFillbot.cs index fc73531ab..116a16812 100644 --- a/Assets/Scripts/Games/Fillbots/NtrFillbot.cs +++ b/Assets/Scripts/Games/Fillbots/NtrFillbot.cs @@ -90,7 +90,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots private void OnDestroy() { - if (fillSound != null) fillSound.KillLoop(0); + fillSoundRelease(); } private void Awake() @@ -127,7 +127,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots if (normalized >= 8) { game.currentBots.Remove(this); - Destroy(gameObject); + Destroy(this.gameObject); } } @@ -175,7 +175,6 @@ namespace HeavenStudio.Games.Scripts_Fillbots List sounds = new(); float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 1); - Debug.Log(Mathf.Max(normalizedBeat-0.1f, 0)); for (int i = (int)Mathf.Ceil(Mathf.Max(normalizedBeat-0.1f, 0)); i <= 2; i++) { sounds.Add(new("fillbots/" + sizePrefix + "Fall", startBeat + i)); @@ -314,8 +313,9 @@ namespace HeavenStudio.Games.Scripts_Fillbots new BeatAction.Action(startBeat + holdLength + 5.5, delegate { game.fillerHolding = false; SoundByte.PlayOneShotGame("fillbots/explosion"); + fillSoundRelease(); game.currentBots.Remove(this); - Destroy(gameObject); + Destroy(this.gameObject); }), }); } @@ -332,7 +332,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots fullBody.DoScaledAnimationAsync("ReleaseLate", 0.5f); SoundByte.PlayOneShotGame("fillbots/miss"); } - fillSound.KillLoop(0); + fillSoundRelease(); beepEvent.enabled = false; _botState = BotState.Ng; game.fillerHolding = false; @@ -367,7 +367,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots fullBody.Play("HoldBarely", 0, 0); return; } - if (game.conveyerStartBeat != -1) game.conveyerNormalizedOffset = (game.conveyerNormalizedOffset + Conductor.instance.GetPositionFromBeat(game.conveyerStartBeat, 1)) % 1; + game.RenewConveyerNormalizedOffset(); game.conveyerStartBeat = -1; conveyerLength = 1; @@ -376,7 +376,11 @@ namespace HeavenStudio.Games.Scripts_Fillbots game.fillerHolding = true; fullBody.DoScaledAnimationAsync("Hold", 1f); SoundByte.PlayOneShotGame("fillbots/beep"); - fillSound = SoundByte.PlayOneShotGame("fillbots/water", -1, 1 / (float)(holdLength / 3), 1, true); + + float watarPitch = 3 / (float)(holdLength + 3) + 0.5f; + fillSound = SoundByte.PlayOneShotGame("fillbots/water", -1, watarPitch, 1, true); + fillSound.BendUp((float)holdLength * Conductor.instance.pitchedSecPerBeat / 0.5f,2*watarPitch); // sorry + releaseEvent = game.ScheduleInput(startBeat + 4, holdLength, Fillbots.InputAction_BasicRelease, JustRelease, Empty, Empty); beepEvent = new GameEvent() { @@ -389,12 +393,13 @@ namespace HeavenStudio.Games.Scripts_Fillbots private void JustRelease(PlayerActionEvent caller, float state) { - fillSound.KillLoop(0); + fillSoundRelease(); beepEvent.enabled = false; if (conveyerRestartLength >= 0) { this.conveyerStartBeat = caller.timer + caller.startBeat + conveyerRestartLength; - if (game.conveyerStartBeat != -2) game.conveyerStartBeat = this.conveyerStartBeat; + game.RenewConveyerNormalizedOffset(); + if (game.conveyerStartBeat is not -2) game.conveyerStartBeat = this.conveyerStartBeat; } else { @@ -483,6 +488,15 @@ namespace HeavenStudio.Games.Scripts_Fillbots private void Empty(PlayerActionEvent caller) { } + private void fillSoundRelease() + { + if (fillSound != null) + { + fillSound.KillLoop(0); + fillSound = null; + } + } + public void SuccessDance() { fullBody.DoScaledAnimationAsync("Success", 0.5f);