Mr Upbeat and Lockstep Animation fixes (#238)

* mr upbeat input fix + lockstep offbeat switch event seperation

* Lockstep + MrUpbeat animation fixes
This commit is contained in:
Rapandrasmus 2023-01-25 16:29:09 +01:00 committed by GitHub
parent 07b9f8dff1
commit a70a175783
3 changed files with 26 additions and 10 deletions

View file

@ -1,6 +1,7 @@
/* I do not know crap about Unity or C# /* I do not know crap about Unity or C#
Almost none of this code is mine, but it's all fair game when the game you're stealing from Almost none of this code is mine, but it's all fair game when the game you're stealing from
borrowed from other games */ borrowed from other games */
//Don't worry Raffy everyone starts somewhere - Rasmus
using HeavenStudio.Util; using HeavenStudio.Util;
using System; using System;
@ -275,7 +276,7 @@ namespace HeavenStudio.Games
if (state >= 1f || state <= -1f) if (state >= 1f || state <= -1f)
{ {
var cond = Conductor.instance; var cond = Conductor.instance;
var beatAnimCheck = Math.Round(cond.songPositionInBeats * 2); var beatAnimCheck = Math.Round(caller.startBeat * 2);
if (beatAnimCheck % 2 != 0) if (beatAnimCheck % 2 != 0)
{ {
Jukebox.PlayOneShotGame("lockstep/tink"); Jukebox.PlayOneShotGame("lockstep/tink");
@ -288,13 +289,12 @@ namespace HeavenStudio.Games
} }
return; return;
} }
Success(); Success(caller.startBeat);
} }
public void Success() public void Success(float beat)
{ {
var cond = Conductor.instance; var beatAnimCheck = Math.Round(beat * 2);
var beatAnimCheck = Math.Round(cond.songPositionInBeats * 2);
if (beatAnimCheck % 2 != 0) if (beatAnimCheck % 2 != 0)
{ {
Jukebox.PlayOneShotGame($"lockstep/marchOffbeat{UnityEngine.Random.Range(1, 3)}"); Jukebox.PlayOneShotGame($"lockstep/marchOffbeat{UnityEngine.Random.Range(1, 3)}");
@ -309,8 +309,7 @@ namespace HeavenStudio.Games
public void Miss(PlayerActionEvent caller) public void Miss(PlayerActionEvent caller)
{ {
var cond = Conductor.instance; var beatAnimCheck = Math.Round(caller.startBeat * 2);
var beatAnimCheck = Math.Round(cond.songPositionInBeats * 2);
if (beatAnimCheck % 2 != 0 && currentMissStage != HowMissed.MissedOff) if (beatAnimCheck % 2 != 0 && currentMissStage != HowMissed.MissedOff)
{ {

View file

@ -58,6 +58,7 @@ namespace HeavenStudio.Games
public float beat; public float beat;
public bool goRight; public bool goRight;
} }
bool startLeft;
public static MrUpbeat instance; public static MrUpbeat instance;
@ -101,6 +102,14 @@ namespace HeavenStudio.Games
}); });
} }
} }
if (queuedInputs.Count % 2 != 0)
{
startLeft = true;
}
else
{
startLeft = false;
}
queuedInputs.Clear(); queuedInputs.Clear();
} }
if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN)) if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN))
@ -132,7 +141,7 @@ namespace HeavenStudio.Games
if (GameManager.instance.currentGame == "mrUpbeat") if (GameManager.instance.currentGame == "mrUpbeat")
{ {
float offSet = 0; float offSet = 0;
if (!MrUpbeat.instance.isPlaying(MrUpbeat.instance.metronomeAnim, "MetronomeIdle") && !MrUpbeat.instance.isPlaying(MrUpbeat.instance.metronomeAnim, "MetronomeGoRight")) if (MrUpbeat.instance.startLeft)
{ {
offSet = 1; offSet = 1;
} }
@ -157,6 +166,14 @@ namespace HeavenStudio.Games
} }
} }
if ((length + 1) % 2 != 0)
{
MrUpbeat.instance.startLeft = true;
}
else
{
MrUpbeat.instance.startLeft = false;
}
} }
else else
{ {

View file

@ -24,13 +24,13 @@ namespace HeavenStudio.Games.Loaders
{ {
function = delegate {var e = eventCaller.currentEntity; Tambourine.instance.MonkeyInput(e.beat, false); }, function = delegate {var e = eventCaller.currentEntity; Tambourine.instance.MonkeyInput(e.beat, false); },
defaultLength = 0.5f, defaultLength = 0.5f,
priority = 1 priority = 2
}, },
new GameAction("hit", "Hit") new GameAction("hit", "Hit")
{ {
function = delegate {var e = eventCaller.currentEntity; Tambourine.instance.MonkeyInput(e.beat, true); }, function = delegate {var e = eventCaller.currentEntity; Tambourine.instance.MonkeyInput(e.beat, true); },
defaultLength = 0.5f, defaultLength = 0.5f,
priority = 1 priority = 2
}, },
new GameAction("pass turn", "Pass Turn") new GameAction("pass turn", "Pass Turn")
{ {