From 2e85be6738b602477f6647adca86a2da53c334cb Mon Sep 17 00:00:00 2001 From: Jenny Crowe Date: Fri, 18 Feb 2022 07:32:38 -0700 Subject: [PATCH] BTSDS: Fine tuning for block animation timing. --- Assets/Scripts/Games/BuiltToScaleDS/Blocks.cs | 2 +- Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Games/BuiltToScaleDS/Blocks.cs b/Assets/Scripts/Games/BuiltToScaleDS/Blocks.cs index 0e7986dd..fb31fe18 100644 --- a/Assets/Scripts/Games/BuiltToScaleDS/Blocks.cs +++ b/Assets/Scripts/Games/BuiltToScaleDS/Blocks.cs @@ -24,7 +24,7 @@ namespace RhythmHeavenMania.Games.BuiltToScaleDS { if (!moving) return; - var windupBeat = createBeat + (createLength * 3.5f); + var windupBeat = createBeat + (createLength * 4f); var hitBeat = windupBeat + createLength; var currentBeat = Conductor.instance.songPositionInBeats; diff --git a/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs b/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs index 06c3d901..6381807e 100644 --- a/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs +++ b/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs @@ -74,7 +74,7 @@ namespace RhythmHeavenMania.Games.BuiltToScaleDS var ev = blockEvents[i]; if (spawnedBlockEvents.Contains(ev)) continue; // Don't spawn the same blocks multiple times. - var spawnBeat = ev.beat - (ev.length * 0.5f); + var spawnBeat = ev.beat - ev.length; if (currentBeat > spawnBeat && currentBeat < ev.beat + ev.length) { SpawnBlocks(spawnBeat, ev.length); @@ -125,18 +125,21 @@ namespace RhythmHeavenMania.Games.BuiltToScaleDS const int blockFramesPerSecond = 24; const int blockHitFrame = 39; const int blockTotalFrames = 80; + const int spawnFrameOffset = -3; List criticalFrames = new List { 7, 15, 23, 31, 39, 47 }; public void SetBlockTime(Blocks blocks, float spawnBeat, float length) { + float spawnTimeOffset = (float)spawnFrameOffset / (float)blockFramesPerSecond; + float secondsPerFrame = 1f / blockFramesPerSecond; float secondsToHitFrame = secondsPerFrame * blockHitFrame; float secondsPerBeat = Conductor.instance.secPerBeat; - float secondsToHitBeat = secondsPerBeat * 4.5f * length; + float secondsToHitBeat = secondsPerBeat * 5f * length + spawnTimeOffset; float speedMult = secondsToHitFrame / secondsToHitBeat; - float secondsPastSpawnTime = secondsPerBeat * (Conductor.instance.songPositionInBeats - spawnBeat); + float secondsPastSpawnTime = secondsPerBeat * (Conductor.instance.songPositionInBeats - spawnBeat) + spawnTimeOffset; float framesPastSpawnTime = blockFramesPerSecond * speedMult * secondsPastSpawnTime; // The only way I could deal with Unity's interpolation shenanigans without having a stroke.