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;
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)

View file

@ -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;
}