From c5e0f53c4a1baa57b9d0dd586268ab48f4704203 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Wed, 8 Jun 2022 21:53:16 -0400 Subject: [PATCH] Fan Club: fix order of operation bug --- Assets/Scripts/Games/FanClub/NtrIdolFan.cs | 36 +++++++++++++--------- Assets/Scripts/Games/Minigame.cs | 2 +- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/Assets/Scripts/Games/FanClub/NtrIdolFan.cs b/Assets/Scripts/Games/FanClub/NtrIdolFan.cs index 79ab79388..a6953b479 100644 --- a/Assets/Scripts/Games/FanClub/NtrIdolFan.cs +++ b/Assets/Scripts/Games/FanClub/NtrIdolFan.cs @@ -28,18 +28,25 @@ namespace HeavenStudio.Games.Scripts_FanClub float clappingStartTime = Single.MinValue; - public void AddHit(float beat, int type) + public void AddHit(float beat, int type = 0) { if (player) { - if (type == 0) // normal clap - FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, ClapJust, ClapThrough, Out); - else if (type == 1) // jump - FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_UP, JumpJust, JumpThrough, JumpOut); - else if (type == 2) //"kamone" charge - FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, ChargeClapJust, ClapThrough, Out); - else //"kamone" long clap (first) - FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, LongClapJust, ClapThrough, Out); + switch (type) + { + case 0: + FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, ClapJust, ClapThrough, Out); + break; + case 1: + FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_UP, JumpJust, JumpThrough, JumpOut); + break; + case 2: + FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, ChargeClapJust, ClapThrough, Out); + break; + default: + FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, LongClapJust, ClapThrough, Out); + break; + } } } @@ -99,20 +106,20 @@ namespace HeavenStudio.Games.Scripts_FanClub } if (PlayerInput.Pressing()) { + Debug.Log("song pos: " + cond.songPositionInBeats + ", clap start: " + clappingStartTime); if (clappingStartTime != Single.MinValue && cond.songPositionInBeats > clappingStartTime + 2f && !stopCharge) { + Debug.Log("ChargeOut"); animator.Play("FanClapCharge", -1, 0); stopCharge = true; } } if (PlayerInput.PressedUp()) { - if (stopCharge) + if (clappingStartTime != Single.MinValue && cond.songPositionInBeats > clappingStartTime + 2f && stopCharge && !FanClub.instance.IsExpectingInputNow()) { - if (!FanClub.instance.IsExpectingInputNow()) - { - JumpStart(false); - } + Debug.Log("JumpOut"); + JumpStart(false); } else { @@ -162,6 +169,7 @@ namespace HeavenStudio.Games.Scripts_FanClub animator.Play("FanClap", -1, 0); Jukebox.PlayOneShotGame("fanClub/play_clap"); Jukebox.PlayOneShotGame("fanClub/crap_impact"); + Debug.Log("Setting clappingStartTime to " + cond.songPositionInBeats); clappingStartTime = cond.songPositionInBeats; if (doCharge) diff --git a/Assets/Scripts/Games/Minigame.cs b/Assets/Scripts/Games/Minigame.cs index 92ca3459a..c54cdd46a 100644 --- a/Assets/Scripts/Games/Minigame.cs +++ b/Assets/Scripts/Games/Minigame.cs @@ -116,7 +116,7 @@ namespace HeavenStudio.Games float t1 = closest.startBeat + closest.timer; float t2 = toCompare.startBeat + toCompare.timer; - Debug.Log("t1=" + t1 + " -- t2=" + t2); + // Debug.Log("t1=" + t1 + " -- t2=" + t2); if (t2 < t1) closest = toCompare; }