diff --git a/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs b/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs index b78cc9eb3..a3906fec2 100644 --- a/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs +++ b/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs @@ -135,13 +135,14 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + if (shouldBop) Bop(Conductor.instance.songPositionInBeatsAsDouble); + } + void Update() { var cond = Conductor.instance; - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (shouldBop) Bop(cond.songPositionInBeatsAsDouble); - } if (cond.isPlaying && !cond.isPaused) { float normalizedBeat = cond.GetPositionFromBeat(signStartBeat, signLength); diff --git a/Assets/Scripts/Games/DJSchool/DJSchool.cs b/Assets/Scripts/Games/DJSchool/DJSchool.cs index fdc3dcb6e..953c5239d 100644 --- a/Assets/Scripts/Games/DJSchool/DJSchool.cs +++ b/Assets/Scripts/Games/DJSchool/DJSchool.cs @@ -165,95 +165,48 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + if (!goBop) return; + if (student.isHolding) + { + student.anim.DoScaledAnimationAsync("HoldBop", 0.5f); + } + else if (!student.swiping && student.anim.IsAnimationNotPlaying()) + { + student.anim.DoScaledAnimationAsync("IdleBop", 0.5f); + } + + var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0); + if (yellowState.IsName("Hey")) + { + //PostScratchoFace(); + } + if (!andStop && !djYellowHolding) + { + float normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f); + if (normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.Happy); + else if (!djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.NeutralLeft); + djYellowScript.Reverse(djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)); + if (djYellowBopLeft) + { + djYellowAnim.DoScaledAnimationAsync("IdleBop2", 0.5f); + } + else + { + djYellowAnim.DoScaledAnimationAsync("IdleBop", 0.5f); + } + djYellowBopLeft = !djYellowBopLeft; + + } + else if (djYellowHolding) + { + djYellowAnim.DoScaledAnimationAsync("HoldBop", 0.5f); + } + } + private void Update() { - #region old script - //var cond = Conductor.instance; - - //if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - //{ - // if (cond.songPositionInBeatsAsDouble >= bop.startBeat && cond.songPositionInBeatsAsDouble < bop.startBeat + bop.length) - // { - // if (student.anim.IsAnimationNotPlaying()) - // { - // if (student.isHolding) - // { - // student.anim.Play("HoldBop", 0, 0); - // } - // else - // { - // student.anim.Play("IdleBop", 0, 0); - // } - // } - // if (djYellowAnim.IsAnimationNotPlaying()) - // { - // var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0); - // if (yellowState.IsName("Hey")) - // { - // PostScratchoFace(); - // } - - // if (djYellowHolding) - // { - // djYellowAnim.Play("HoldBop", 0, 0); - // } - // else - // { - // // todo: split between left and right bop based on beat - // djYellowAnim.Play("IdleBop", 0, 0); - // } - // } - // } - //} - #endregion - - if (Conductor.instance.ReportBeat(ref lastReportedBeat)) - { - if (goBop) - { - if (student.isHolding) - { - student.anim.DoScaledAnimationAsync("HoldBop", 0.5f); - } - else if (!student.swiping && student.anim.IsAnimationNotPlaying()) - { - student.anim.DoScaledAnimationAsync("IdleBop", 0.5f); - } - - var yellowState = djYellowAnim.GetCurrentAnimatorStateInfo(0); - if (yellowState.IsName("Hey")) - { - //PostScratchoFace(); - } - if (!andStop && !djYellowHolding) - { - float normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f); - if (normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.Happy); - else if (!djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.NeutralLeft); - djYellowScript.Reverse(djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)); - if (djYellowBopLeft) - { - djYellowAnim.DoScaledAnimationAsync("IdleBop2", 0.5f); - } - else - { - djYellowAnim.DoScaledAnimationAsync("IdleBop", 0.5f); - } - djYellowBopLeft = !djYellowBopLeft; - - } - else if (djYellowHolding) - { - djYellowAnim.DoScaledAnimationAsync("HoldBop", 0.5f); - } - } - - } - else if (Conductor.instance.songPositionInBeatsAsDouble < lastReportedBeat) - { - lastReportedBeat = Math.Round(Conductor.instance.songPositionInBeatsAsDouble); - } - if(PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress) && !student.isHolding) //Start hold miss { student.OnMissHoldForPlayerInput(); diff --git a/Assets/Scripts/Games/DogNinja/DogNinja.cs b/Assets/Scripts/Games/DogNinja/DogNinja.cs index b14379f2b..388d8a62a 100644 --- a/Assets/Scripts/Games/DogNinja/DogNinja.cs +++ b/Assets/Scripts/Games/DogNinja/DogNinja.cs @@ -17,11 +17,12 @@ namespace HeavenStudio.Games.Loaders { new GameAction("Bop", "Bop") { - function = delegate { DogNinja.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity["toggle"]); }, - defaultLength = 0.5f, + function = delegate { DogNinja.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length, eventCaller.currentEntity["auto"], eventCaller.currentEntity["toggle"]); }, + resizable = true, parameters = new List() { - new Param("toggle", false, "Enable Bopping", "Whether to bop to the beat or not"), + new Param("toggle", true, "Enable Bopping", "Whether to bop to the beat or not"), + new Param("auto", false, "Enable Bopping (Auto)", "Whether to bop to the beat or not automatically"), } }, new GameAction("Prepare", "Prepare") @@ -141,7 +142,7 @@ namespace HeavenStudio.Games private double lastReportedBeat = 0f; private bool birdOnScreen = false; - static bool dontBop = false; + bool dontBop = false; private const string sfxNum = "dogNinja/"; public static DogNinja instance; @@ -213,6 +214,12 @@ namespace HeavenStudio.Games } } + public override void OnBeatPulse(double beat) + { + if (dontBop) return; + DogAnim.DoScaledAnimationAsync("Bop", 0.5f); + } + private void Update() { if (DogAnim.GetBool("needPrepare") && DogAnim.IsAnimationNotPlaying()) @@ -258,17 +265,18 @@ namespace HeavenStudio.Games } } - private void LateUpdate() + public void Bop(double beat, float length, bool auto, bool bop) { - if (Conductor.instance.ReportBeat(ref lastReportedBeat) && DogAnim.IsAnimationNotPlaying() && !dontBop) - { - DogAnim.DoScaledAnimationAsync("Bop", 0.5f); - } - } + dontBop = !auto; + if (!bop) return; + List actions = new(); - public void Bop(double beat, bool bop) - { - dontBop = !bop; + for (int i = 0; i < length; i++) + { + actions.Add(new(beat + i, delegate { DogAnim.DoScaledAnimationAsync("Bop", 0.5f); })); + } + + if (actions.Count > 0) BeatAction.New(this, actions); } public static void QueueObject(double beat, int direction, int typeL, int typeR, bool prepare, bool muteThrow) diff --git a/Assets/Scripts/Games/DoubleDate/DoubleDate.cs b/Assets/Scripts/Games/DoubleDate/DoubleDate.cs index e1f50fb7d..e82f6aa52 100644 --- a/Assets/Scripts/Games/DoubleDate/DoubleDate.cs +++ b/Assets/Scripts/Games/DoubleDate/DoubleDate.cs @@ -138,6 +138,11 @@ namespace HeavenStudio.Games clouds.transform.position = Vector3.left * ((Time.realtimeSinceStartup * cloudSpeed) % cloudDistance); } + public override void OnBeatPulse(double beat) + { + if (shouldBop) SingleBop(); + } + void Update() { var cond = Conductor.instance; @@ -162,10 +167,6 @@ namespace HeavenStudio.Games } queuedBalls.Clear(); } - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop) - { - SingleBop(); - } } else { diff --git a/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs b/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs index 7ae3ddd66..071711e07 100644 --- a/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs +++ b/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs @@ -144,16 +144,17 @@ namespace HeavenStudio.Games PersistColor(beat); } + public override void OnBeatPulse(double beat) + { + if (goBop) + { + Bop(); + } + } + private void Update() { var cond = Conductor.instance; - if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) - { - if (goBop) - { - Bop(); - } - } if (isMoving && cond.isPlaying && !cond.isPaused) {