diff --git a/Assets/Scripts/Conductor.cs b/Assets/Scripts/Conductor.cs index 322924be2..c32069a53 100644 --- a/Assets/Scripts/Conductor.cs +++ b/Assets/Scripts/Conductor.cs @@ -76,9 +76,6 @@ namespace HeavenStudio // Conductor is currently paused, but not fully stopped public bool isPaused; - // Last reported beat based on song position - private double lastReportedBeat = 0f; - // Metronome tick sound enabled public bool metronome = false; Util.Sound metronomeSound; @@ -381,6 +378,7 @@ namespace HeavenStudio } } + [Obsolete("Conductor.ReportBeat is deprecated. Please use the OnBeatPulse callback instead.")] public bool ReportBeat(ref double lastReportedBeat, double offset = 0, bool shiftBeatToOffset = true) { bool result = songPositionInBeats + (shiftBeatToOffset ? offset : 0f) >= (lastReportedBeat) + 1f; diff --git a/Assets/Scripts/Games/FanClub/FanClub.cs b/Assets/Scripts/Games/FanClub/FanClub.cs index 6defe4d95..bdadd7419 100644 --- a/Assets/Scripts/Games/FanClub/FanClub.cs +++ b/Assets/Scripts/Games/FanClub/FanClub.cs @@ -204,8 +204,6 @@ namespace HeavenStudio.Games private List Spectators; //bop-type animations - private GameEvent bop = new GameEvent(); - private GameEvent specBop = new GameEvent(); private GameEvent noBop = new GameEvent(); private GameEvent noResponse = new GameEvent(); private GameEvent noCall = new GameEvent(); @@ -356,30 +354,28 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + var cond = Conductor.instance; + if (goBopIdol) + { + if (!(cond.songPositionInBeatsAsDouble >= noBop.startBeat && cond.songPositionInBeatsAsDouble < noBop.startBeat + noBop.length)) + { + idolAnimator.Play("IdolBeat" + GetPerformanceSuffix(), 0, 0); + Blue.PlayAnimState("Beat"); + Orange.PlayAnimState("Beat"); + } + } + if (goBopSpec) + { + if (!(cond.songPositionInBeatsAsDouble >= noSpecBop.startBeat && cond.songPositionInBeatsAsDouble < noSpecBop.startBeat + noSpecBop.length)) + BopAll(); + } + } + private void Update() { var cond = Conductor.instance; - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (goBopIdol) - { - if (!(cond.songPositionInBeatsAsDouble >= noBop.startBeat && cond.songPositionInBeatsAsDouble < noBop.startBeat + noBop.length)) - { - idolAnimator.Play("IdolBeat" + GetPerformanceSuffix(), 0, 0); - Blue.PlayAnimState("Beat"); - Orange.PlayAnimState("Beat"); - } - } - } - - if (cond.ReportBeat(ref specBop.lastReportedBeat, specBop.startBeat % 1)) - { - if (goBopSpec) - { - if (!(cond.songPositionInBeatsAsDouble >= noSpecBop.startBeat && cond.songPositionInBeatsAsDouble < noSpecBop.startBeat + noSpecBop.length)) - BopAll(); - } - } //idol jumping physics float jumpPos = cond.GetPositionFromBeat(idolJumpStartTime, 1f); diff --git a/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs b/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs index e8eb46f47..3af0b6a5a 100644 --- a/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs +++ b/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs @@ -230,16 +230,17 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + if (goBopFlip) SingleBop((int)WhoBops.Flippers); + if (goBopTuck) SingleBop((int)WhoBops.CaptainTuck); + } + private void Update() { var cond = Conductor.instance; if (cond.isPlaying && !cond.isPaused) { - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (goBopFlip) SingleBop((int)WhoBops.Flippers); - if (goBopTuck) SingleBop((int)WhoBops.CaptainTuck); - } if (isWalking) { float normalizedBeat = cond.GetPositionFromBeat(walkStartBeat, walkLength); diff --git a/Assets/Scripts/Games/ForkLifter/ForkLifter.cs b/Assets/Scripts/Games/ForkLifter/ForkLifter.cs index 26e904d00..67812f8a7 100644 --- a/Assets/Scripts/Games/ForkLifter/ForkLifter.cs +++ b/Assets/Scripts/Games/ForkLifter/ForkLifter.cs @@ -129,6 +129,11 @@ namespace HeavenStudio.Games instance = this; } + public override void OnBeatPulse(double beat) + { + playerInstance.SingleBop(); + } + private void Update() { BackgroundColorUpdate(); diff --git a/Assets/Scripts/Games/ForkLifter/ForkLifterPlayer.cs b/Assets/Scripts/Games/ForkLifter/ForkLifterPlayer.cs index d3eed38de..f4678f2e5 100644 --- a/Assets/Scripts/Games/ForkLifter/ForkLifterPlayer.cs +++ b/Assets/Scripts/Games/ForkLifter/ForkLifterPlayer.cs @@ -49,16 +49,11 @@ namespace HeavenStudio.Games.Scripts_ForkLifter { Stab(null); } - - if (Conductor.instance.ReportBeat(ref lastReportedBeat) && anim.IsAnimationNotPlaying() && shouldBop) - { - SingleBop(); - } } public void SingleBop() { - anim.DoScaledAnimationAsync("Player_Bop", 0.5f); + if (anim.IsAnimationNotPlaying() && shouldBop) anim.DoScaledAnimationAsync("Player_Bop", 0.5f); } public void Eat() diff --git a/Assets/Scripts/Games/KarateMan/KarateMan.cs b/Assets/Scripts/Games/KarateMan/KarateMan.cs index 06acb99d0..9fca97f8b 100644 --- a/Assets/Scripts/Games/KarateMan/KarateMan.cs +++ b/Assets/Scripts/Games/KarateMan/KarateMan.cs @@ -1166,6 +1166,11 @@ namespace HeavenStudio.Games Wind.windMain = windStrength; } + public override void OnBeatPulse(double beat) + { + Joe.RequestBop(); + } + public void ToggleBop(double beat, float length, bool toggle, bool autoBop) { Joe.bop.length = autoBop ? float.MaxValue : 0; diff --git a/Assets/Scripts/Games/KarateMan/KarateManJoe.cs b/Assets/Scripts/Games/KarateMan/KarateManJoe.cs index 75f163641..dbc543d38 100644 --- a/Assets/Scripts/Games/KarateMan/KarateManJoe.cs +++ b/Assets/Scripts/Games/KarateMan/KarateManJoe.cs @@ -51,6 +51,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan } public bool inNuriLock { get { return (Conductor.instance.songPositionInBeatsAsDouble >= noNuriJabTime && Conductor.instance.songPositionInBeatsAsDouble < noNuriJabTime + 1f); } } + public void RequestBop() + { + var cond = Conductor.instance; + if (cond.songPositionInBeatsAsDouble > bop.startBeat && cond.songPositionInBeatsAsDouble < bop.startBeat + bop.length && cond.songPositionInBeatsAsDouble >= unPrepareTime && !inCombo) Bop(); + } + private void Update() { var cond = Conductor.instance; @@ -95,11 +101,6 @@ namespace HeavenStudio.Games.Scripts_KarateMan anim.Play("Beat", -1, 0); } - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1, false) && cond.songPositionInBeatsAsDouble > bop.startBeat && cond.songPositionInBeatsAsDouble < bop.startBeat + bop.length && cond.songPositionInBeatsAsDouble >= unPrepareTime && !inCombo) - { - Bop(); - } - if (inCombo && shouldComboId == -2) { float missProg = cond.GetPositionFromBeat(lastComboMissTime, 3f); diff --git a/Assets/Scripts/Games/Lockstep/Lockstep.cs b/Assets/Scripts/Games/Lockstep/Lockstep.cs index f425f735f..fad8de7ff 100644 --- a/Assets/Scripts/Games/Lockstep/Lockstep.cs +++ b/Assets/Scripts/Games/Lockstep/Lockstep.cs @@ -336,18 +336,19 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + if (goBop) + { + PlayStepperAnim("Bop", true, 0.5f); + } + } + private void Update() { var cond = Conductor.instance; if (cond.isPlaying && !cond.isPaused) { - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (goBop) - { - PlayStepperAnim("Bop", true, 0.5f); - } - } if (queuedInputs.Count > 0) { foreach (var input in queuedInputs) diff --git a/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs b/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs index 934b2eab9..f03d79db6 100644 --- a/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs +++ b/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs @@ -157,10 +157,9 @@ namespace HeavenStudio.Games } } - private void LateUpdate() + public override void OnBeatPulse(double beat) { - if (Conductor.instance.ReportBeat(ref lastReportedBeat) - && !BossAnim.IsPlayingAnimationName("BossCall") + if (!BossAnim.IsPlayingAnimationName("BossCall") && !BossAnim.IsPlayingAnimationName("BossSignal") && bossBop) { diff --git a/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs b/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs index 699ab5bd2..9de0976dc 100644 --- a/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs +++ b/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs @@ -349,24 +349,24 @@ namespace HeavenStudio.Games } } - private void LateUpdate() + public override void OnBeatPulse(double beat) { - if (Conductor.instance.ReportBeat(ref lastReportedBeat)) { - if ((MonkAnim.IsAnimationNotPlaying() || MonkAnim.IsPlayingAnimationName("Bop") || MonkAnim.IsPlayingAnimationName("Idle")) + if ((MonkAnim.IsAnimationNotPlaying() || MonkAnim.IsPlayingAnimationName("Bop") || MonkAnim.IsPlayingAnimationName("Idle")) && monkBop - && !isStaring) - { - MonkAnim.DoScaledAnimationAsync("Bop", 0.5f); - } + && !isStaring) + { + MonkAnim.DoScaledAnimationAsync("Bop", 0.5f); + } - if (!MonkAnim.IsPlayingAnimationName("Blush") || !MonkAnim.IsPlayingAnimationName("Stare")) { - if (growLevel == 4) BrowAnim.DoScaledAnimationAsync("Bop", 0.5f); - if (growLevel > 0) StacheAnim.DoScaledAnimationAsync($"Bop{growLevel}", 0.5f); - } + if (!MonkAnim.IsPlayingAnimationName("Blush") || !MonkAnim.IsPlayingAnimationName("Stare")) + { + if (growLevel == 4) BrowAnim.DoScaledAnimationAsync("Bop", 0.5f); + if (growLevel > 0) StacheAnim.DoScaledAnimationAsync($"Bop{growLevel}", 0.5f); + } - if (CloudMonkey.activeInHierarchy) { - CloudMonkey.GetComponent().DoScaledAnimationAsync("Bop", 0.5f); - } + if (CloudMonkey.activeInHierarchy) //Why activeInHierarchy? - Rasmus + { + CloudMonkey.GetComponent().DoScaledAnimationAsync("Bop", 0.5f); //DONT DO THIS!!! GetComponent is a really expensive operation - Rasmus } } diff --git a/Assets/Scripts/Games/OctopusMachine/Octopus.cs b/Assets/Scripts/Games/OctopusMachine/Octopus.cs index 532a4bfd5..b00e04977 100644 --- a/Assets/Scripts/Games/OctopusMachine/Octopus.cs +++ b/Assets/Scripts/Games/OctopusMachine/Octopus.cs @@ -17,7 +17,6 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine public bool isSqueezed; public bool isPreparing; public double queuePrepare; - public double lastReportedBeat = 0f; double lastSqueezeBeat; bool isActive = true; @@ -65,10 +64,9 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine } } - void LateUpdate() + public void RequestBop() { - if (Conductor.instance.ReportBeat(ref lastReportedBeat) - && !anim.IsPlayingAnimationName("Bop") + if (!anim.IsPlayingAnimationName("Bop") && !anim.IsPlayingAnimationName("Happy") && !anim.IsPlayingAnimationName("Angry") && !anim.IsPlayingAnimationName("Oops") diff --git a/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs b/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs index 2127d53d0..18fdf4eeb 100644 --- a/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs +++ b/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs @@ -206,7 +206,6 @@ namespace HeavenStudio.Games bool autoAction; double intervalStartBeat; float beatInterval = 1f; - double lastReportedBeat; static List queuedSqueezes = new(); static List queuedReleases = new(); @@ -253,6 +252,23 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + if (bopIterate >= 3) + { + bopStatus = + bopIterate = 0; + autoAction = false; + } + + if (autoAction) bopIterate++; + + foreach (var octo in octopodes) + { + octo.RequestBop(); + } + } + private void Update() { BackgroundColorUpdate(); @@ -261,17 +277,6 @@ namespace HeavenStudio.Games if (Text.text is "Wrong! Try Again!" or "Good!") Text.text = ""; queuePrepare = double.MaxValue; } - - if (Conductor.instance.ReportBeat(ref lastReportedBeat)) - { - if (bopIterate >= 3) { - bopStatus = - bopIterate = 0; - autoAction = false; - } - - if (autoAction) bopIterate++; - } } public void ChangeText(string text, string youText) diff --git a/Assets/Scripts/Games/RhythmRally/RhythmRally.cs b/Assets/Scripts/Games/RhythmRally/RhythmRally.cs index 28607ab70..0b808c355 100644 --- a/Assets/Scripts/Games/RhythmRally/RhythmRally.cs +++ b/Assets/Scripts/Games/RhythmRally/RhythmRally.cs @@ -152,7 +152,6 @@ namespace HeavenStudio.Games public Paddlers paddlers; - public GameEvent bop = new GameEvent(); private bool goBop = true; public static RhythmRally instance; @@ -357,16 +356,6 @@ namespace HeavenStudio.Games } } - - // Paddler bop animation. - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (goBop && !inPose) - { - BopSingle(); - } - } - opponentServing = false; //update camera @@ -375,6 +364,14 @@ namespace HeavenStudio.Games GameCamera.AdditionalFoV = cameraFOV; } + public override void OnBeatPulse(double beat) + { + if (goBop && !inPose) + { + BopSingle(); + } + } + public void Bop(double beat, float length, bool bop, bool bopAuto) { goBop = bopAuto; diff --git a/Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs b/Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs index 71b453230..ec54051b5 100644 --- a/Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs +++ b/Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs @@ -84,22 +84,20 @@ namespace HeavenStudio.Games instance = this; } - // Update is called once per frame + public override void OnBeatPulse(double beat) + { + if (shouldBop) SomenPlayer.DoScaledAnimationAsync("HeadBob", 0.5f); + } + void Update() { - var cond = Conductor.instance; - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop) - { - SomenPlayer.Play("HeadBob", -1, 0); - } - if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress)) { SoundByte.PlayOneShotGame("rhythmSomen/somen_mistake"); - FrontArm.Play("ArmPluck", -1, 0); - backArm.Play("BackArmNothing", 0, 0); + FrontArm.DoScaledAnimationAsync("ArmPluck", 0.5f); + backArm.DoScaledAnimationAsync("BackArmNothing", 0.5f); hasSlurped = false; - EffectSweat.Play("BlobSweating", -1, 0); + EffectSweat.DoScaledAnimationAsync("BlobSweating", 0.5f); ScoreMiss(); } } @@ -108,7 +106,7 @@ namespace HeavenStudio.Games { if (!missed) { - backArm.Play("BackArmLift", 0, 0); + backArm.DoScaledAnimationAsync("BackArmLift", 0.5f); FrontArm.DoScaledAnimationAsync("ArmSlurp", 0.5f); hasSlurped = true; BeatAction.New(instance, new List() @@ -117,8 +115,8 @@ namespace HeavenStudio.Games { if (hasSlurped) { - backArm.Play("BackArmNothing", 0, 0); - FrontArm.Play("ArmNothing", 0, 0); + backArm.DoScaledAnimationAsync("BackArmNothing", 0.5f); + FrontArm.DoScaledAnimationAsync("ArmNothing", 0.5f); } }) }); @@ -136,7 +134,7 @@ namespace HeavenStudio.Games { new BeatAction.Action(beat + i, delegate { - SomenPlayer.Play("HeadBob", -1, 0); + SomenPlayer.DoScaledAnimationAsync("HeadBob", 0.5f); }) }); } @@ -155,9 +153,9 @@ namespace HeavenStudio.Games BeatAction.New(instance, new List() { - new BeatAction.Action(beat, delegate { FarCrane.Play("Drop", -1, 0);}), - new BeatAction.Action(beat + 1.0f, delegate { FarCrane.Play("Open", -1, 0);}), - new BeatAction.Action(beat + 1.5f, delegate { FarCrane.Play("Lift", -1, 0);}), + new BeatAction.Action(beat, delegate { FarCrane.DoScaledAnimationAsync("Drop", 0.5f);}), + new BeatAction.Action(beat + 1.0f, delegate { FarCrane.DoScaledAnimationAsync("Open", 0.5f);}), + new BeatAction.Action(beat + 1.5f, delegate { FarCrane.DoScaledAnimationAsync("Lift", 0.5f);}), }); } @@ -174,9 +172,9 @@ namespace HeavenStudio.Games BeatAction.New(instance, new List() { - new BeatAction.Action(beat, delegate { CloseCrane.Play("DropClose", -1, 0);}), - new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.Play("OpenClose", -1, 0);}), - new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.Play("LiftClose", -1, 0);}), + new BeatAction.Action(beat, delegate { CloseCrane.DoScaledAnimationAsync("DropClose", 0.5f);}), + new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.DoScaledAnimationAsync("OpenClose", 0.5f);}), + new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.DoScaledAnimationAsync("LiftClose", 0.5f);}), }); } @@ -195,12 +193,12 @@ namespace HeavenStudio.Games BeatAction.New(instance, new List() { - new BeatAction.Action(beat, delegate { CloseCrane.Play("DropClose", -1, 0);}), - new BeatAction.Action(beat, delegate { FarCrane.Play("Drop", -1, 0);}), - new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.Play("OpenClose", -1, 0);}), - new BeatAction.Action(beat + 1.0f, delegate { FarCrane.Play("Open", -1, 0);}), - new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.Play("LiftClose", -1, 0);}), - new BeatAction.Action(beat + 1.5f, delegate { FarCrane.Play("Lift", -1, 0);}), + new BeatAction.Action(beat, delegate { CloseCrane.DoScaledAnimationAsync("DropClose", 0.5f);}), + new BeatAction.Action(beat, delegate { FarCrane.DoScaledAnimationAsync("Drop", 0.5f);}), + new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.DoScaledAnimationAsync("OpenClose", 0.5f);}), + new BeatAction.Action(beat + 1.0f, delegate { FarCrane.DoScaledAnimationAsync("Open", 0.5f);}), + new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.DoScaledAnimationAsync("LiftClose", 0.5f);}), + new BeatAction.Action(beat + 1.5f, delegate { FarCrane.DoScaledAnimationAsync("Lift", 0.5f);}), }); } @@ -212,35 +210,35 @@ namespace HeavenStudio.Games BeatAction.New(instance, new List() { - new BeatAction.Action(beat, delegate { EffectExclam.Play("ExclamAppear", -1, 0);}), + new BeatAction.Action(beat, delegate { EffectExclam.DoScaledAnimationAsync("ExclamAppear", 0.5f);}), }); } public void CatchSuccess(PlayerActionEvent caller, float state) { - backArm.Play("BackArmNothing", 0, 0); + backArm.DoScaledAnimationAsync("BackArmNothing", 0, 0); hasSlurped = false; splashEffect.Play(); if (state >= 1f || state <= -1f) { SoundByte.PlayOneShotGame("rhythmSomen/somen_splash"); - FrontArm.Play("ArmPluckNG", -1, 0); - EffectSweat.Play("BlobSweating", -1, 0); + FrontArm.DoScaledAnimationAsync("ArmPluckNG", 0.5f); + EffectSweat.DoScaledAnimationAsync("BlobSweating", 0.5f); missed = true; return; } SoundByte.PlayOneShotGame("rhythmSomen/somen_catch"); SoundByte.PlayOneShotGame("rhythmSomen/somen_catch_old", volume: 0.25f); - FrontArm.Play("ArmPluckOK", -1, 0); - EffectHit.Play("HitAppear", -1, 0); + FrontArm.DoScaledAnimationAsync("ArmPluckOK", 0.5f); + EffectHit.DoScaledAnimationAsync("HitAppear", 0.5f); missed = false; } public void CatchMiss(PlayerActionEvent caller) { missed = true; - EffectShock.Play("ShockAppear", -1, 0); + EffectShock.DoScaledAnimationAsync("ShockAppear", 0.5f); } public void CatchEmpty(PlayerActionEvent caller) diff --git a/Assets/Scripts/Games/Ringside/Ringside.cs b/Assets/Scripts/Games/Ringside/Ringside.cs index d70d7615e..5da8b759b 100644 --- a/Assets/Scripts/Games/Ringside/Ringside.cs +++ b/Assets/Scripts/Games/Ringside/Ringside.cs @@ -218,26 +218,27 @@ namespace HeavenStudio.Games ReporterBlink(); } + public override void OnBeatPulse(double beat) + { + if (shouldBop && canBop) + { + if (UnityEngine.Random.Range(1, 18) == 1) + { + wrestlerAnim.DoScaledAnimationAsync("BopPec"); + } + else + { + wrestlerAnim.DoScaledAnimationAsync("Bop"); + } + } + } + void Update() { var cond = Conductor.instance; if (cond.isPlaying && !cond.isPaused) { - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (shouldBop && canBop) - { - if (UnityEngine.Random.Range(1, 18) == 1) - { - wrestlerAnim.DoScaledAnimationAsync("BopPec"); - } - else - { - wrestlerAnim.DoScaledAnimationAsync("Bop"); - } - } - } if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress) && !shouldNotInput) { if ((PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch) diff --git a/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs b/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs index e50fe1559..13d41c7e2 100644 --- a/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs +++ b/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs @@ -169,16 +169,14 @@ namespace HeavenStudio.Games instance = this; } - // Update is called once per frame + public override void OnBeatPulse(double beat) + { + if (goBopSamurai) player.Bop(); + if (goBopChild) childParent.GetComponent().Bop(); + } + void Update() { - var cond = Conductor.instance; - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (goBopSamurai) player.Bop(); - if (goBopChild) childParent.GetComponent().Bop(); - } - if (PlayerInput.GetIsAction(InputAction_AltDown)) DoStep(); if (PlayerInput.GetIsAction(InputAction_AltUp) && player.isStepping()) diff --git a/Assets/Scripts/Games/SpaceDance/SpaceDance.cs b/Assets/Scripts/Games/SpaceDance/SpaceDance.cs index 978a4d3eb..45668df13 100644 --- a/Assets/Scripts/Games/SpaceDance/SpaceDance.cs +++ b/Assets/Scripts/Games/SpaceDance/SpaceDance.cs @@ -228,6 +228,18 @@ namespace HeavenStudio.Games colorEnd = defaultBGColor; } + public override void OnBeatPulse(double beat) + { + if (shouldBop) + { + Bop(); + } + if (spaceGrampsShouldBop) + { + GrampsBop(); + } + } + // Update is called once per frame void Update() { @@ -237,17 +249,6 @@ namespace HeavenStudio.Games { scroll.NormalizedX -= xBaseSpeed * xScrollMultiplier * Time.deltaTime; scroll.NormalizedY -= yBaseSpeed * yScrollMultiplier * Time.deltaTime; - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (shouldBop) - { - Bop(); - } - if (spaceGrampsShouldBop) - { - GrampsBop(); - } - } if (isShootingStar) { float normalizedBeat = cond.GetPositionFromBeat(shootingStarStartBeat, shootingStarLength); diff --git a/Assets/Scripts/Games/TapTrial/TapTrial.cs b/Assets/Scripts/Games/TapTrial/TapTrial.cs index dd69a99a6..0d43147b5 100644 --- a/Assets/Scripts/Games/TapTrial/TapTrial.cs +++ b/Assets/Scripts/Games/TapTrial/TapTrial.cs @@ -123,15 +123,16 @@ namespace HeavenStudio.Games instance = this; } + public override void OnBeatPulse(double beat) + { + if (shouldBop) SingleBop(); + } + private void Update() { var cond = Conductor.instance; if (cond.isPlaying && !cond.isPaused) { - if (shouldBop && cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - SingleBop(); - } GiraffeUpdate(cond); JumpUpdate(cond); ScrollUpdate(cond); diff --git a/Assets/Scripts/Games/TheDazzles/TheDazzles.cs b/Assets/Scripts/Games/TheDazzles/TheDazzles.cs index b1ef7e9a6..2a35b7e28 100644 --- a/Assets/Scripts/Games/TheDazzles/TheDazzles.cs +++ b/Assets/Scripts/Games/TheDazzles/TheDazzles.cs @@ -257,23 +257,24 @@ namespace HeavenStudio.Games instance = this; } + public override void OnBeatPulse(double beat) + { + if (shouldBop) + { + foreach (var girl in npcGirls) + { + girl.Bop(); + } + player.Bop(); + } + } + void Update() { var cond = Conductor.instance; if (cond.isPlaying && !cond.isPaused) { - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (shouldBop) - { - foreach (var girl in npcGirls) - { - girl.Bop(); - } - player.Bop(); - } - } if (queuedPoses.Count > 0) { foreach (var pose in queuedPoses) diff --git a/Assets/Scripts/Games/TossBoys/TossBoys.cs b/Assets/Scripts/Games/TossBoys/TossBoys.cs index 92ba26420..31c46cd3e 100644 --- a/Assets/Scripts/Games/TossBoys/TossBoys.cs +++ b/Assets/Scripts/Games/TossBoys/TossBoys.cs @@ -262,20 +262,20 @@ namespace HeavenStudio.Games return default(SuperCurveObject.Path); } + public override void OnBeatPulse(double beat) + { + if (shouldBop) + { + SingleBop(); + } + } + private void Update() { var cond = Conductor.instance; BackgroundColorUpdate(); if (cond.isPlaying && !cond.isPaused) { - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (shouldBop) - { - SingleBop(); - } - } - if (PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch) { TossKid next = GetCurrentReceiver(); diff --git a/Assets/Scripts/Games/TossBoys/TossKid.cs b/Assets/Scripts/Games/TossBoys/TossKid.cs index deba5d36c..d7d6a4f79 100644 --- a/Assets/Scripts/Games/TossBoys/TossKid.cs +++ b/Assets/Scripts/Games/TossBoys/TossKid.cs @@ -41,7 +41,7 @@ namespace HeavenStudio.Games.Scripts_TossBoys public void Bop() { - if (!anim.IsAnimationNotPlaying() || crouch || preparing) return; + if (crouch || preparing) return; DoAnimationScaledAsync("Bop", 0.5f); } diff --git a/Assets/Scripts/Games/TrickClass/TrickClass.cs b/Assets/Scripts/Games/TrickClass/TrickClass.cs index 4fb962988..31dda092e 100644 --- a/Assets/Scripts/Games/TrickClass/TrickClass.cs +++ b/Assets/Scripts/Games/TrickClass/TrickClass.cs @@ -116,18 +116,20 @@ namespace HeavenStudio.Games instance = this; } + public override void OnBeatPulse(double beat) + { + var cond = Conductor.instance; + if (!goBop) return; + if ((!playerReady) && cond.songPositionInBeatsAsDouble > playerBopStart) + playerAnim.DoScaledAnimationAsync("Bop"); + + if (cond.songPositionInBeatsAsDouble > girlBopStart) + girlAnim.DoScaledAnimationAsync("Bop"); + } + private void Update() { var cond = Conductor.instance; - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && goBop) - { - if ((!playerReady) && cond.songPositionInBeatsAsDouble > playerBopStart) - playerAnim.DoScaledAnimationAsync("Bop"); - - if (cond.songPositionInBeatsAsDouble > girlBopStart) - girlAnim.DoScaledAnimationAsync("Bop"); - } - if (cond.isPlaying && !cond.isPaused) { if (queuedInputs.Count > 0)