Fan Club: fix order of operation bug

This commit is contained in:
minenice55 2022-06-08 21:53:16 -04:00
parent e604f3e9d6
commit c5e0f53c4a
2 changed files with 23 additions and 15 deletions

View file

@ -28,18 +28,25 @@ namespace HeavenStudio.Games.Scripts_FanClub
float clappingStartTime = Single.MinValue; float clappingStartTime = Single.MinValue;
public void AddHit(float beat, int type) public void AddHit(float beat, int type = 0)
{ {
if (player) if (player)
{ {
if (type == 0) // normal clap switch (type)
FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, ClapJust, ClapThrough, Out); {
else if (type == 1) // jump case 0:
FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_UP, JumpJust, JumpThrough, JumpOut); FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, ClapJust, ClapThrough, Out);
else if (type == 2) //"kamone" charge break;
FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, ChargeClapJust, ClapThrough, Out); case 1:
else //"kamone" long clap (first) FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_UP, JumpJust, JumpThrough, JumpOut);
FanClub.instance.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, LongClapJust, ClapThrough, Out); 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()) if (PlayerInput.Pressing())
{ {
Debug.Log("song pos: " + cond.songPositionInBeats + ", clap start: " + clappingStartTime);
if (clappingStartTime != Single.MinValue && cond.songPositionInBeats > clappingStartTime + 2f && !stopCharge) if (clappingStartTime != Single.MinValue && cond.songPositionInBeats > clappingStartTime + 2f && !stopCharge)
{ {
Debug.Log("ChargeOut");
animator.Play("FanClapCharge", -1, 0); animator.Play("FanClapCharge", -1, 0);
stopCharge = true; stopCharge = true;
} }
} }
if (PlayerInput.PressedUp()) if (PlayerInput.PressedUp())
{ {
if (stopCharge) if (clappingStartTime != Single.MinValue && cond.songPositionInBeats > clappingStartTime + 2f && stopCharge && !FanClub.instance.IsExpectingInputNow())
{ {
if (!FanClub.instance.IsExpectingInputNow()) Debug.Log("JumpOut");
{ JumpStart(false);
JumpStart(false);
}
} }
else else
{ {
@ -162,6 +169,7 @@ namespace HeavenStudio.Games.Scripts_FanClub
animator.Play("FanClap", -1, 0); animator.Play("FanClap", -1, 0);
Jukebox.PlayOneShotGame("fanClub/play_clap"); Jukebox.PlayOneShotGame("fanClub/play_clap");
Jukebox.PlayOneShotGame("fanClub/crap_impact"); Jukebox.PlayOneShotGame("fanClub/crap_impact");
Debug.Log("Setting clappingStartTime to " + cond.songPositionInBeats);
clappingStartTime = cond.songPositionInBeats; clappingStartTime = cond.songPositionInBeats;
if (doCharge) if (doCharge)

View file

@ -116,7 +116,7 @@ namespace HeavenStudio.Games
float t1 = closest.startBeat + closest.timer; float t1 = closest.startBeat + closest.timer;
float t2 = toCompare.startBeat + toCompare.timer; float t2 = toCompare.startBeat + toCompare.timer;
Debug.Log("t1=" + t1 + " -- t2=" + t2); // Debug.Log("t1=" + t1 + " -- t2=" + t2);
if (t2 < t1) closest = toCompare; if (t2 < t1) closest = toCompare;
} }