diff --git a/Assets/Scripts/Games/BlueBear/Treat.cs b/Assets/Scripts/Games/BlueBear/Treat.cs index e8a9095b0..bafe36aaa 100644 --- a/Assets/Scripts/Games/BlueBear/Treat.cs +++ b/Assets/Scripts/Games/BlueBear/Treat.cs @@ -41,6 +41,7 @@ namespace HeavenStudio.Games.Scripts_BlueBear path.positions[0].height = pathToCopy.positions[0].height; path.positions[1].pos = pathToCopy.positions[1].pos; game.ScheduleInput(startBeat, flyBeats, isCake ? BlueBear.InputAction_Left : BlueBear.InputAction_Right, Just, Out, Out); + startBeat = Conductor.instance.GetUnSwungBeat(startBeat); Update(); } @@ -52,7 +53,7 @@ namespace HeavenStudio.Games.Scripts_BlueBear private void Update() { var cond = Conductor.instance; - transform.localPosition = GetPathPositionFromBeat(path, cond.songPositionInBeatsAsDouble, startBeat); + transform.localPosition = GetPathPositionFromBeat(path, cond.unswungSongPositionInBeatsAsDouble, startBeat); float flyPos = cond.GetPositionFromBeat(startBeat, flyBeats); if (flyPos > 2f) @@ -75,7 +76,7 @@ namespace HeavenStudio.Games.Scripts_BlueBear SoundByte.PlayOneShotGame("blueBear/chompDonut"); } - game.Bite(Conductor.instance.songPositionInBeatsAsDouble, isCake, hold); + game.Bite(Conductor.instance.unswungSongPositionInBeatsAsDouble, isCake, hold); game.EatTreat(); SpawnCrumbs(); @@ -100,7 +101,7 @@ namespace HeavenStudio.Games.Scripts_BlueBear path.positions[0].height = barelyHeight; path.positions[0].duration = 1; path.positions[1].pos = new Vector3(path.positions[0].pos.x + (isCake ? -barelyDistX : barelyDistX), path.positions[0].pos.y + barelyDistY); - startBeat = Conductor.instance.songPositionInBeatsAsDouble; + startBeat = Conductor.instance.unswungSongPositionInBeatsAsDouble; Update(); return; } diff --git a/Assets/Scripts/Games/CatchyTune/Fruit.cs b/Assets/Scripts/Games/CatchyTune/Fruit.cs index 41a16ec52..45d36eaa0 100644 --- a/Assets/Scripts/Games/CatchyTune/Fruit.cs +++ b/Assets/Scripts/Games/CatchyTune/Fruit.cs @@ -74,11 +74,11 @@ namespace HeavenStudio.Games.Scripts_CatchyTune { if (barelyStart > 0f) { - anim.DoScaledAnimation("barely", barelyStart, isPineapple ? 2f : 1f, clamp: true); + anim.DoScaledAnimation("barely", Conductor.instance.GetUnSwungBeat(barelyStart), isPineapple ? 2f : 1f, clamp: true); } else { - anim.DoScaledAnimation("fruit bounce", startBeat, beatLength + (isPineapple ? 4f : 2f), clamp: true); + anim.DoScaledAnimation("fruit bounce", Conductor.instance.GetUnSwungBeat(startBeat), beatLength + (isPineapple ? 4f : 2f), clamp: true); } } @@ -136,7 +136,7 @@ namespace HeavenStudio.Games.Scripts_CatchyTune if (state <= -1f || state >= 1f) { //near miss (barely) - barelyStart = Conductor.instance.songPositionInBeatsAsDouble; + barelyStart = Conductor.instance.unswungSongPositionInBeatsAsDouble; game.catchBarely(side); diff --git a/Assets/Scripts/Games/SpaceSoccer/Ball.cs b/Assets/Scripts/Games/SpaceSoccer/Ball.cs index d82d900fb..2bae47638 100644 --- a/Assets/Scripts/Games/SpaceSoccer/Ball.cs +++ b/Assets/Scripts/Games/SpaceSoccer/Ball.cs @@ -39,10 +39,11 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer } public void Init(Kicker kicker, double dispensedBeat) { + Conductor conductor = Conductor.instance; this.kicker = kicker; kicker.ball = this; kicker.dispenserBeat = dispensedBeat; - double currentBeat = Conductor.instance.songPositionInBeatsAsDouble; + double currentBeat = conductor.unswungSongPositionInBeatsAsDouble; kickPath = SpaceSoccer.instance.GetPath("Kick"); dispensePath = SpaceSoccer.instance.GetPath("Dispense"); highKickPath = SpaceSoccer.instance.GetPath("HighKick"); @@ -53,7 +54,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer { //Debug.Log("Dispensing"); state = State.Dispensing; - startBeat = dispensedBeat; + startBeat = conductor.GetUnSwungBeat(dispensedBeat); nextAnimBeat = startBeat + GetAnimLength(State.Dispensing); kicker.kickTimes = 0; return; @@ -74,31 +75,32 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer //Debug.Log("Setting state to kicked"); state = State.Kicked; double relativeBeat = currentBeat - dispensedBeat; - startBeat = dispensedBeat + (int)(relativeBeat - 0.1); //this makes the startBeat be for the kick that is currently in progress, but it won't play the kicker's animation for that kick. the -0.1 makes it so that if playback is started right when the kicker kicks, it still plays the kicker's animation. + startBeat = conductor.GetUnSwungBeat(dispensedBeat) + (int)(relativeBeat - 0.1); //this makes the startBeat be for the kick that is currently in progress, but it won't play the kicker's animation for that kick. the -0.1 makes it so that if playback is started right when the kicker kicks, it still plays the kicker's animation. nextAnimBeat = startBeat + GetAnimLength(State.Kicked); kicker.kickTimes = (int)(relativeBeat - 0.1) - numHighKicks - 1; //every high kick has 2 kicks in the same time a regular keep-up does 3 kicks. break; } else { - highKickSwing = 0.5f; if (highKicks[i].beat + GetAnimLength(State.HighKicked) > currentBeat) { + highKickSwing = conductor.GetSwingRatioAtBeat(highKicks[i].beat); //Debug.Log("Setting state to high kick"); state = State.HighKicked; double relativeBeat = highKicks[i].beat - dispensedBeat; - startBeat = dispensedBeat + Math.Ceiling(relativeBeat); //there is a chance this makes startBeat later than the current beat, but it shouldn't matter too much. It would only happen if the user places the high kicks incorrectly. + startBeat = conductor.GetUnSwungBeat(dispensedBeat) + Math.Ceiling(relativeBeat); //there is a chance this makes startBeat later than the current beat, but it shouldn't matter too much. It would only happen if the user places the high kicks incorrectly. nextAnimBeat = startBeat + GetAnimLength(State.HighKicked); kicker.kickTimes = (int)Math.Ceiling(relativeBeat) - numHighKicks - 1; break; } else { + highKickSwing = conductor.GetSwingRatioAtBeat(highKicks[i].beat + GetAnimLength(State.HighKicked)); //Debug.Log("Setting state to toe"); state = State.Toe; double relativeBeat = Math.Ceiling(highKicks[i].beat - dispensedBeat) + GetAnimLength(State.HighKicked); //there is a chance this makes startBeat later than the current beat, but it shouldn't matter too much. It would only happen if the user places the high kicks incorrectly. - startBeat = dispensedBeat + relativeBeat; + startBeat = conductor.GetUnSwungBeat(dispensedBeat) + relativeBeat; nextAnimBeat = startBeat + GetAnimLength(State.Toe); kicker.kickTimes = (int)(relativeBeat - GetAnimLength(State.HighKicked)) - numHighKicks; break; @@ -110,7 +112,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer //Debug.Log("Defaulting to kicked state"); state = State.Kicked; double relativeBeat = currentBeat - dispensedBeat; - startBeat = dispensedBeat + (int)(relativeBeat - 0.1); //this makes the startBeat be for the kick that is currently in progress, but it won't play the kicker's animation for that kick. the -0.1 makes it so that if playback is started right when the kicker kicks, it still plays the kicker's animation. + startBeat = conductor.GetUnSwungBeat(dispensedBeat) + (int)(relativeBeat - 0.1); //this makes the startBeat be for the kick that is currently in progress, but it won't play the kicker's animation for that kick. the -0.1 makes it so that if playback is started right when the kicker kicks, it still plays the kicker's animation. nextAnimBeat = startBeat + GetAnimLength(State.Kicked); kicker.kickTimes = (int)(relativeBeat - 0.1) - numHighKicks - 1; } @@ -178,7 +180,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer private void Update() { - double beat = Conductor.instance.songPositionInBeatsAsDouble; + double beat = Conductor.instance.unswungSongPositionInBeatsAsDouble; switch (state) //handle animations { case State.None: //the only time any ball should ever have this state is if it's the unused offscreen ball (which is the only reason this state exists) @@ -270,7 +272,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer case State.Kicked: return 1f; case State.HighKicked: - return 2f - highKickSwing; + return 1f + highKickSwing; case State.Toe: return 2f - (1f - highKickSwing); default: diff --git a/Assets/Scripts/Games/WizardsWaltz/Wizard.cs b/Assets/Scripts/Games/WizardsWaltz/Wizard.cs index c64407e8b..5b547639c 100644 --- a/Assets/Scripts/Games/WizardsWaltz/Wizard.cs +++ b/Assets/Scripts/Games/WizardsWaltz/Wizard.cs @@ -20,7 +20,7 @@ namespace HeavenStudio.Games.Scripts_WizardsWaltz void Update() { - songPos = (float)(Conductor.instance.songPositionInBeatsAsDouble - game.wizardBeatOffset); + songPos = (float)(Conductor.instance.unswungSongPositionInBeatsAsDouble - game.wizardBeatOffset); var am = game.beatInterval / 2f; var x = Mathf.Sin(Mathf.PI * songPos / am) * game.xRange; var y = Mathf.Cos(Mathf.PI * songPos / am) * game.yRange; diff --git a/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs b/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs index 9cc8e6259..a3c4d10b9 100644 --- a/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs +++ b/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs @@ -224,7 +224,7 @@ namespace HeavenStudio.Games intervalStartBeat = beat; foreach (var plant in currentPlants) { - var songPos = (float)(plant.createBeat - wizardBeatOffset); + var songPos = (float)(conductor.GetUnSwungBeat(plant.createBeat) - wizardBeatOffset); var am = (beatInterval / 2f); var x = Mathf.Sin(Mathf.PI * songPos / am) * xRange; var y = plantYOffset + Mathf.Cos(Mathf.PI * songPos / am) * (yRange * 1.5f); @@ -261,7 +261,7 @@ namespace HeavenStudio.Games if (!spawnedInactive) SoundByte.PlayOneShotGame("wizardsWaltz/plant", beat); Plant plant = Instantiate(plantBase, plantHolder.transform).GetComponent(); currentPlants.Add(plant); - var songPos = (float)(beat - wizardBeatOffset); + var songPos = (float)(conductor.GetUnSwungBeat(beat) - wizardBeatOffset); var am = (beatInterval / 2f); var x = Mathf.Sin(Mathf.PI * songPos / am) * xRange; var y = plantYOffset + Mathf.Cos(Mathf.PI * songPos / am) * (yRange * 1.5f);